Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

IBM MOD 11 Algorithm

Name: Anonymous 2012-10-04 0:16

Post a clever/fast/short implementation of this algorithm

http://en.wikipedia.org/wiki/MSI_Barcode#Mod_11_Check_Digit (IBM version)

¡In any programming language you want!

Skill level: 1 of 10

INB4: Check my Anus

Name: Cudder !MhMRSATORI!fR8duoqGZdD/iE5 2012-10-04 3:45


    ; in: si pointing to reversed digit string
    ;     cx length of digit string
    ; out: al = check digit
    xor ax, ax
calcloop:
    lodsb
    xchg al, ah
aadpos equ $+1
    aad 2
    inc byte [aadpos]
    cmp byte [aadpos], 7
    jbe noreset
    mov byte [aadpos], 2
noreset:
    xchg al, ah
    loop calcloop
    mov al, ah
    aam 11
    neg al
    add al, 11
    aam 11

37 bytes. Anyone want to go for shorter?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List