Git Product home page Git Product logo

Comments (1)

ColumPaget avatar ColumPaget commented on August 11, 2024

No, it's not a bug, but it is an interesting issue that had me scratching my head for a bit. Utilities like sha256sum and md5sum etc, print the hash value as a hex-encoded string. But the hash value is really just a large number. Hashrat can print this number as octal, hex-encoded, base-64, or a number of other output formats. But internally, when it's doing repeated hashing, hashrat doesn't convert the hash values to hex, base64, or anything else.

So, inside hashrat the sha256 hash is done, and this produces a binary value, not a hex-encoded string. That is then fed into the md5 hash, which produces another binary value, which is then encoded as hex, base64 or whatever for output (unless we want to do more hashes, where it is passed along the pipeline unencoded).

In order to simulate this with sha256 sum and md5sum, we'd need some way of decoding the hex output into raw bytes. I found the xxd utility can do this:

echo -n 'test' | sha256sum
9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 -
echo -n '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08' | xxd -r -p - | md5sum
9962791b4b77f382035b7869e0a8eaf8 -

Which now produces the same output as hashrat.

But this method of feeding the output of one hashing program into another hadn't occurred to me before, and it's handy for checking that hashrat is working as expected, so I'll be checking for this kind of thing going forwards.

from hashrat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.