|
|
Comments and Discussions
|
|
 |
|

|
have you tried to implement sha1 with a 16-bits processeur ?
|
|
|
|

|
I know it has been broken many times over but for completness sake will you consider implementing it as well? nice article got my 5
|
|
|
|
|

|
Thanks mate
It was really helpful
Can I omit the zero addition of MD5 encription?
|
|
|
|

|
Thank you for your efforts but everyone should check-out crypto++ for a solution they can use..
|
|
|
|

|
Hi in sha2.h you have written wrong declaration.
Your code is as follows;
/* define an unsigned 64-bit type */
#if defined( _MSC_VER )
typedef unsigned __int64 sha2_64t;
#define s_u64 ui64
#elif ULONG_MAX == 0xffffffffffffffff
typedef unsigned long sha2_64t;
#define s_u64 ul
#elif ULONG_MAX == 0xffffffff
typedef unsigned long long sha2_64t; /* a somewhat dangerous guess */
#define s_u64 ull
#else
#error Please define sha2_64t as an unsigned 64 bit type in sha2.h
#endif
Here the conditions given are in reverse order and i think u should check for ULONG_MAX == 0xffffffffffffffff for declaration of unsigned long long and not for unsigned long as you have done.
Also are you sure about the padding scheme you have followed?
Ashwin Patti
|
|
|
|

|
what is the polynomial used in the CRC-16 algorithm?
PauMS
|
|
|
|

|
When checking the return value of _findfile in the HashPath function, you are checking the wrong variable. _findfile always returns -1 on failure and sets errno to the error value. Here is the fix:
if (lHandle == -1)
{
if(errno == EINVAL) return RH_INVALID_PATH;
if(errno == ENOENT) return RH_NO_PATTERN_MATCH;
return RH_CANNOT_OPEN_FILE;
}
|
|
|
|

|
Just wanted to say thank you very much. I was having difficulty understanding how to calculate crc16 values and this made my life much easier
|
|
|
|
|
|

|
i don't like all these manuals writen like the msdn all these stuff i don't get it only what i want is HOW TO use it
only some lines code not all functions off all classes with more classes and......
do someone understand what i'm trying to say in my bad english?
have someone these lines code for me
(or a better maual for beginners)
thx
|
|
|
|

