elasticdog / transcrypt

transparently encrypt files within a git repository
MIT License
1.46k stars 102 forks source link

base64 wraps differently depending on platform #140

Closed dannycoates closed 2 years ago

dannycoates commented 2 years ago

This line https://github.com/elasticdog/transcrypt/blob/main/transcrypt#L151 produces different output depending on the platform. On mac it outputs a single line, while on linux it wraps at 76 chars. I believe openssl was previously wrapping at 64 chars. Unfortunately the flags to set the wrap width are different as well, -b on mac and -w on linux.

It causes git to see the files as "modified" when committed on one platform and pulled on another.

jmurty commented 2 years ago

Wow, thanks for catching this @dannycoates! Our tests always run on a single platform at a time, not cross platform, and don't check the exact Base64 format so we'd never notice this until real-world cross-platform use.

I started looking into how to detect the right base64 flags to use for different platforms, before I realised that OpenSSL itself will do it with openssl base64 – and will hopefully do it the same way on all platforms without fuss.

Can you check if the latest version on main (commit 00a2cbb660f9e47e553159d3cb9461f226100c8a) fixes this cross-platform problem?

dannycoates commented 2 years ago

Yep, openssl base64 works for me. Thanks!