|
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;
}
|
|
|
|
|
xkcd: Random Number[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello, and I apologise if this question has been asked a billion times already. I just remembered I used to code for a living, and was idly wondering if that huge ...um... "mistake" has been fixed yet.
You know the one, where everyone has now moved on to fast but small SSD's and MS wants to dump about 50Gb of stuff on your C: drive, no options, so suck it up.
I actually quit programming because of that and now wear steel-cap boots and a hi-viz vest to make ends meet.
But I want to return to the stuff I love the most - coding.
Yup, I could choose another platform and IDE, but I don't want to.
Is there any hope?
|
|
|
|
|
Well, SSDs have grown in size and a 500 GB is within reach for most folks. The drive space that VS 2017 requires varies, depending on which features you install. I installed it for C# + WPF as well as UWP apps. It took about 8GB of my 500 GB Samsung SSD - virtually negligible.
I can highly recommend going for an SSD, as it just runs so much faster. I would not bother with any IDE other than Visual Studio 2017. And keep in mind the fully functional Community Edition is completely free.
Get me coffee and no one gets hurt!
|
|
|
|