is there any reason for a program in a loop to run correctly once and then be wrong the rest of the time?
Visit Calccrypto for info on crypto
Recent Threads
is there any reason for a program in a loop to run correctly once and then be wrong the rest of the time?
Visit Calccrypto for info on crypto
Code and language please. ;-) I guess it's possible. The reason is still unknown, though…
"But sanctify the Lord God in your hearts, and always be ready to give a defense to everyone who asks you a reason for the hope that is in you, with meekness and fear;" ~ 1 Peter 3:16
Possibly a file was left unclosed by the program or a specific set of variables/conditions lets it work right.
im writing SHA 1 in python
the basics is this:
# input is 'abc' in ASCII # skey is a 80 entry list generated a bit earlier, and i know i got correct values for them h0 = 0x67452301; h1 = 0xEFCDAB89; h2 = 0x98BADCFE; h3 = 0x10325476; h4 = 0xC3D2E1F0 a = h0; b = h1; c = h2; d = h3; e = h4 for x in range (80): if x <=19: f = (b and c) or ((not b) and d) k = 0x5A827999 ... ... #(other 'if's that the program hasnt even gotten up to before it errors) ... temp = add([shift_left(a,5) , f , e , k , skey[x]]) e = d d = c c = shift_left(b,30) # rotate, not really shift b = a a = temp h0 = add([a,h0]) # add mod 2^32 h1 = add([b,h1]) # these arent really used within the loop; h2 = add([c,h2]) # only their final outputs matter h3 = add([d,h3]) h4 = add([e,h4])
initial data (the 'h' s)= 67452301 efcdab89 98badcfe 10325476 c3d2e1f0
a+b+c+d+e (strings) are supposed to =
a b c d e
0116fc33 67452301 7bf36ae2 98badcfe 10325476, when x = 0
8990536d 0116fc33 59d148c0 7bf36ae2 98badcfe, when x = 1
but i got
0116fc33 67452301 7bf36ae2 98badcfe 10325476, when x = 0
0987bf51 0116fc33 59d148c0 7bf36ae2 98badcfe, when x = 1
Visit Calccrypto for info on crypto
The reason it errors, is that "and", and the rest of them, are not binary operations. They are logic operations. Wow. Haven't done python since lunch. 8-)
Sorry, didn't realize that until now. Sorry for not pointing that out in the other topic.
"But sanctify the Lord God in your hearts, and always be ready to give a defense to everyone who asks you a reason for the hope that is in you, with meekness and fear;" ~ 1 Peter 3:16
well, i did write separate functions called OR, AND, and NOT, but after implementing them, all the outputs were wrong, even though i checked that the new functions worked properly
how many programming languages do you know??? where do you people learn so much???
Visit Calccrypto for info on crypto
okay. wait. i fail. i forgot there were bitwise operators
i got it now
Visit Calccrypto for info on crypto
I learned programming languages for the fun of it. Okay, so I'm a mega geek, but… Here's a list of the programming languages I have programmed before, but don't completely know. Mainly languages, like HTML or javascript, are ones that I haven't programmed in forever.
HTML, Javascript, Java, Some python, C, xml, TI-basic, Little CSS (I still know the syntax, I'm just not very good at it).
There are more, but they aren't coming to me, so they are probably not important. I just like programming. It's a gift that God gave me, and therefore, I will use that gift.
Okay, have fun with python. I mostly program in Java. Although, I want to learn flash.
As for how people know all of these programming languages, I guess it's how our brains work. I can remember all of the methods of Java.math.bigInteger, but couldn't remember a name for my life. Oh well.
"But sanctify the Lord God in your hearts, and always be ready to give a defense to everyone who asks you a reason for the hope that is in you, with meekness and fear;" ~ 1 Peter 3:16
wow……………..
Visit Calccrypto for info on crypto
I have a life, I promise… I just have to find it in the comments in my program…
It's actually about as impressive as if someone comes up to me and tells me a football play. I just don't understand it. Programming is just something I get. It's orderly and structured.
I think it is just as amazing with those encryption algorithms you know.
"But sanctify the Lord God in your hearts, and always be ready to give a defense to everyone who asks you a reason for the hope that is in you, with meekness and fear;" ~ 1 Peter 3:16
i still wish i knew as much as you
Visit Calccrypto for info on crypto