Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What does the SHA256 Function do with "non valid input" #486

Open
NeikiDev opened this issue Mar 26, 2024 · 0 comments
Open

What does the SHA256 Function do with "non valid input" #486

NeikiDev opened this issue Mar 26, 2024 · 0 comments

Comments

@NeikiDev
Copy link

Hey so my friend send me an script where he tried to hash a file.

He did it wrong (we fixed it already) but i was wondering why, if i give the SHA256 hash function an Buffer object, it always gives me back the same hash "4ea5c508a6566e76240543f8feb06fd457777be39549c4016436afda65d2330e"

example script:

const CryptoJS = require("crypto-js");
console.log("HASH: " + CryptoJS.SHA256(function() {}));
console.log("HASH: " + CryptoJS.SHA256(Buffer));
console.log("HASH: " + CryptoJS.SHA256(ArrayBuffer));
console.log("HASH: " + CryptoJS.SHA256(String));
console.log("HASH: " + CryptoJS.SHA256(Number));
console.log("HASH: " + CryptoJS.SHA256(Boolean));

output

HASH: 4ea5c508a6566e76240543f8feb06fd457777be39549c4016436afda65d2330e
HASH: 4ea5c508a6566e76240543f8feb06fd457777be39549c4016436afda65d2330e
HASH: 4ea5c508a6566e76240543f8feb06fd457777be39549c4016436afda65d2330e
HASH: 4ea5c508a6566e76240543f8feb06fd457777be39549c4016436afda65d2330e
HASH: 4ea5c508a6566e76240543f8feb06fd457777be39549c4016436afda65d2330e
HASH: 4ea5c508a6566e76240543f8feb06fd457777be39549c4016436afda65d2330e

its always the same hash, so what does the function hash in that moment? whats the value of the hash?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant