Skip to content

Instantly share code, notes, and snippets.

@EmperorTomatoKetchup
Created August 10, 2022 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EmperorTomatoKetchup/3f9845892d9bede212df6b9dece46f59 to your computer and use it in GitHub Desktop.
Save EmperorTomatoKetchup/3f9845892d9bede212df6b9dece46f59 to your computer and use it in GitHub Desktop.
erroneous hash
const crypto = require("crypto");
const atob = require("atob");
// Decoding the base64 encoded string below produces the IPFS 429 response:
// <html>
// <head><title>429 Too Many Requests</title></head>
// <body>
// <center><h1>429 Too Many Requests</h1></center>
// <hr><center>openresty</center>
// </body>
// </html>
const data = atob("PGh0bWw+DQo8aGVhZD48dGl0bGU+NDI5IFRvbyBNYW55IFJlcXVlc3RzPC90aXRsZT48L2hlYWQ+DQo8Ym9keT4NCjxjZW50ZXI+PGgxPjQyOSBUb28gTWFueSBSZXF1ZXN0czwvaDE+PC9jZW50ZXI+DQo8aHI+PGNlbnRlcj5vcGVucmVzdHk8L2NlbnRlcj4NCjwvYm9keT4NCjwvaHRtbD4NCg==");
// Taking the sha256 hash of the result of ^^ will produce: 5bb1c8a8390c284e9a4634c04eee34dfd08759d66d2b613b0631ab10e2f1f3d9
const hash = crypto.createHash("sha256").update(data).digest("hex");
console.log(hash);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment