Consistency Between Different Cryptographic Hashes (SHA-256) Client-side and Server-side?

Will different Cryptographic Hashes (of same type)  return different values? I need to run a JavaScript version of a SHA-256 hash against some data client side. We will also have a rest api service running that needs to duplicate and produce the same hashes. I've read where certain version of a SHA-256 hash return different values based on who developed it and the platform. So how do we get around this? Also any recommendations for a specific version of SHA-256? The files will be small, 200-400 bytes each.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Russ SuterCommented:
Ugh, I hate when questions like this come up because it makes me question reality. There SHOULD be only one version of SHA-256 and it should be implemented the same way regardless of platform or language. However, I did find something here ( that indicates Javascript implements it differently.

I think my approach would be to write a simple, tiny server-based function that handles the hashing then use some SOAP or JSON to deal with getting Javascript to communicate with that server.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dave BaldwinFixer of ProblemsCommented:
Yes, there are known differences in hash and encryption implementations.  There are notes about dealing with the differences between PHP and ASP,NET implementations.  You are stuck using the version that is part of your programming language.
btanExec ConsultantCommented:
SHA 256 regardless of language should always return you that 256 bits length - if it differs it is probably due to encoding binary to Based64, UTF8 (wide char) etc. See these test against various implementation - - eventually the algorithm does not change - here is another test demo
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.