This project showcases the process of generating a secure mnemonic phrase by incorporating standard entropy with additional entropy captured from microphone audio input.
Security is paramount when generating mnemonic phrases for use in cryptocurrency wallets or other applications demanding robust encryption. By introducing entropy from a microphone's audio input, the mnemonic generation process becomes less predictable and more resistant to attacks compared to using standard entropy alone.
In this example, we record a short audio sample, compute its hash, and merge it with securely generated entropy before creating the mnemonic phrase. This approach enhances security while adding a unique element to each generated mnemonic phrase.
- Entropy Generation: Secure entropy is generated using a trusted cryptographic library.
- Audio Recording: Audio input is captured from the user's microphone.
- Audio Hash Calculation: An audio sample is hashed after recording.
- Entropy Combination: Both the generated entropy and audio hash are merged into a single entity.
- Mnemonic Generation: The combined entropy is used to produce a mnemonic phrase following the BIP39 standard.
- Go (Recommended version: 1.x or higher)
- PortAudio
- Go packages:
github.com/gordonklaus/portaudio
github.com/tyler-smith/go-bip39
golang.org/x/crypto/hkdf
To execute this example, follow these steps:
- Install the necessary dependencies.
- Clone the repository or download the source code.
- Navigate to the project directory via the command line.
- Run
go run main.go
to start the application.
During execution, the application will prompt you to speak into the microphone and briefly record audio. After recording, it processes the audio, generates combined entropy, and ultimately prints out the mnemonic phrase.
While adding entropy from audio provides an additional security layer, it's vital to note that the quality of entropy will depend on environmental conditions and the microphone hardware's quality. This method should be used as an extra security layer in conjunction with other reliable entropy generation methods.
Contributions, enhancements, and bug reports are always welcome.