0

I need to convert audio atmosphere file to bit to use it as a secret keys in stream cipher cryptography.

I don't know the logic of converting audio file to bits.

  • You can read the audio file as a binary file to convert it to bits. But I don't think using a recorded file as a secret key is secure. – NemoYuan2008 Mar 29 '23 at 09:48
  • You can extract information from a random quick sound sample (eg 1s) and generate a seed with it. Matlab and Python (librosa) have good audio analysis/feature extraction tools – Jorge Ruiz Gómez Mar 29 '23 at 11:27

1 Answers1

0

Generating cryptographically secure random number is not a trivial task. It is possible to do it from an audio file, but it needs some work.

First, you need some random input. A common method is to disconnect the microphone input and record the random thermal noise generated in the electronics of the sound card.

Then you need to estimate the amount of entropy (randomness) in the resulting file.

Then take a chunk of the file with more than 256 bits of entropy, preferably a lot more, say 2K bits of entropy, and pass it through a good cryptographic hash function, say SHA-256.

That will give you 256 bits of cryptographically secure randomness. Process the next chunk of the file in the same way for more random bits as necessary.

Do not use a pre-recorded sound file, as @NemoYuan2008 says. That will allow an attacker to run exactly the same process on exactly the same file. You also have the standard OTP problem of how to pass the keystream to the intended recipient, and to no-one else.

rossum
  • 15,344
  • 1
  • 24
  • 38