1. scooby74029
    OP

    scooby74029 "fake coder"

    Member
    4
    May 7, 2010
    United States
    oklahoma, USA
    I have a python program i am trying to understand what it does exactly with a date and a certain 8 digit code

    can anyone look at the code and try to explain it, i understand some coding but not alot

    thank you in advance to any that help....

    Code:
    mport time, urlparse
    
    def application(environ, start_response):
        start_response("200 OK", [("Content-type","text/html")])
        yield """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>Wii Parental Control Password Resetter</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <style type="text/css">
    
    .title {
        font-size: 18pt;
        font-family: sans-serif;
    }
    
    .response {
        font-size: 16pt;
        font-family: sans-serif;
    }
    
    .error {
        color: red;
        font-size: 16pt;
        font-family: sans-serif;
    }
    
    
    </style>
    </head>
    <body>
    <div class="title">Wii Parental Control password reset tool</div>"""
    
        uri = environ["REQUEST_URI"]
        qs = urlparse.urlparse(uri).query
        form = urlparse.parse_qs(qs)
    
        ctime = time.time()
    
        def opt_date(delta):
            t = time.gmtime(ctime + delta * 3600 * 24)
            if delta == 0:
                    selected = ' selected="selected"'
            else:
                    selected = ""
            return '<option value="%02d%02d" %s>%s</option>'%(t.tm_mon,t.tm_mday,selected,time.strftime("%a, %d %b %Y",t))
    
        class CRC32:
            def __init__(self):
                    self.gentable()
    
    
            def crc32(self, input, crc=0xffffffffl):
                    count = len(input)
                    i = 0
                    while count != 0:
                            count -= 1
                            temp1 = (crc >> 8) & 0xFFFFFF
                            temp2 = self.table[(crc ^ ord(input[i])) & 0xFF]
                            crc = temp1 ^ temp2
                            i += 1
                    return crc
    
            def gentable(self):
                    self.table = []
                    for i in range(256):
                            crc = i
                            for j in range(8):
                                    if crc & 1:
                                            crc = (crc >> 1) ^ 0xEDB88320l
                                    else:
                                            crc >>= 1
                            self.table.append(crc)
    
        def error(s):
            return '<div class="error">%s</div>'%s
    
        def process():
            try:
                    int(form["number"][0]) #validate
                    if len(form["number"][0]) != 8 or not all([x in "0123456789" for x in form["number"][0]]):
                            raise ValueError()
            except:
                    return error("Please provide a valid 8-digit confirmation number")
    
            try:
                    int(form["date"][0]) #validate
                    if len(form["date"][0]) != 4 or not all([x in "0123456789" for x in form["date"][0]]):
                            raise ValueError()
            except:
                    return error("Invalid date")
    
            fullnum = form["date"][0] + form["number"][0][4:8]
    
            crc = CRC32().crc32(fullnum)
            code = ((crc ^ 0xaaaa) + 0x14c1) % 100000
    
            return '<div class="response">Your unlock code:<span class="code">%05d</span></div>'%code
    
        if form.has_key("submit"):
            yield process()
    
        yield """
    <div class="form">
        <form action="/parental">
            <p>Confirmation Number:
                    <input name="number" type="text" size="9" maxlength="8" value="" /></p>
            <p>Current Date in your timezone:
                    <select name="date" size="1">"""
        yield opt_date(-1)
        yield opt_date(0)
        yield opt_date(1)
        yield """</select><br /></p>
            <p><input name="submit" type="submit" value="Get Reset Code" /></p>
        </form>
    </div>
    <p>
        <a href="http://validator.w3.org/check?uri=referer"><img
            src="http://www.w3.org/Icons/valid-xhtml10-blue"
            alt="Valid XHTML 1.0 Strict" height="31" width="88" /></a>
        <a href="http://jigsaw.w3.org/css-validator/">
        <img style="border:0;width:88px;height:31px"
            src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
            alt="Valid CSS!" />
        </a>
        <br />
        <a href="parental_src.py">Source code</a>
    </p>
          
    </body>
    </html>"""
    
     
  2. Joom

    Joom  ❤❤❤

    Member
    13
    Jan 8, 2016
    United States
    Looks like a web page that generates reset codes for the parental controls on a Wii.
     
    KiiWii likes this.
  3. KiiWii

    KiiWii GBAtemp Guru

    Member
    15
    Nov 17, 2008
    United Kingdom
  4. sarkwalvein

    sarkwalvein There's hope for a Xenosaga port.

    Member
    17
    GBAtemp Patron
    sarkwalvein is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jun 29, 2007
    Germany
    Niedersachsen
    What kind of explanation do you want?
    I hope the following one is ok.

    The calculation part is just this:
    Code:
           fullnum = form["date"][0] + form["number"][0][4:8]
    
           crc = CRC32().crc32(fullnum)
           code = ((crc ^ 0xaaaa) + 0x14c1) % 100000
    
    It takes four digits for the date in format "MMDD" and concatenates it with the last four digits from the confirmation number.
    E.g. for May 1st, with a code 12345678, it generates the following fullnum string "05015678".

    Then it calculates the CRC32 for that fullnum string.
    It does a XOR between the calculated CRC and 0xaaaa.
    It adds to it 0x14C1.
    And then from the resulting decimal number, it extracts only the last 5 digits.

    And that is your reset code.

    PS: Yeah, this implies that for calculating the reset code, the current year does not matter, and neither do the first 4 digits from the confirmation number.
     
    Last edited by sarkwalvein, Sep 24, 2018
    KiiWii likes this.
  5. scooby74029
    OP

    scooby74029 "fake coder"

    Member
    4
    May 7, 2010
    United States
    oklahoma, USA
    thank you for explanation, i had everything correct but the date code then, i am porting this to a PC program to bundle in an already great wii hacking tool

    again thanks
     
  6. scooby74029
    OP

    scooby74029 "fake coder"

    Member
    4
    May 7, 2010
    United States
    oklahoma, USA
    so this is my story here i taught myself to read and write code by looking at and making old programs people have already made
    if i gave you some code could you help me with what i am trying to do??
    i am not finding a .h file fro the code in devkitpro includes maybe you can help there thanks.
     
  7. sarkwalvein

    sarkwalvein There's hope for a Xenosaga port.

    Member
    17
    GBAtemp Patron
    sarkwalvein is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jun 29, 2007
    Germany
    Niedersachsen
    Hmmm... I could help you with snippets of C code, I think.
    Though I have no real experience with devkitpro, nor a computer at hand to try the code in.
    But if you have some piece of code, and you want someone to check/take a look at it, then sure.
     
  8. scooby74029
    OP

    scooby74029 "fake coder"

    Member
    4
    May 7, 2010
    United States
    oklahoma, USA
    ok cool i dont understand the table part of the whole thing here is what i have but i am about to go to work so ill checkback later today after i am off
    oh and this is my whole program also
    Code:
    ;AHK
    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    ; #Warn  ; Enable warnings to assist with detecting common errors.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
    
    crc := 0xffffffffl
    
    gui, font, bold black s22
    Gui, Add, Text, x62 y70 w480 h50 +Center, Wii   Parental   Control   Unlocker
    gui, add, text, x62 y110 w480 h20 +center,-------------------------------------------
    gui, font
    gui, font, bold black s10
    Gui, Add, Text, x62 y150 w480 h50 , How To Use : Go To Wii Settings, Parental controls, When Prompted To Enter Pin, Click "I Forgot", Then On Question Screen, Click "I Forgot" Again, Get 8 Digit Code . Type Today's Date .
    Gui, Add, Button, x32 y360 w160 h30 gUnlock, Unlock
    Gui, Add, Button, x410 y360 w160 h30 gExit, Exit
    Gui, Add, GroupBox, x32 y30 w535 h320 ,
    gui, font
    gui, font, bold black s12
    Gui, Add, Edit, x372 y230 w160 h30 vCode,
    Gui, Add, Text, x52 y230 w180 h30 +Center, Enter 8 Digit Code :
    Gui, Add, Edit, x372 y285 w160 h30 vDate,
    Gui, Add, Text, x52 y285 w180 h30 +Center, Enter Today's Date :
    gui, font
     
    Gui, Show, x396 y137 h400 w601, WiiParentUnlock v_1.0
    
    Return
    
    
    
    unlock:
    
        msgbox,,,starting unlock !,5
        gui, submit, nohide
        codelen := strlen(Code)
        datelen := strlen(Date)
        if(codelen < 8) || (codelen > 8) {
            msgbox, 0x40000, WiiParentUnlock, Code Must Be 8 Digits Long`nNo More, No Less .
            return
        }
        if(datelen < 6) || (datelen > 8) {
            msgbox, 0x40000, WiiParentUnlock, Date Must Be In Format (mmddyyyy)`nEX. 09232018`nNo More than 8, No Less Than 6 Digits .
            return
        }
        msgbox,,, Code [%codelen%] Date [%datelen%],5
        
        fullnum := Code + Date
        msgbox,,, fullnum[%fullnum%],3
        init()
        test := crc32(fullnum, crc)
        
        listvars
    return
    
    init() {
         gentable()
    }
    
    crc32(input, crc) {
    
        count := strlen(input)
        msgbox,,,count(%count%)
         i = 0
         while (count != 0) {
            count--
              temp1 :=  (%crc% >> 8) & 0xFFFFFF
            msgbox,,,temp1[%temp1%]
              ;temp2 = self.table[(crc ^ ord(input[i])) & 0xFF]
              ;crc = temp1 ^ temp2
              i++
            msgbox,,,count(%count%) i(%i%),3
        }
    
        return crc
    }
    gentable() {
         table = []
         ; for i in range(256):
         crc = i
         ; for j in range(8):
         if (crc & 1) {
            crc = (crc >> 1) ^ 0xEDB88320l
        }
        else {
              crc >>= 1
         ;     table.append(crc)
        }
    }
    Exit:
    GuiClose:
    ExitApp
    
    
    
    again thanks for help i know that at the range parts i need to do loops for i and j but not sure of the range keyword there again ty
     
  9. scooby74029
    OP

    scooby74029 "fake coder"

    Member
    4
    May 7, 2010
    United States
    oklahoma, USA
    so i added what i know and what i dont on this please take a look and let me know if you can help me out ty
    Code:
    
    init() {
         gentable()
    }
    
    crc32(input, crc) {
    
        count := strlen(input)
        msgbox,,,count(%count%)
         i = 0
         while (count != 0) {
            count--
              temp1 :=  (%crc% >> 8) & 0xFFFFFF
            msgbox,,,temp1[%temp1%]
              ;temp2 = table[(crc ^ ord(input[i])) & 0xFF]   ;------ here unsure of the ordinput line ----------
              ;crc = temp1 ^ temp2
              i++
            msgbox,,,count(%count%) i(%i%),3
        }
    
        return crc
    }
    gentable() {
         table = []
         for(i = 0; i < 256; i++){
            crc = i
            for(j = 0; j < 8, j++){
                if (crc & 1) {
                    crc = (crc >> 1) ^ 0xEDB88320l
                }
                else {
                    crc >>= 1
                ;     table.append(crc)  ;-------unknown here what to do or whatthis does------------
                }
            }
        }
    }
    Exit:
    GuiClose:
    ExitApp
    
    
    
     
  10. sarkwalvein

    sarkwalvein There's hope for a Xenosaga port.

    Member
    17
    GBAtemp Patron
    sarkwalvein is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jun 29, 2007
    Germany
    Niedersachsen
    That's definitively not C.
    I guess it is some kind of scripting language.
    I understand what the original code is doing, but I am not sure how to do this in that scripting language, because I don't know its functionality.
    I am not sure I can help you with that, but give me a moment to at least read about that language.
     
  11. sarkwalvein

    sarkwalvein There's hope for a Xenosaga port.

    Member
    17
    GBAtemp Patron
    sarkwalvein is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jun 29, 2007
    Germany
    Niedersachsen
    Well, better if I ask you about the language.

    Does it support random addressing of strings? Like addressing an array?
    E.g. if you have a string a := "abcde"... can you do something like a[2] to get back the character "c"?
    NOTE: you are doing it in the input[i] part of the commented line below.

    Does it treat characters as one byte integers like the C programming language?
    E.g. are 'c' and 99 the same thing? can you do 'c'+3 to get 102?
    (the ascii for c is 99)
    NOTE: you require some kind of feature to get the ascii code from the character in the commented line below.

    I will explain what you need in the two lines you marked, and you let me know how to do that in that scripting language.
    If you don't know, well, I could read more about the language and come back.

    First, in here:
    Code:
    crc32(input, crc) {
    
       count := strlen(input)
       msgbox,,,count(%count%)
        i = 0
        while (count != 0) {
           count--
             temp1 :=  (%crc% >> 8) & 0xFFFFFF
           msgbox,,,temp1[%temp1%]
             ;temp2 = table[(crc ^ ord(input[i])) & 0xFF]   ;------ here unsure of the ordinput line ----------
             ;crc = temp1 ^ temp2
             i++
           msgbox,,,count(%count%) i(%i%),3
       }
    
       return crc
    }
    
    In that line you commented the 'ord' keyword returns the ASCII number for the given character, so e.g. for 'c' it returns 99.
    It is needed in Python, but not in C. In C 'c' already is the same as 99, so ord is omitted.

    Then, in here a little more complex:
    Code:
    gentable() {
        table = []
        for(i = 0; i < 256; i++){
           crc = i
           for(j = 0; j < 8, j++){
               if (crc & 1) {
                   crc = (crc >> 1) ^ 0xEDB88320l
               }
               else {
                   crc >>= 1
               ;     table.append(crc)  ;-------unknown here what to do or whatthis does------------
               }
           }
       }
    }
    
    Here table is a member attribute of the class in Python.
    But you are not creating a class in here (perhaps the AutoHotKey language does not support it, I don't know).
    Because of this, you need to create table as some kind of persistent (e.g. global or static) variable type.
    (try to make it global in your code, I don't know how to do it in autohotkey)

    Also, in Python this variable is a list.
    The little I read about AutoHotKey, I saw that the Array type is pretty much the same.

    So you would create the global variable like this, I guess before all the functions:
    Code:
    table := []
    
    And then you will introduce data like this, in the line you commented in the gentable function:
    Code:
    table.push(crc)
    
     
    Last edited by sarkwalvein, Sep 24, 2018
    scooby74029 likes this.
  12. scooby74029
    OP

    scooby74029 "fake coder"

    Member
    4
    May 7, 2010
    United States
    oklahoma, USA
    yes it supports all c code as i understand it. ill do some more work on it after i get home from work ty i think i understand now
    i need to make table an object in this language and then go from there. ill send what i think it should be and have u look at it thankx again

    this is awesome i might ask about another program i am building for wii hacking if u dont mind???
     
  13. sarkwalvein

    sarkwalvein There's hope for a Xenosaga port.

    Member
    17
    GBAtemp Patron
    sarkwalvein is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jun 29, 2007
    Germany
    Niedersachsen
    That's fine, as long as I have some free time I would take a look at it.
     
  14. scooby74029
    OP

    scooby74029 "fake coder"

    Member
    4
    May 7, 2010
    United States
    oklahoma, USA
    ok take a look at this i gotta go back to work

    Code:
    ;AHK
    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    ; #Warn  ; Enable warnings to assist with detecting common errors.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
    
    crc := 0xffffffffl
    Table := []
    
    gui, font, bold black s22
    Gui, Add, Text, x62 y70 w480 h50 +Center, Wii   Parental   Control   Unlocker
    gui, add, text, x62 y110 w480 h20 +center,-------------------------------------------
    gui, font
    gui, font, bold black s10
    Gui, Add, Text, x62 y150 w480 h50 , How To Use : Go To Wii Settings, Parental controls, When Prompted To Enter Pin, Click "I Forgot", Then On Question Screen, Click "I Forgot" Again, Get 8 Digit Code . Type Today's Date .
    Gui, Add, Button, x32 y360 w160 h30 gUnlock, Unlock
    Gui, Add, Button, x410 y360 w160 h30 gExit, Exit
    Gui, Add, GroupBox, x32 y30 w535 h320 ,
    gui, font
    gui, font, bold black s12
    Gui, Add, Edit, x372 y230 w160 h30 vCode,
    Gui, Add, Text, x52 y230 w180 h30 +Center, Enter 8 Digit Code :
    Gui, Add, Edit, x372 y285 w160 h30 vDate,
    Gui, Add, Text, x52 y285 w180 h30 +Center, Enter Today's Date :
    gui, font
     
    Gui, Show, x396 y137 h400 w601, WiiParentUnlock v_1.0
    
    Return
    
    
    
    unlock:
    
        msgbox,,,starting unlock !,5
        gui, submit, nohide
        
        codelen := strlen(Code)
        datelen := strlen(Date)
        newcode := substr(Code, 5, 4)
        newdate := substr(Date, 1, 4)
        msgbox,,, newcode[%newcode%] newdate[%newdate%]
        fullnum :=         ;  ----- need to get newcode and newdate together here then i think i may have it except for the way looping is in the program
        if(codelen < 8) || (codelen > 8) {
            msgbox, 0x40000, WiiParentUnlock, Code Must Be 8 Digits Long`nNo More, No Less .
            return
        }
        if(datelen < 6) || (datelen > 8) {
            msgbox, 0x40000, WiiParentUnlock, Date Must Be In Format (mmddyyyy)`nEX. 09232018`nNo More than 8, No Less Than 6 Digits .
            return
        }
        msgbox,,, Code [%codelen%] Date [%datelen%],5
        
        ;fullnum := Code + Date
        ;msgbox,,, fullnum[%fullnum%],3
        init()
        ;test := crc32(fullnum, crc)
        
        listvars
    return
    
    init()
    {
         gentable()
    }
    
    crc32(input, crc)
    {
    
        count := strlen(input)
        msgbox,,,count(%count%)
         i = 0
         while (count != 0) {
            count--
              temp1 :=  (%crc% >> 8) & 0xFFFFFF
            msgbox,,,temp1[%temp1%]
              temp2 = table[(crc ^ input[i]) & 0xFF]   ;------ here unsure of the ordinput line ----------
              crc = temp1 ^ temp2
              i++
            msgbox,,,count(%count%) i(%i%),3
        }
    
        return crc
    }
    gentable()
    {
    
        i = 0;
         loop, 256
        {
            crc = i
            j = 0
            loop, 8
            {
                if (crc & 1) {
                    crc = (crc >> 1) ^ 0xEDB88320l
                }
                else {
                    crc >>= 1
                     Table.append(crc)  ;-------unknown here what to do or whatthis does------------
                }
            }
            i++
        }
    }
    Exit:
    GuiClose:
    ExitApp
    
    
    
     
  15. sarkwalvein

    sarkwalvein There's hope for a Xenosaga port.

    Member
    17
    GBAtemp Patron
    sarkwalvein is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jun 29, 2007
    Germany
    Niedersachsen
    Looks OK from my point of view, thinking of it like C.
    Anyway, I have one remark and one question.

    First:
    Check in the line "temp2 = table[(crc ^ input) & 0xFF] ;------ here unsure of the ordinput line ----------"
    Either use the variable name "Table" (first capital) or "table", it must be the same as the global variable.

    Second:
    Why sometimes you write "%crc%" and some other times you write just "crc"? I don't know this scripting language, so I don't know what the % around a variable name means.
     
  16. scooby74029
    OP

    scooby74029 "fake coder"

    Member
    4
    May 7, 2010
    United States
    oklahoma, USA
    it is the language when first init var needs example := 66
    to get the 66 need %example% of its just word example

    in the script there are no int or char or strings all var can be anything just the way code is wrote so like in c u have to do int x in script x can be char int what ever u need
    i like it it is easy to use

    — Posts automatically merged - Please don't double post! —

    in the python code what does the range keyword do ???

    it is working but not correctly not giving right code at end of it
     
  17. sarkwalvein

    sarkwalvein There's hope for a Xenosaga port.

    Member
    17
    GBAtemp Patron
    sarkwalvein is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jun 29, 2007
    Germany
    Niedersachsen
    In Python you always use for to iterate along a list of elements.
    Range generates a list of elements, for example range(15) generates (0, 1, 2, 3,... 14) IIRC.
    So doing something like:

    for i in range(15)

    is more or less the same as (in C):

    for (i=0; i<15; i++)
     
  18. sarkwalvein

    sarkwalvein There's hope for a Xenosaga port.

    Member
    17
    GBAtemp Patron
    sarkwalvein is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jun 29, 2007
    Germany
    Niedersachsen
    I've been checking the language, and either it misses a lot of C functionality/characteristics (like addressing a string like an array, and having characters act the same as one byte integers) or I just don't understand the language.

    I will try to hack around it anyway.

    PS: but also, this is not a nice language.

    PS2:
    After looking more into it:
    1. It does not support accessing string elements like an array, that is using [i], instead you have to use the SubStr funtion
    2. It does not treat characters like integers like C, instead you have to use a function like the python ord function, but in here it is called Asc

    I will work my way around it, and do a hackjob with the code you posted before to get you a working version.
     
    Last edited by sarkwalvein, Sep 25, 2018
  19. sarkwalvein

    sarkwalvein There's hope for a Xenosaga port.

    Member
    17
    GBAtemp Patron
    sarkwalvein is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jun 29, 2007
    Germany
    Niedersachsen
    Code:
    ;AHK
    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    ; #Warn  ; Enable warnings to assist with detecting common errors.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
    Table := []
    gui, font, bold black s22
    Gui, Add, Text, x62 y70 w480 h50 +Center, Wii   Parental   Control   Unlocker
    gui, add, text, x62 y110 w480 h20 +center,-------------------------------------------
    gui, font
    gui, font, bold black s10
    Gui, Add, Text, x62 y150 w480 h50 , How To Use : Go To Wii Settings, Parental controls, When Prompted To Enter Pin, Click "I Forgot", Then On Question Screen, Click "I Forgot" Again, Get 8 Digit Code . Type Today's Date .
    Gui, Add, Button, x32 y360 w160 h30 gUnlock, Unlock
    Gui, Add, Button, x410 y360 w160 h30 gExit, Exit
    Gui, Add, GroupBox, x32 y30 w535 h320 ,
    gui, font
    gui, font, bold black s12
    Gui, Add, Edit, x372 y230 w160 h30 vCode,
    Gui, Add, Text, x52 y230 w180 h30 +Center, Enter 8 Digit Code :
    Gui, Add, Edit, x372 y285 w160 h30 vDate,
    Gui, Add, Text, x52 y285 w180 h30 +Center, Enter Today's Date :
    gui, font
    Gui, Show, x396 y137 h400 w601, WiiParentUnlock v_1.0
    Return
    unlock:
        gui, submit, nohide
      
        codelen := strlen(Code)
        datelen := strlen(Date)
        newcode := substr(Code, 5, 4)
        newdate := substr(Date, 1, 4)
        fullnum := newdate . newcode
        if(codelen < 8) || (codelen > 8) {
            msgbox, 0x40000, WiiParentUnlock, Code Must Be 8 Digits Long`nNo More, No Less .
            return
        }
        if(datelen < 6) || (datelen > 8) {
            msgbox, 0x40000, WiiParentUnlock, Date Must Be In Format (mmddyyyy)`nEX. 09232018`nNo More than 8, No Less Than 6 Digits .`n
            return
        }
      
        init()
        crc := crc32(fullnum)
        code := mod(((crc ^ 0xaaaa) + 0x14c1), 100000)
      
        msgbox % format("Unlock Code: {:05}", code)
    return
    init()
    {
         gentable()
    }
    crc32(input)
    {
        global Table
        crc := 0xffffffff
        count := strlen(input)
        i = 0
        while (count != 0) {
            count--
            temp1 :=  (crc >> 8) & 0xFFFFFF
            temp2 := Table[((crc ^ Asc(SubStr(input,i+1,1))) & 0xFF) + 1]
            crc := (temp1 ^ temp2)
            i++
        }
        return crc
    }
    gentable()
    {
        global Table
        i := 0
      
        loop, 256
        {
            crc := i
            loop, 8
            {
                if (crc & 1) {
                    crc := (crc >> 1) ^ 0xEDB88320
                }
                else {
                    crc >>= 1
                }
            }
            Table.Push(crc)
            i++
        }
    }
    Exit:
    GuiClose:
    ExitApp
    
    It works, it doesn't look nice... it just works.
     
    Last edited by sarkwalvein, Sep 25, 2018
    scooby74029 likes this.
  20. scooby74029
    OP

    scooby74029 "fake coder"

    Member
    4
    May 7, 2010
    United States
    oklahoma, USA
    Code:
    https://autohotkey.com/board/topic/4659-crc-32/
    
    
    
    wow thats awesome i found a crc32 function yesterday
    but now i dont need it , i was going to show you this page
    https://autohotkey.com/board/topic/4659-crc-32/
    thanks now i can see what u did to make it work looks like only added or changed just a few things from the original
     
    sarkwalvein likes this.
Loading...