Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

How can most people easily solve stuff like this:

sha256("foo") mod 100

google and wolframalpha didn't do it.

By easily I mean like type it in an online web calculator, or use software installed by default on Windows, MacOS and Linux.

thx

share|improve this question

closed as off-topic by Amzoti, T. Bongers, Davide Giraudo, Nate Eldredge, Thomas Oct 26 '13 at 22:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is not about mathematics, within the scope defined in the help center." – Amzoti, T. Bongers, Davide Giraudo, Nate Eldredge, Thomas
If this question can be reworded to fit the rules in the help center, please edit the question.

    
What is "foo"?.. –  Sujaan Kunalan Oct 26 '13 at 21:20
    
@sujaan foo is an arbitrary string as argument to the sha256 hash function. –  Bernhard Kuemel Oct 26 '13 at 21:21
1  
Try this: xorbin.com/tools/sha256-hash-calculator –  vadim123 Oct 26 '13 at 21:21
    
@BernhardKuemel, I don't understand the downvotes. This is a legitimate question about a mathematical formula expressed as an algorithm. –  vadim123 Oct 26 '13 at 21:22
1  
On Linux, you should have sha256sum installed by default. You could then pipe it to bc (also should be default-installed) to compute the remainder modulo 100. –  Daniel Fischer Oct 26 '13 at 21:25

1 Answer 1

up vote 0 down vote accepted

python -c "from hashlib import sha256; print int(sha256('foo').hexdigest(),16)%100" for Linux/Mac, etc.

IdeOne for all platforms.

share|improve this answer
    
works for me. Does it work on Windows and Mac, too? –  Bernhard Kuemel Oct 26 '13 at 21:56
    
Mac OS X 10.8 comes with Python 2.7 pre-installed. Not for Windows. –  ftfish Oct 26 '13 at 21:58
    
@BernhardKuemel see edit. –  ftfish Oct 26 '13 at 22:15
    
@ideOne: I hear python is not installed on Windows by default, so it would have to be installed and added to the path. Thanks for the partial solution, though. –  Bernhard Kuemel Oct 26 '13 at 22:36
    
@BernhardKuemel python is not installed by default on windows, but IdeOne is a website which is usable on all major platforms. Click on the link I posted to see how it looks like. –  ftfish Oct 26 '13 at 23:01

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