all correct→ wrong
Started by: bxsciencerbxsciencer
On: 1257286385|%e %b %Y, %H:%M %Z|agohover
Number of posts: 11
rss icon RSS: New posts
all correct→ wrong
bxsciencerbxsciencer 1257286385|%e %b %Y, %H:%M %Z|agohover

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

unfold all correct→ wrong by bxsciencerbxsciencer, 1257286385|%e %b %Y, %H:%M %Z|agohover
Re: all correct→ wrong
graphmasturgraphmastur 1257291773|%e %b %Y, %H:%M %Z|agohover

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

unfold Re: all correct→ wrong by graphmasturgraphmastur, 1257291773|%e %b %Y, %H:%M %Z|agohover
Re: all correct→ wrong
_Abe__Abe_ 1257292530|%e %b %Y, %H:%M %Z|agohover

Possibly a file was left unclosed by the program or a specific set of variables/conditions lets it work right.

unfold Re: all correct→ wrong by _Abe__Abe_, 1257292530|%e %b %Y, %H:%M %Z|agohover
Re: all correct→ wrong
bxsciencerbxsciencer 1257297629|%e %b %Y, %H:%M %Z|agohover

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

last edited on 1257297798|%e %b %Y, %H:%M %Z|agohover by bxsciencer + show more
unfold Re: all correct→ wrong by bxsciencerbxsciencer, 1257297629|%e %b %Y, %H:%M %Z|agohover
Re: all correct→ wrong
graphmasturgraphmastur 1257298310|%e %b %Y, %H:%M %Z|agohover

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

unfold Re: all correct→ wrong by graphmasturgraphmastur, 1257298310|%e %b %Y, %H:%M %Z|agohover
Re: all correct→ wrong
bxsciencerbxsciencer 1257299915|%e %b %Y, %H:%M %Z|agohover

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

last edited on 1257299999|%e %b %Y, %H:%M %Z|agohover by bxsciencer + show more
unfold Re: all correct→ wrong by bxsciencerbxsciencer, 1257299915|%e %b %Y, %H:%M %Z|agohover
Re: all correct→ wrong
bxsciencerbxsciencer 1257300123|%e %b %Y, %H:%M %Z|agohover

okay. wait. i fail. i forgot there were bitwise operators

i got it now


Visit Calccrypto for info on crypto

last edited on 1257301047|%e %b %Y, %H:%M %Z|agohover by bxsciencer + show more
unfold Re: all correct→ wrong by bxsciencerbxsciencer, 1257300123|%e %b %Y, %H:%M %Z|agohover
Re: all correct→ wrong
graphmasturgraphmastur 1257300566|%e %b %Y, %H:%M %Z|agohover

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

unfold Re: all correct→ wrong by graphmasturgraphmastur, 1257300566|%e %b %Y, %H:%M %Z|agohover
Re: all correct→ wrong
bxsciencerbxsciencer 1257301149|%e %b %Y, %H:%M %Z|agohover

wow……………..


Visit Calccrypto for info on crypto

unfold Re: all correct→ wrong by bxsciencerbxsciencer, 1257301149|%e %b %Y, %H:%M %Z|agohover
Re: all correct→ wrong
graphmasturgraphmastur 1257301780|%e %b %Y, %H:%M %Z|agohover

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

unfold Re: all correct→ wrong by graphmasturgraphmastur, 1257301780|%e %b %Y, %H:%M %Z|agohover
Re: all correct→ wrong
bxsciencerbxsciencer 1257304036|%e %b %Y, %H:%M %Z|agohover

i still wish i knew as much as you


Visit Calccrypto for info on crypto

unfold Re: all correct→ wrong by bxsciencerbxsciencer, 1257304036|%e %b %Y, %H:%M %Z|agohover
New post