|
yes, but you did have BASIC, and from that the magical world of visual basic
|
|
|
|
|
Not in '63 I didn't!
I probably had crayons and difficulty in writing my ABC's...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
But this thing was actually programmable!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
++?????++ Out of Cheese Error. Redo From Start.
Error at Address Number 6, Treacle Mine Road.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Twatter
... such stuff as dreams are made on
|
|
|
|
|
Of course.
|
|
|
|
|
As a mathematician, I prefer the Curta calculator. I bought a Type II model.
|
|
|
|
|
|
Hello
In my project I need a checksum algorithm that never produce zero.
I am wondering if there is one!
SignatureNotFoundException
|
|
|
|
|
None that I know of: zero is normally a valid result in all systems.
About the best I can think of is that you add data to the checksum: maybe convert it to hex digits, so a zero checksum would produce "00" instead of '\0'
Why on earth do you think you need this?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: Why on earth do you think you need this?
I'm guessing the thinking is if the checksum byte/word... is zero then it's not a checksum - OIOW a lazy way to check for the presense of a checksum (albeit not the correctness).
Signature ready for installation. Please Reboot now.
|
|
|
|
|
I'm guessing that he's trying to use strings instead of byte arrays, and doesn;t want a zero as a null terminator - in which case he has some much bigger problems coming ...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
There are checksums that can result in 0 but not in 65535 (or 232-1, if you need it that big). Add 1.
|
|
|
|
|
Or string concat (prefix) a 1 or any other number to the left of the generated checksum. (would potentially need a bigger db column type)
|
|
|
|
|
Follow up question. Is there one that doesn’t produce a result of “10”?
I'm pretty sure I would not like to live in a world in which I would never be offended.
I am absolutely certain I don't want to live in a world in which you would never be offended.
Freedom doesn't mean the absence of things you don't like.
Dave
|
|
|
|
|
+5 for the best and most simple solution.
Jeremy Falcon
|
|
|
|
|
I can already see tomorrows question in the lounge:
"Is there any checksum algorithm that does not produce 65535?"
|
|
|
|
|
Plz send codez. I need a checksum algorithm that always produces 42!
... such stuff as dreams are made on
|
|
|
|
|
uint Hash(byte[] data)
{
uint result = 0;
if (data == null)
return result;
uint MAX = uint.Max - 1;
for (int i=0; i<data.Length; i++)
result = 1 + ((result << 8 + result >> 24) | data[i]) % MAX;
return 42;
}
|
|
|
|
|
The modulus algo I've experienced return X if the remainder is 0
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
uint Hash(byte[] data)
{
uint result = 0;
if (data == null)
return result;
uint MAX = uint.Max - 1;
for (int i=0; i<data.Length; i++)
result = 1 + ((result << 8 + result >> 24) | data[i]) % MAX;
return result;
}
|
|
|
|
|
This is the type of cryptography thinking that allowed us to break the Enigma code
|
|
|
|
|
int CalculateChecksum() {
return 1;
}
|
|
|
|