key-test.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. source test-common.sh
  3. IN_WAV=key-test.wav
  4. KEY1=key-test-1.key
  5. KEY2=key-test-2.key
  6. OUT1_WAV=key-test-out1.wav
  7. OUT2_WAV=key-test-out2.wav
  8. TEST_MSG2=0123456789abcdef0123456789abcdef
  9. audiowmark test-gen-noise $IN_WAV 30 44100
  10. audiowmark gen-key $KEY1
  11. audiowmark gen-key $KEY2
  12. audiowmark_add --key $KEY1 $IN_WAV $OUT1_WAV $TEST_MSG
  13. audiowmark_add --key $KEY2 $IN_WAV $OUT2_WAV $TEST_MSG2
  14. # shouldn't be able to detect watermark without correct key
  15. audiowmark_cmp --key $KEY1 --expect-matches 1 $OUT1_WAV $TEST_MSG
  16. audiowmark_cmp --key $KEY2 --expect-matches 0 $OUT1_WAV $TEST_MSG
  17. audiowmark_cmp --expect-matches 0 $OUT1_WAV $TEST_MSG
  18. audiowmark_cmp --key $KEY2 --expect-matches 1 $OUT2_WAV $TEST_MSG2
  19. audiowmark_cmp --key $KEY1 --expect-matches 0 $OUT2_WAV $TEST_MSG2
  20. audiowmark_cmp --expect-matches 0 $OUT2_WAV $TEST_MSG2
  21. rm $OUT1_WAV $OUT2_WAV
  22. # double watermark with two different keys
  23. audiowmark_add $IN_WAV $OUT1_WAV $TEST_MSG
  24. audiowmark_add --test-key 42 $OUT1_WAV $OUT2_WAV $TEST_MSG2
  25. audiowmark_cmp --expect-matches 1 $OUT2_WAV $TEST_MSG
  26. audiowmark_cmp --test-key 42 --expect-matches 1 $OUT2_WAV $TEST_MSG2
  27. rm $IN_WAV $KEY1 $KEY2 $OUT1_WAV $OUT2_WAV
  28. exit 0