Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

goolm: deprecate custom base64 functions for base64.RawStdEncoding #165

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sumnerevans
Copy link
Member

Signed-off-by: Sumner Evans [email protected]

@@ -28,14 +29,13 @@ func Pickle(key, input []byte) ([]byte, error) {
return nil, err
}
ciphertext = append(ciphertext, mac[:pickleMACLength]...)
encoded := goolm.Base64Encode(ciphertext)
return encoded, nil
return []byte(base64.RawStdEncoding.EncodeToString(ciphertext)), nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main reason I didn't do this before is that it's effectively doing return []byte(string(base64Bytes)) instead of just return base64Bytes

I'm not sure if the compiler is smart enough to optimize it away, might need to add exbase64 to go-util with some helper methods like func EncodeToBytes(enc *base64.Encoding, data []byte) []byte

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was more thinking about this as a first step towards wrapping libolm/goolm in a more sane (non-base64-based) API to the Go code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants