summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--b32e.asm7
1 files changed, 5 insertions, 2 deletions
diff --git a/b32e.asm b/b32e.asm
index 04ce671..ada7ff0 100644
--- a/b32e.asm
+++ b/b32e.asm
@@ -4,7 +4,7 @@ rfc4648 db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
section .bss
-input_buffer resb 5
+input_buffer resb 8
output_buffer resb 8
section .text
@@ -43,9 +43,12 @@ b32e:
; get 5 bits from the input
xor rbx, rbx
mov bl, byte [input_buffer]
- and bl, 0x1f
+ ; mask and shift to convert to a number 0 ~ 32
+ and bl, 0xf8
+ shr bl, 3
; rshift the input buffer
+ shl qword [input_buffer], 5
; convert to base32
add rbx, rfc4648