|
Hi,
I really liked this hash calculator. I am a software developer and would appreciate it if I could be able to use this from VB 6. I am only interested in the FCS 16 and FCS 32 algorithms. The problem I am running into is that VB does not support bit shifting and because of this I have to do it manually. But that gives me incorrect CRC values some times. If anyone can point me to something that could do this in VB or be called from VB it would be nice. If anyone can figure out code anomalies that would be nice too. I am attaching my code below.
Thanks in advance.
Vishal.
Option Explicit
Public CRCArray As Variant
Public Function CalcCRC(DataString As String) As String
Dim DataLen As Integer
Dim CRCValue As Long
Dim CRCShiftRight As Integer
Dim X As Integer
Dim NextPieceofData As Integer
Dim CRCShiftRightStr As String
Dim ArrayPointer As Integer
'invert
Dim CRCIntStr As String
Dim CRCFinalString As String
Dim CRCletter As String
Dim TempStr As String
Dim CRCShiftRightLONG As Long
'invert
DataLen = Len(DataString)
'init variables
CRCShiftRight = 0
ArrayPointer = 0
' Enought potatoes
' fcs = (fcs >> 8) ^ fcstab[(fcs ^ datapiece) & 0xff];
' int CRC to 0xffff
CRCValue = &HFFFF
' Loop thru data
For X = 1 To DataLen
NextPieceofData = Asc(Mid(DataString, X, 1))
' SHIFT RIGHT (By turning to Hex movng letters and then back to integer)
CRCShiftRightLONG = CRCValue And &HFF00
'Long to short conversion
If CRCShiftRightLONG < 32767 Then
CRCShiftRight = CRCShiftRightLONG
TempStr = Hex(CRCShiftRight)
Else
TempStr = Hex(CRCShiftRightLONG)
End If
' End Long to short conversion
'Take care of extra or not enough Hex Characters
If Len(TempStr) = 4 Then
CRCShiftRightStr = Mid(TempStr, 1, 2)
Else
If Len(TempStr) = 3 Then
CRCShiftRightStr = Mid(TempStr, 1, 1)
Else
If Len(TempStr) < 3 Then
CRCShiftRightStr = "00"
Else
If Len(TempStr) > 4 Then
CRCShiftRightStr = "00"
Debug.Print "lentempstr error"
End If
End If
End If
End If
'End Take care of extra or not enough Hex Characters
CRCShiftRight = Val("&H" & CRCShiftRightStr)
' END SHIFT RIGHT
'ArrayPointer
ArrayPointer = (CRCValue Xor NextPieceofData) And &HFF
'End ArrayPointer
'XOR
CRCValue = (CRCShiftRight) Xor CRCArray(ArrayPointer)
'End XOR
Next
'Fix neg Numbers
If CRCValue < 0 Then
CRCValue = 65536 + CRCValue
End If
'End Fix Ned Numbers
CRCValue = CRCValue Xor &HFFFF
CRCFinalString = Hex(CRCValue)
Dim HiCRC As String
Dim LoCRC As String
Dim Hi As Byte
Dim Lo As Byte
HiCRC = Hex(CRCValue And &HFF)
Hi = Val("&H" & HiCRC)
LoCRC = Mid(CRCFinalString, 5, 2)
Lo = Val("&H" & LoCRC)
DataString = DataString & Chr(Hi) & Chr(Lo)
CalcCRC = DataString
End Function
Public Sub Init()
CRCArray = Array( _
&H0, &H1189, &H2312, &H329B, &H4624, &H57AD, &H6536, &H74BF0, &H8C48, &H9DC1, &HAF5A, &HBED3, &HCA6C, &HDBE5, &HE97E, &HF8F7, _
&H1081, &H108, &H3393, &H221A, &H56A5, &H472C, &H75B7, &H643E, &H9CC9, &H8D40, &HBFDB, &HAE52, &HDAED, &HCB64, &HF9FF, &HE876, _
&H2102, &H308B, &H210, &H1399, &H6726, &H76AF, &H4434, &H55BD, &HAD4A, &HBCC3, &H8E58, &H9FD1, &HEB6E, &HFAE7, &HC87C, &HD9F5, _
&H3183, &H200A, &H1291, &H318, &H77A7, &H662E, &H54B5, &H453C, &HBDCB, &HAC42, &H9ED9, &H8F50, &HFBEF, &HEA66, &HD8FD, &HC974, _
&H4204, &H538D, &H6116, &H709F, &H420, &H15A9, &H2732, &H36BB, &HCE4C, &HDFC5, &HED5E, &HFCD7, &H8868, &H99E1, &HAB7A, &HBAF3, _
&H5285, &H430C, &H7197, &H601E, &H14A1, &H528, &H37B3, &H263A, &HDECD, &HCF44, &HFDDF, &HEC56, &H98E9, &H8960, &HBBFB, &HAA72, _
&H6306, &H728F, &H4014, &H519D, &H2522, &H34AB, &H630, &H17B9, &HEF4E, &HFEC7, &HCC5C, &HDDD5, &HA96A, &HB8E3, &H8A78, &H9BF1, _
&H7387, &H620E, &H5095, &H411C, &H35A3, &H242A, &H16B1, &H738, &HFFCF, &HEE46, &HDCDD, &HCD54, &HB9EB, &HA862, &H9AF9, &H8B70, _
&H8408, &H9581, &HA71A, &HB693, &HC22C, &HD3A5, &HE13E, &HF0B7, &H840, &H19C9, &H2B52, &H3ADB, &H4E64, &H5FED, &H6D76, &H7CFF, _
&H9489, &H8500, &HB79B, &HA612, &HD2AD, &HC324, &HF1BF, &HE036, &H18C1, &H948, &H3BD3, &H2A5A, &H5EE5, &H4F6C, &H7DF7, &H6C7E, _
&HA50A, &HB483, &H8618, &H9791, &HE32E, &HF2A7, &HC03C, &HD1B5, &H2942, &H38CB, &HA50, &H1BD9, &H6F66, &H7EEF, &H4C74, &H5DFD, _
&HB58B, &HA402, &H9699, &H8710, &HF3AF, &HE226, &HD0BD, &HC134, &H39C3, &H284A, &H1AD1, &HB58, &H7FE7, &H6E6E, &H5CF5, &H4D7C, _
&HC60C, &HD785, &HE51E, &HF497, &H8028, &H91A1, &HA33A, &HB2B3, &H4A44, &H5BCD, &H6956, &H78DF, &HC60, &H1DE9, &H2F72, &H3EFB, _
&HD68D, &HC704, &HF59F, &HE416, &H90A9, &H8120, &HB3BB, &HA232, _
&H5AC5, &H4B4C, &H79D7, &H685E, &H1CE1, &HD68, &H3FF3, &H2E7A, _
&HE70E, &HF687, &HC41C, &HD595, &HA12A, &HB0A3, &H8238, &H93B1, _
&H6B46, &H7ACF, &H4854, &H59DD, &H2D62, &H3CEB, &HE70, &H1FF9, _
&HF78F, &HE606, &HD49D, &HC514, &HB1AB, &HA022, &H92B9, &H8330, _
&H7BC7, &H6A4E, &H58D5, &H495C, &H3DE3, &H2C6A, &H1EF1, &HF78)
End Sub
|
|
|
|
|

