A robust digital audio watermarking system using RSA cryptography and PN sequences for embedding and verifying unique signatures within WAV files.
✅ Generate RSA key pairs for signing and verification.
✅ Embed a unique digital signature as an imperceptible watermark in the audio file.
✅ Extract and verify the watermark to ensure authenticity.
✅ Robust against minor audio alterations while maintaining integrity.
Make sure you have the following installed:
Linux (Ubuntu/Debian)
sudo apt install ffmpeg
MacOS
brew install ffmpeg
Windows
Download and install from FFmpeg official website.
Run the following inside your project directory:
go mod tidy
The WAV file is converted to the required format (Only done due to the limitations of the go-audio package):
cmd := exec.Command("ffmpeg", "-y", "-i", inputFile,
"-ac", "1", "-ar", "8000", "-acodec", "pcm_s16le", outputFile)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
log.Fatalf("FFmpeg conversion failed: %v", err)
}
privKey, pubKey := utils.GenerateKeys()
signature, err := utils.SignMessage([]byte("Unique watermark metadata"), privKey)
if err != nil {
log.Fatal(err)
}
pn := utils.SignatureToPN(signature)
length := watermark.EmbedWatermark(buffer, pn)
extractedPN := watermark.ExtractWatermark(buffer, length)
extractedSignature := utils.PNToSignature(extractedPN)
if err := utils.VerifySignature([]byte("Unique watermark metadata"), extractedSignature, pubKey); err != nil {
log.Fatal("Watermark verification failed!")
} else {
fmt.Println("Successfully verified audio watermark!")
}
📂 digital-audio-watermarking
│── main.go # Main entry point
│── utils/
│ ├── utils.go # Key generation, signing, verification
│── watermark/
│ ├── watermark.go # Embedding and extraction logic
│── go.mod # Go module dependencies
│── README.md # This file!
1️⃣ Place a WAV file (input.wav
) in the project folder.
2️⃣ Run the watermarking process:
go run main.go
3️⃣ The output file (output.wav
) will contain an embedded watermark.
4️⃣ The program will extract and verify the watermark.
This project is licensed under the MIT License.
Feel free to open issues or submit pull requests to improve this project! 🚀
🔹 Developed with ❤️ in Golang 🔹