diff options
Diffstat (limited to '')
-rw-r--r-- | b32d.asm | 44 |
1 files changed, 42 insertions, 2 deletions
@@ -33,13 +33,53 @@ write_output: ret ; b32d -; decodes 8 RFC4648 characters without checking its validity (!!!) -; uses reg: +; decodes 8 RFC4648 characters (without checking its validity!) +; uses reg: rax, rbx ; uses mem: input_buffer, output_buffer b32d: + ; reset rax (output) + xor rax, rax + ; set downwards counter + mov bl, 8 + +.loop: + ; get a character + mov bh, byte [output_buffer] + ; if is padding, exit + cmp bh, 0x3d + je .exit + + ; shift rax of one byte + shl rax, 5 + ; insert the new 5 bits + or al, bh + + ; decrement counter + dec bl + jnz .loop + +.exit: + ; save output + mov [input_buffer], rax ret + _start: + nop + +.loop: + ; read input + call read_input + ; read nothing + cmp rax, 0 + je .exit + + ; decode base32 + call b32d + ; print + call write_output + jmp .loop + .exit: ; linux x64 exit(0) mov rax, 60 |