Hidden Text & lt; code class = & quot; dos & quot; & gt; job bitcoin * SHA-256 hash * Ken Shirriff http://righto.com ctl 6641 org 087 X1 dcw @ 000 @ org 092 X2 dcw @ 000 @ org 097 X3 dcw @ 000 @ org 333 start cs 299 r sw 001 lca 064, input0 mcw 064, 264 w * Initialize word marks on storage mcw + s0, x3 wmloop sw 0 & amp; x3 ma @ 032 @ , x3 c + h7 + 32, x3 bu wmloop mcw + input-127, x3 * Put input into warr [0] to warr [15] mcw + warr, x1 mcw @ 128 @, tobinc b tobin * Compute message schedule array w [0..63] mcw @ 16 @, i * i is word index 16-63 * x1 is start of warr [i-16], ie bit 0 (bit 0 on left, bit 31 on right) mcw + warr, x1 wloop c @ 64 @, i be wloopd * Compute s0 mcw + s0, x2 za +0, 31 & amp; x2 * Zero s0 * Add w [i -15] rightrotate 7 sw 7 & amp; x2 * Wordmark at bit 7 (from left) of s0 a 56 & amp; x1, 31 & amp; x2 * Right shifted: 32 + 31-7 = bit 24 of w [i-15], 31 = end of s0 a 63 & amp; x1, 6 & amp; x2 * Wrapped: 32 + 31 = end of w [i-15], 7-1 = bit 6 of s0 cw 7 & amp; x2 * Clear wordmark * Add w [i-15] rightrotate 18 sw 18 & amp; x2 * Wordmark at bit 18 (from left) of s0 a 45 & amp; x1, 31 & amp; x2 * Right shifted: 32 + 31-18 = bit 13 of w [i-15], 31 = end of s0 a 63 & amp; x1, 17 & amp; x2 * Wrapped: 32 + 31 = end of w [i-15], 18-1 = bit 17 of s0 cw 18 & amp; x2 * Clear wordmark * Add w [i-15] rightshift 3 sw 3 & amp; x2 * Wordmark at bit 3 (from left) of s0 a 60 & amp; x1, 31 & amp; x2 * Right shifted: 32 + 31-3 = bit 28 of w [i-15], 31 = end of s0 cw 3 & amp; x2 * Clear wordmark * Convert sum to xor mcw x1, x1tmp mcw + s0 + 31, x1 * x1 = right end of s0 mcw @ 032 @, x2 * Process 32 bits b xor sw s0 * Restore wordmark cleared by xor mcw x1tmp, x1 * Compute s1 mcw + s1, x2 za +0, 31 & amp; x2 * Zero s1 * Add w [i-2] rightrotate 17 sw 17 & amp; x2 * Wordmark at bit 17 (from left) of s1 a 462 & amp; x1, 31 & amp ; x2 * Right shifted: 14 * 32 + 31-17 = bit 14 of w [i-2], 31 = end of s1 a 479 & amp; x1, 16 & amp; x2 * Wrapped: 14 * 32 + 31 = end of w [ i-2], 17-1 = bit 16 of s1 cw 17 & amp; x2 * Clear wordmark * Add w [i-2] rightrotate 19 sw 19 & amp; x2 * Wordmark at bit 19 (from left) of s1 a 460 & amp; x1, 31 & amp; x2 * Right shifted: 14 * 32 + 31-19 = bit 12 of w [i-2], 31 = end of s1 a 479 & amp; x1, 18 & amp; x2 * Wrapped: 14 * 32 + 31 = end of w [i-2], 19-1 = bit 18 of s1 cw 19 & amp; x2 * Clear wordmark * Add w [i-2] rightshift 10 sw 10 & amp; x2 * Wordmark at bit 10 (from left) of s1 a 469 & amp; x1 31 & amp; x2 * Right shifted: 14 * 32 + 31-10 = bit 21 of w [i-2], 31 = end of s1 cw 10 & amp; x2 * Clear wordmark * Convert sum to xor mcw + s1 + 31, x1 * x1 = right end of s1 mcw @ 032 @, x2 * Process 32 bits b xor sw s1 * Restore wordmark cleared by xor * Compute w [i]: = w [i-16] + s0 + w [i-7] + s1 mcw x1tmp, x1 a s1 + 31, s0 + 31 * Add s1 to s0 a 31 & amp; x1, s0 + 31 * Add w [i-16] to s0 a 319 & amp; x1, s0 + 31 * Add 9 * 32 +31 = w [i-7] to s0 * Convert bit sum to a 32-bit sum mcw + s0 + 31, x1 * x1 = right end of s0 mcw @ 032 @, x2 * Process 32 bits b sum sw s0 * Restore wordmark cleared by sum mcw x1tmp, x1 mcw s0 + 31, 543 & amp; x1 * Move s0 to w [i] ma @ 032 @, x1 a +1, i mz @ 0 @, ib wloop x1tmp dcw # 5 * Initialize: Copy hex h0init-h7init into binary h0-h7 wloopd mcw + h0init-7, x3 mcw + h0, x1 mcw @ 064 @, tobinc * 8 * 8 hex digits b tobin * Initialize ah from h0-h7 mcw @ 000 @, x1 ilp mcw h0 + 31 & amp; x1, a + 31 & amp; x1 ma @ 032 @, x1 c x1, @ 256 @ bu ilp mcw @ 000 @, bitidx * bitidx = i * 32 = bit index mcw @ 000 @, kidx * kidx = i * 8 = key index * Compute s1 from e mainlp mcw + e, x1 mcw + s1, x2 za +0, 31 & amp; x2 * Zero s1 * Add e rightrotate 6 sw 6 & amp; x2 * Wordmark at bit 6 (from left) of s1 a 25 & amp; x1, 31 & amp; x2 * Right shifted: 31-6 = bit 25 of e, 31 = end of s1 a 31 & amp; x1, 5 & amp; x2 * Wrapped: 31 = end of e, 6-1 = bit 5 of s1 cw 6 & amp; x2 * Clear wordmark * Add e rightrotate 11 sw 11 & amp; x2 * Wordmark at bit 11 (from left) of s1 a 20 & amp; x1, 31 & amp; x2 * Right shifted: 31-11 = bit 20 of e 31 = end of s1 a 31 & amp; x1, 10 & amp; x2 * Wrapped: 31 = end of e, 11-1 = bit 10 of s1 cw 11 & amp; x2 * Clear wordmark * Add e rightrotate 25 sw 25 & amp; x2 * Wordmark at bit 25 (from left) of s1 a 6 & amp; x1, 31 & amp; x2 * Right shifted: 31-25 = bit 6 of e, 31 = end of s1 a 31 & amp; x1, 24 & amp; x2 * Wrapped: 31 = end of e , 25-1 = bit 24 of s1 cw 25 & amp; x2 * Clear wordmark * Convert sum to xor mcw + s1 + 31, x1 * x1 = right end of s1 mcw @ 032 @, x2 * Process 32 bits b xor sw s1 * Restore wordmark cleared by xor * Compute ch: choose function mcw @ 000 @, x1 * x1 is index from 0 to 31 chl c e & amp; x1, @ 0 @ be chzero mn f & amp; x1, ch & amp; x1 * for 1, select f bit b chincr chzero mn g & amp; x1, ch & amp; x1 * for 0, select g bit chincr a +1, x1 mz @ 0 @, x1 c @ 032 @, x1 bu chl * Compute temp1: k [i] + h + S1 + ch + w [i] cs 299 mcw + k-7, x3 * Convert k [i] to binary in temp1 ma kidx, x3 mcw + temp1, x1 mcw @ 008 @, tobinc * 8 hex digits b tobin mcw @
To summarize.
Source: geektimes.ru/company/hashflare/blog/252092/