I am making a tool that generates 16 character long password out of a 64-bit binary number. But I dont know how to make an encryption key for that, or where I can find one.

To show what i mean, here is an example with 8 bits:

I have the binary number: 10110111

The output could than look something like this:


And I want the password that gets generated from this: 10010000, to be completely differnt than the password that gets generated from this: 10010001.

Can anyone help me with this, or maybe redirect me to a site that says something about these types of encryption?

Note: I am very new to cryptography, so this might be simple for most of you, or maybe harder than I think.

  • 2
    $\begingroup$ Why do you want to do this? There might be a better solution for the problem that you are trying to solve. Also, are you aware that the resultant "password" will only have a maximum of 64 bits of entropy, regardless of how long /complex it is? $\endgroup$
    – Ella Rose
    Oct 19, 2018 at 19:19
  • $\begingroup$ @EllaRose, yes I am aware of that, I might increase the number of bits later. But before that, I would like to see if I can do it, and understand how. $\endgroup$
    – Benjamhw
    Oct 19, 2018 at 19:25

1 Answer 1


You can use Key Derivation functions (KDF) to generate secret keys, e.g., from passwords. In 2013 a Password Hashing Competition was organized and the winner is Argon2 KDF. Argon now very popular and it has a new version named argon2i.

From Wikipedia;

In cryptography, a key derivation function (KDF) derives one or more secret keys from a secret value such as a master key, a password, or a passphrase using a pseudorandom function. KDFs can be used to stretch keys into longer keys or to obtain keys of a required format, such as converting a group element that is the result of a Diffie–Hellman key exchange into a symmetric key for use with AES.

Once a key is generated, you can stip the key into the desired size.

In the end, if you want to human readable generated keys apply Base64 encoding for the derived key. Base64 encoding uses 6-bit to encode data From $A–Z, a–z,0–9$, and $+,/$.

  • $\begingroup$ Thanks, so it is possible to convert a binary number with Argon2? Im sorry if this is a stupid question, but as I wrote, im very new to this. $\endgroup$
    – Benjamhw
    Oct 19, 2018 at 20:33
  • 2
    $\begingroup$ No, that's performed by the base (64) conversion. Argon2 can be used to strengthen the (low entropy) input and to expand the input size. $\endgroup$
    – Maarten Bodewes
    Oct 19, 2018 at 20:49
  • $\begingroup$ I think you've got the base 64 encoding backwards. You encode 6 bits using the characters shown, you don't use 6 bits to encode the characters. $\endgroup$
    – Maarten Bodewes
    Oct 19, 2018 at 20:53
  • $\begingroup$ @Benjamhw Basically there are two very separate concepts. One is the conversion of your 64 bit value into many more bits (from which it is hard to determine the original 64 bits). Second is the conversion of your bits to human readable characters. The first step is called key derivation and can be handled by Argon2i (or pbkdf, or bcrypt, or scrypt). The second step is often called "encoding" and can be handled by standard techniques such as base64 and base58 - it is an extremely common operation in many programs and not related to cryptography. $\endgroup$ Oct 19, 2018 at 22:01
  • $\begingroup$ Ok, I think I understand it now. Thanks for explaining! @ThomasM.DuBuisson $\endgroup$
    – Benjamhw
    Oct 19, 2018 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.