davidludwig / smallsha1 Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/smallsha1
Automatically exported from code.google.com/p/smallsha1
if hash is only 20 bytes in size, as your documentation and example code
suggest, your code writes into unallocated memory:
for (int hashByte = 20; --hashByte >= 0;)
{
hash[hashByte] = (result[hashByte >> 2] >> (((3 - hashByte) & 0x3) << 3)) & 0xff;
}
hash needs to be at least 21 bytes in size.
Original issue reported on code.google.com by [email protected]
on 21 Dec 2013 at 3:15
What steps will reproduce the problem?
1. Downloaded sha1.cpp and sha1.h
2. Created a Project, files in the same dir as main.cpp
3. Compiled and ran each time
What is the expected output? What do you see instead?
Expected output: a9993e364706816aba3e25717850c26c9cd0d89d
Random hash changes each time the program is run.
What version of the product are you using? On what operating system?
Dev-C++ 4.9.9.2 on Windows 7 64bit
Please provide any additional information below.
The only conclusion I can think of is the code was made for a 32bit system
instead of 64bit?
Original issue reported on code.google.com by [email protected]
on 11 Nov 2010 at 10:45
Attachments:
I'm attempting to re-write the excellent smallsha1 for Arduino. The big issue
is that the Arduino environment has 16-bit ints, instead of the 32 bits
expected here. My naive strategy was to replace ints with longs.
Weirdly, calc(..) now works for arrays of three characters, but not for other
lengths:
plain text: "abc"
result: a9993e364706816aba3e25717850c26c9cd0d89d
expected: a9993e364706816aba3e25717850c26c9cd0d89d
plain text: ""
result: 92b404e556588ced6c1acd4ebf053f6809f73a93
expected: da39a3ee5e6b4b0d3255bfef95601890afd80709
plain text: "hello"
result: 0c2a6006740560e244bea4096941fe2efb556fc0
expected: aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d
Any thoughts? I'm attaching the hacked version of the source.
Bruno
Original issue reported on code.google.com by [email protected]
on 6 Jun 2014 at 5:17
Attachments:
I download the source code and compile it,but the result seemed to be wrong.
using this main function:
int main(int argc, char* argv[])
{
unsigned char hash[20];
char hexstring[41];
sha1::calc("Teststring",10,hash); // 10 is the length of the string
sha1::toHexString(hash, hexstring);
printf("%s\n",hexstring);
}
and i got these two different result.i dont know why.
mayli@matrix:~/code/sha1test$ ./test
5cfe99f354c9eac90b08c47d67026d2257612f6d
mayli@matrix:~/code/sha1test$ sha1sum 1000sha1.txt
2f20685189c918d40c6bda8b25429b158328e5cd 1000sha1.txt
by the way i calculated the sha1.zip file with sha1sum, where i got the same
result as sha1 on the downloads page, so please show me a sample to how to make
these two sha1 the same.
under Linux 2.6.31-14 g++ 4.4.1
Original issue reported on code.google.com by [email protected]
on 11 Jul 2010 at 5:52
Attached.
Original issue reported on code.google.com by [email protected]
on 31 May 2010 at 2:54
Attachments:
The integration of the SHA1 code worked flawlessly, calculation is working
nicely.
But files need to be loaded into memory completely and this can be a problem
for huge files.
Would it be possible to have some functions that do incremental encoding?
The idea would be:
Call INIT function to do basic stuff
Call CALC function with pointer to memory block and the length of the block
again and again until the file is hashed completely
Call RESULT function to get the hash
Maybe this is some easy task for you?
Original issue reported on code.google.com by [email protected]
on 12 Jan 2015 at 2:12
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.