I have a database with passwords encrypted in SHA1, I need to convert them to the SHA1 binary form and encode with base64, how can I get that?
This is what I have:
# echo -n "password" | openssl sha1
5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8
This is what I need:
# echo -n "password" | openssl sha1 -binary | base64
W6ph5Mm5Pz8GgiULbPgzG37mj9g=
this adds a newline though so you may need to use
or even simpler, as
@FrederickCheungsuggested:Edit
when you only have the hex string of the SHA-1 encoded password, then do
or you can even bypass the
base64library and solely rely onpack: