I am looking to store and retrieve hashes of authentic audio files on the Ethereum blockchain with the purpose of checking authenticity of these audio files in the future with the hashes stored on the Ethereum blockchain.

But the main concern is that even slightly tempered audio file with regards to bitrarte will provide a different hash and hence will come out as non-authentic. Can I stored multiple hashes of different versions of the authentic audio files on the Ethereum blockchain.

What is the best way to achieve this on the Ethereum blockchain? can a smart contract be used to achieve this use case. What hash function should be used on the audio files that would be suitable for storing in an ethereum smart contract, does it matter if its sha1/sha256.

  • I'm voting to close this question as this question is not about Ethereum but about different hashing algorithms. – Lauri Peltonen Jun 6 '18 at 10:35
  • I disagree - it was clear from the 1st sentence that it was about storing and retrieving information from the (Ethereum) blockchain. I edited the question to better align it with ethereum and smart contracts. – Lismore Jun 7 '18 at 0:20
  • I've used MFCC en.wikipedia.org/wiki/Mel-frequency_cepstrum, to fingerprint and later identify audio sequences like Shazam. But how to do it correctly is beyond of the scope for this site. – Ismael Jun 7 '18 at 2:30

Use a smart contract to hold all hashes of different versions of the file.

create a function to check each hash, can be improve to have a generic function taking the string and looking through a list/collection or checking against multiple variables holding different hashes for different versions.

Here is a working example

pragma solidity ^0.4.0;
contract AudioAuthenticity {

 string constant wavehash = "dea7db275ee984f7f4bf0e2b5ba77aa428e780ca5fda49435960c7fef1b4b94b";
 string constant mp3hash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";

 function checkMp3VersionHash(string hashInput)public returns(bool){

    bool result = compareHashes(hashInput, mp3hash);
    return result;

 function compareHashes (string a, string b) private view returns (bool){
   return keccak256(a) == keccak256(b);

Here is a link to the github gist code https://gist.github.com/lismore/c4f11e5f87e63b3a9f7dc1cd9043fc9b

Screen shot of input and output of working smart contract below.

enter image description here

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