|
http://www.repairfaq.org/filipg/LINK/F_crc_v3.html[^]
This document talks about the theory behind CRC computations and how to generate table driven CRCs for any polynomial. All the CRCs and FDC (another word for CRC?) use the same algorithm. The CCITT version listed here is just the hardware method of computing a CRC and it is slower than a table driven implementation.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|

|
I have a question about CRC and MD5 algorithms:
Is it easy to generate the same int or long value with different strings?
I wait for your answer!
|
|
|
|

|
I have a question about CRC and MD5 algorithms:
Is it easy to generate the same int or long value with different strings?
For CRC: CRC has been designed to detect random transmission errors, so you can easily verify corrupted downloads or something like this. BUT you can easily find strings that hash to the same CRC value. In other words: CRCs aren't resistant against attacks, but are fine to quickly check for transmission errors.
For MD5: MD5 is cryptographically secure. This means that it is computationally infeasible ( = it's not impossible but currently nobody can do it) to find two strings that hash to the same MD5 value. MD5 is a 128-bit hash, so compared to a CRC-32 it should also be more collision-resistant.
So, to sum it up: if you need a secure hash then use MD5. If you just want to quickly check if a downloaded file isn't corrupted then use CRC.
Best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|

|
MD5 To Be Considered Harmful Someday
http://developers.slashdot.org/developers/04/12/07/2019244.shtml?tid=93&tid=172&tid=8[^]
"demonstrates the use of colliding datasets to create two executable packages with wildly different behavior but the same MD5 hash. The faults discovered are problematic but not yet fatal; developers (particularly of P2P software) who claim they'd like advance notice that their systems will fail should take note."
/// Don't PANIC ...
/// http://en.wikibooks.org/wiki/User:Panic2k4
|
|
|
|

|
First off thanks for putting this out there, however some thoughts:
You have this licensed as GPL code - this makes it largely unusable for many of us out there, even those of us working on freebie projects.
There seems to be no coherent C++ design to this. It is largely a collection of c style functions. Not neccessarily bad, but it would have been interesting to see a little framework evolve out of this.
An article discussing the various algorithms in a bit more depth would also have been cool.
Anyways cheers
Jim
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
|
|
|
|

|
Jim Crafton wrote:
There seems to be no coherent C++ design to this. It is largely a collection of c style functions. Not neccessarily bad, but it would have been interesting to see a little framework evolve out of this.
just FYI,
check out crypto++: http://www.eskimo.com/~weidai/cryptlib.html[^]
it has tons of hash algorithms, all wrapped in one the most extensive C++ frameworks i've ever seen.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|

|
crypto++ - you know that is exactly what i was thinking of! But I was too lazy to track down the URL.
I have looked at it - really good stuff
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
|
|
|
|

|
all wrapped in one the most extensive C++ frameworks i've ever seen.
No kidding.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|

|
Useful little utility. I clicked on it because I thought it was in C#. Silly me. I'd love to see a framework that did all of these hash styles in C#, with a nice consistent class hierarchy.
It'd be nice to have some explanatory text in the article about the code, and hashing in general.
Best wishes
James
|
|
|
|

|
I just converted the stuff to classes, so it's easy to add an algorithm. I added ED2K hashes (which uses the MD4 class but it does it per 9.something megabytes).
And I'm trying to put XML into it. Text output isn't useful
Anyone interested in making some P2P hash-exchange protocol so (known) files can be hashed in one algorithm and verified against another.
An example: finding a list of filenames for a given CRC32 but unknown file.
Extending with plugins for P2P sharing apps and WINFS... plenty of ideas.
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
A console-based hash calculator. Supported algorithms: CRC-16, CRC-16-CCITT, CRC-32, FCS-16, FCS-32, GHash-32-3, GHash-32-5, GOST-Hash, HAVAL-5-256, MD2, MD4, MD5, SHA-1, SHA-256, SHA-384, SHA-512, Tiger.
| Type | Article |
| Licence | |
| First Posted | 11 Apr 2003 |
| Views | 198,497 |
| Bookmarked | 101 times |
|
|