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

The test binary fails to decode some well-formed base64-encoded strings #8

Closed
ghost opened this issue Jan 22, 2016 · 1 comment
Closed

Comments

@ghost
Copy link

ghost commented Jan 22, 2016

make
export j=""
for i in b a s e 6 4 t e s t; do
  j="$j$i"
  echo -n $j | /usr/bin/base64 | ./bin/base64 -d
  echo
done

Output:

b
ba
decoding error

base
base6
decoding error

base64t
base64te
decoding error

base64test
@aklomp
Copy link
Owner

aklomp commented Jan 22, 2016

That's because /usr/bin/base64 prints a trailing newline. Try this instead:

#!/bin/sh
export j=""
for i in b a s e 6 4 t e s t; do
  j="$j$i"
  echo -n $j | /usr/bin/base64 | tr -d "\n" | bin/base64 -d
  echo
done

Or /usr/bin/base64 -w0.

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

No branches or pull requests

1 participant