summaryrefslogtreecommitdiff
path: root/assembly/passworddoor/sha256sum.S
diff options
context:
space:
mode:
authorcheapie <cheapiephp@gmail.com>2026-11-14 06:02:56 -0600
committercheapie <cheapiephp@gmail.com>2026-11-14 06:02:56 -0600
commitf212e8e0d9f86148ba216bcc19639b77fbb18c4c (patch)
tree29c7d0196ae2da51779427ee31895a88d6184169 /assembly/passworddoor/sha256sum.S
parent496876fd0c35c72277c08d20bbc1f72510e3e0e6 (diff)
downloadrvcontroller-f212e8e0d9f86148ba216bcc19639b77fbb18c4c.tar
rvcontroller-f212e8e0d9f86148ba216bcc19639b77fbb18c4c.tar.gz
rvcontroller-f212e8e0d9f86148ba216bcc19639b77fbb18c4c.tar.bz2
rvcontroller-f212e8e0d9f86148ba216bcc19639b77fbb18c4c.tar.xz
rvcontroller-f212e8e0d9f86148ba216bcc19639b77fbb18c4c.zip
Optimize passworddoor a bit and add a progress indicator
Diffstat (limited to 'assembly/passworddoor/sha256sum.S')
-rw-r--r--assembly/passworddoor/sha256sum.S47
1 files changed, 27 insertions, 20 deletions
diff --git a/assembly/passworddoor/sha256sum.S b/assembly/passworddoor/sha256sum.S
index 2f60b69..ecfd36f 100644
--- a/assembly/passworddoor/sha256sum.S
+++ b/assembly/passworddoor/sha256sum.S
@@ -49,35 +49,32 @@ addi t1,t1,8
addi s0,s0,2
blt s0,t2,1b
+li a0,'#'
+li a7,11
+ecall
+
# Wikipedia calls this "Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array"
-1: la t0,w
-sh2add t0,s0,t0
-addi t0,t0,-60 # i-15
-la t1,w
-sh2add t1,s0,t1
-addi t1,t1,-8 # i-2
-la t2,w
-sh2add t2,s0,t2
-addi t2,t2,-64 # i-16
-la t3,w
-sh2add t3,s0,t3
-addi t3,t3,-28 # i-7
-lw t0,0(t0)
-lw t1,0(t1)
-lw t2,0(t2)
-lw t3,0(t3)
+1: la t4,w
+sh2add t4,s0,t4
+lw t0,-60(t4) # i-15
+lw t1,-8(t4) # i-2
+lw t2,-64(t4) # i-16
+lw t3,-28(t4) # i-7
sha256sig0 t0,t0
sha256sig1 t1,t1
add t0,t0,t1
add t0,t0,t2
add t0,t0,t3
-la t1,w
-sh2add t1,s0,t1
-sw t0,0(t1)
+sw t0,0(t4)
addi s0,s0,1
li t0,64
blt s0,t0,1b
+li a0,'#'
+li a7,11
+ecall
+ecall
+
# Load initial working values
la t0,h
lw a0,0(t0)
@@ -133,7 +130,17 @@ mv a2,a1 # c = b
mv a1,a0 # b = a
add a0,t0,t1 # a = temp1 + temp2
-addi s0,s0,1
+andi t0,s0,3
+bnez t0,2f
+mv t0,a0
+mv t1,a7
+li a0,'#'
+li a7,11
+ecall
+mv a0,t0
+mv a7,t1
+
+2: addi s0,s0,1
li t0,64
blt s0,t0,1b