ГОСТ 34.11-2012 Стрибог на flat assembler (x86)

imageВ продолжение темы OS Systemicus (т.к. там используется этот алгоритм) привожу полный код реализации ГОСТ 34.11–2012 на ассемблере. Эта же «библиотека» используется и в данной программе — http://omegicus.com/gost_34.11–2012_stribog

UPD1: не в курсе, может выкладывать такое на хабре не по правилам — скажите, удалю…

Не буду ничего описывать — написано уже достаточно, просто выложу код. Кого интересует не код, а подробности алгоритма — просьба не читать и не минусовать…

Сразу предупреждаю, код не оптимизирован. Отдаю код целиком в добрые руки оптимизаторов) Если у кого получится ускорить ее — выкладывайте тоже.

Как использовать:

mov ebx, 512; 512 bit version mov esi, buff mov edi, MH mov ecx, dword[m_sz] call GOST_3411_2012 ; mov ebx, 256; 256 bit version mov esi, buff mov edi, MH mov ecx, dword[m_sz] call GOST_3411_2012 В первом случае используется 512-битная версия, исходник в ^buff, результат в ^MH, длина исходных данных в m_sz.Во втором случае всё аналогично, но используется 256-битная версия алгоритма.

Итак, секция кода:

align 4 GOST_3411_2012: ;(EBX variant, ESI const unsigned char *message, ECX length, EDI unsigned char *out) ; *hash = IV shl ecx, 0×00000003; convert bytes to bits pushad mov edi, G12_VARS mov ecx, G12_VARS_SZ / 4 xor eax, eax cld rep stosd ; mov eax, 0×00000000 cmp ebx, 256 jne .h512 mov eax, 0×01010101 .h512: mov edi, gosth_hash mov ecx, 64/4 cld rep stosd ; mov byte[hash_X_v512 + 62], 0×02; init hash_X_v512 popad ; ; Stage 2 ;; while (len >= 512) ;; { ;; memcpy (m, message + len/8 — 63 — ((len & 0×7) == 0), 64); ;; g_N (N, hash, m); ;; AddModulo512(N, v512, N); ;; AddModulo512(hash_X_Sigma, m, hash_X_Sigma); ;; len -= 512; ;; } align 4 .stage_2: cmp ecx, 512 jb .stage_25 ; push ecx esi edi mov edi, g12_X_m push ecx shr ecx, 0×00000003 add esi, ecx sub esi, 64 pop ecx mov ecx, 64/4 cld rep movsd pop edi esi ecx ; g_N (N, hash, m) push edx esi edi mov edi, hash_X_N mov esi, gosth_hash mov edx, g12_X_m call fn_g_N; EDI *N, ESI *h, EDX *m; +++++ pop edi esi edx ; AddModulo512(N, v512, N) push eax esi edi mov eax, hash_X_N mov esi, hash_X_v512 mov edi, hash_X_N call AddModulo512; eax *a esi *b edi *c pop edi esi eax ; AddModulo512(hash_X_Sigma, m, hash_X_Sigma) push eax esi edi mov eax, hash_X_Sigma mov esi, g12_X_m mov edi, hash_X_Sigma call AddModulo512; eax *a esi *b edi *c pop edi esi eax ; len -= 512; sub ecx, 512 cmp ecx, 512 jae .stage_2 ; } .stage_25: ; +OK memset (m,0,64) push edi ecx eax mov edi, g12_X_m xor eax, eax mov ecx, 64/4 cld rep stosd pop eax ecx edi ; +OK memcpy (m + 63 — len/8 + ((len & 0×7) == 0), message, len/8 + 1 — ((len & 0×7) == 0)) push eax ecx esi edi mov eax, 64 shr ecx, 0×00000003 sub eax, ecx mov edi, g12_X_m add edi, eax cld rep movsb pop edi esi ecx eax ; ; ; Stage 3 ; m[ 63 — len/8 ] |= (1 << (len & 0x7)) push ebx ecx edx push ecx and ecx, 0x00000007 mov ebx, 0x00000001 shl ebx, cl pop ecx push ecx shr ecx, 0x00000003 mov edx, 63 sub edx, ecx pop ecx add edx, g12_X_m or byte[edx], bl pop edx ecx ebx

; g_N (N, hash, m); push edx esi edi mov edi, hash_X_N mov esi, gosth_hash mov edx, g12_X_m call fn_g_N; EDI *N, ESI *h, EDX *m pop edi esi edx ; v512[63] = len & 0xFF; ; push ecx ; and ecx, 0×000000FF mov byte[hash_X_v512 + 63], cl ; pop ecx ; v512[62] = len >> 8; push ecx shr ecx, 0×00000008 mov byte[hash_X_v512 + 62], cl pop ecx ; AddModulo512(N, v512, N); push esi edi mov eax, hash_X_N mov esi, hash_X_v512 mov edi, hash_X_N call AddModulo512; eax *a esi *b edi *c pop edi esi ; AddModulo512(hash_X_Sigma, m, hash_X_Sigma) push esi edi mov eax, hash_X_Sigma mov esi, g12_X_m mov edi, hash_X_Sigma call AddModulo512; eax *a esi *b edi *c pop edi esi ; g_N (v0, hash, N); push esi edi mov edi, hash_X_v0 mov esi, gosth_hash mov edx, hash_X_N call fn_g_N; EDI *N, ESI *h, EDX *m ; g_N (v0, hash, hash_X_Sigma); mov edi, hash_X_v0 mov esi, gosth_hash mov edx, hash_X_Sigma call fn_g_N; EDI *N, ESI *h, EDX *m pop edi esi ; memcpy (out, hash, 64) push ecx esi edi mov esi, gosth_hash

mov ecx, 64/4 cmp ebx, 256 jne .h512c mov ecx, 32/4 .h512c: cld rep movsd pop edi esi ecx ret

ALIGN 4 HEX2STR_256_BIT: ; ^ESI→, ^EDI<- PUSHAD XOR ECX, ECX ; @@: INC ECX CMP ECX, 32 JA .END LODSB PUSH ECX MOV DL, AL MOV ECX, 0x02 .L1: ROL DL, 0x04 MOV EAX, 0x300F AND AL, DL AAA AAD 0x11 STOSB LOOP .L1 POP ECX JMP @B .END: XOR EAX, EAX STOSB POPAD RETD

ALIGN 4 HEX2STR_512_BIT: ; ^ESI→, ^EDI<- PUSHAD XOR ECX, ECX ; @@: INC ECX CMP ECX, 64 JA .END LODSB PUSH ECX MOV DL, AL MOV ECX, 0x02 .L1: ROL DL, 0x04 MOV EAX, 0x300F AND AL, DL AAA AAD 0x11 STOSB LOOP .L1 POP ECX JMP @B .END: XOR EAX, EAX STOSB POPAD RETD

; FASM x86: Vladislav Kabak

; include 'lib_gost_data.inc'

align 4 KeySchedule: ; unsigned char *K EAX, int i ECX; +OK push eax ebx ecx esi ; K = K xor C[i] push eax mov ebx, eax mov esi, eax mov eax, ecx shl eax, 0×06; *64 (get block # by index) add eax, const_C; point to C-table call AddXor512; ebx eax esi; AddXor512(K, C[i], K) pop esi ; call fn_S; K = S (K) call fn_P; K = P (K) call fn_L; K = L (K) ; pop esi ecx ebx eax ret

align 4 fn_S: ; SubBytes S function. unsigned char *state [esi] ; +OK push eax ebx ecx edx xor ecx, ecx; int i = 0 mov ebx, G12_Sbox; S-Box xor edx, edx align 4; for (i=0; i<64;i++) state[i] = Sbox[state[i]] @@: mov dl, byte[esi + ecx] ; edx = state[i] mov al, byte[G12_Sbox + edx] ; al = Sbox[state[i]] mov byte[esi + ecx], al ; state[i] = Sbox[state[i]] inc ecx cmp ecx, 64 jne @b pop edx ecx ebx eax ret

align 4 fn_P: ; Transposition P function. unsigned char *state in ESI; +OK pushad xor ecx, ecx; int i = 0 xor edx, edx align 4 @@: mov dl, byte [Tau + ecx] ; edx = Tau[i] mov al, byte [esi + edx] ; eax = state[Tau[i]] mov byte[fn_P_t + ecx], al; t[i] = state[Tau[i]] inc ecx; for (i=0; i<64;i++) cmp ecx, 64 jne @b ; memcpy(state,t,64) mov ecx, 64/4 mov edi, esi mov esi, fn_P_t cld rep movsd popad ret

align 4 fn_E: ; eax: ^K, ebx: *m, esi: *state; +OK ; unsigned char *K, const unsigned char *m, unsigned char *state push ebx ecx ; AddXor512(m, K, state) call AddXor512; m=ebx, K=eax, state=esi, safe needed xor ecx, ecx; int i = 0 align 4; for (i=0; i<12;i++) { @@: call fn_S ; state = S(state) call fn_P ; state = P(state) call fn_L ; state = L(state) ; K = KeySchedule(K, i) call KeySchedule ; eax=K, i=ecx, safe needed ; AddXor512(state,K,state) mov ebx, esi call AddXor512 ; (state, K, state) inc ecx cmp ecx, 12 jne @b ; } pop ecx ebx ret

align 4 AddXor512: ; AddRoundKey X-function. XOR 512-bytes; +OK EBX EAX ESI push ecx edx xor ecx, ecx align 4 @@: mov edx, dword[ebx + ecx] xor edx, dword[eax + ecx] mov dword[esi + ecx], edx add ecx, 4 cmp ecx, 64 jne @b pop edx ecx ret

; g (N, m, H) align 4 fn_g_N: ; EDI *N, ESI *h, EDX *m; +OK ; const unsigned char *N, unsigned char *h, const unsigned char *m pushad push esi ; AddXor512(N, h, K) mov ebx, edi; N mov eax, esi; h mov esi, fn_g_N_K call AddXor512; ebx eax esi mov esi, fn_g_N_K; call fn_S; K = S (K) call fn_P; K = P (K) call fn_L; K = L (K) ; E (K, m, t) ; t = E (K, m) mov eax, fn_g_N_K; K mov ebx, edx; m mov esi, fn_g_N_t; =t call fn_E; eax, ebx, esi ; pop esi; h push esi; h ; AddXor512(t, h, t) ; t = h xor t mov ebx, fn_g_N_t; t mov eax, esi; h mov esi, fn_g_N_t; t call AddXor512; ebx eax esi pop esi; h ; AddXor512(t, m, h) ; G = t xor m mov ebx, fn_g_N_t; t mov eax, edx; m call AddXor512; ebx eax esi popad ret; result = G

align 4 AddModulo512: ; eax *a esi *b edi *c; +OK ; const unsigned char *a, const unsigned char *b, unsigned char *c push ebx ecx edx ; mov ecx, 64; int i = 63 xor ebx, ebx; int t = 0 ; for (i=63; i>=0; i--) ; { align 4 @@: sar ebx, 0×00000008; t:= t >> 8 movzx edx, byte[eax + ecx -1] ; edx = a[i] add ebx, edx; t:= (t>>8) + a[i] movzx edx, byte[esi + ecx -1] ; edx = b[i] add ebx, edx; t:= (t>>8) + +a[i] + b[i] mov byte[edi + ecx -1], bl; c[i] = t & 0xFF ; dec ecx or ecx, ecx jnz @b ; } pop edx ecx ebx ret

; L: umnozhenie 64bit vectora vhodnogo na matritsu A (64×64) ; unsigned long long v = 0; ; int i = 0, j = 0, k = 0; ; for (i=0; i<8;i++) { ; v=0; ; for(k=0;k<8;k++) { ; for(j=0;j<8;j++) { ; if ((state[i*8+k] & (1<<(7-j))) != 0) ; v ^= A[k*8+j] ; } ; } ; for(k=0;k<8;k++) ; { ; state[i*8+k] = (v & ((unsigned long long)0xFF << (7-k)*8)) >> (7-k)*8; ; } ;}

align 4 fn_L: ; unsigned char *state in ESI; pushad ; xor ecx, ecx; int i = 0 xor ebx, ebx; int j = 0 xor edx, edx; int k = 0 pxor mm0, mm0; ; for (i=0; i<8;i++) { align 4 .next_i: pxor mm0, mm0 ; v = 0 ; ; for(k=0;k<8;k++) { xor edx, edx ; k = 0 align 4 .next_k: ; for(j=0;j<8;j++) { ; if ((state[i*8+k] & (1<<(7-j))) != 0) v ^= A[k*8+j] ; } xor ebx, ebx ; j = 0 align 4 .next_j: mov eax, 0x00000007 ; 7 sub eax, ebx ; 7-j mov edi, 0x00000001 ; 1 ; push ecx mov ecx, eax shl edi, cl ; (1<<(7-j)) == EDI pop ecx ; mov eax, ecx ; i shl eax, 0x00000003 ; i*8 add eax, edx ; (i*8+k) movzx eax, byte[esi + eax] ; state[i*8+k] and eax, edi ; ( state[i*8+k] & (1<<(7-j) ) cmp eax, 0 ; if ((state[i*8+k] & (1<<(7-j))) != 0) v ^= A[k*8+j] ??? jz .next_ji ; == 0 ; v ^= A[k*8+j] ; != 0 mov eax, edx ; k shl eax, 0x00000003 ; k*8 add eax, ebx ; k*8+j shl eax, 0x00000003 ; *8 (point from index to 64bit value (8bytes per value)) add eax, matrix_A ; ^A[k*8+j] movq mm1, qword[eax] ; A[k*8+j] pxor mm0, mm1 ; v ^= A[k*8+j] jmp .next_ji ; } jmp .next_ki ; }

.next_k2start: xor edx, edx align 4 .next_k2: mov eax, 0×00000007; 7 sub eax, edx; (7-k) shl eax, 0×00000003; (7-k)*8 mov edi, 0×000000FF pxor mm2, mm2 movd mm2, edi; (unsigned long long)0xFF pxor mm4, mm4 movd mm4, eax psllq mm2, mm4; (unsigned long long)0xFF << (7-k)*8 movq mm3, mm0 ; v pand mm3, mm2 ; (v & ((unsigned long long)0xFF << (7-k)*8)) psrlq mm3, mm4 ; (v & ((unsigned long long)0xFF << (7-k)*8)) >> (7-k)*8 movd eax, mm3 mov edi, ecx; i shl edi, 0×00000003; i*8 add edi, edx; i*8+k add edi, esi; ^state[i*8+k] mov byte[edi], al; state[i*8+k] = (v & ((unsigned long long)0xFF << (7-k)*8)) >> (7-k)*8; jmp .next_k2i

align 4 .next_ji: inc ebx cmp ebx, 8 jb .next_j jmp .next_ki align 4 .next_ki: inc edx cmp edx, 8 jb .next_k jmp .next_k2start align 4 .next_k2i: inc edx cmp edx, 8 jb .next_k2 jmp .next_ii align 4 .next_ii: inc ecx cmp ecx, 8 jb .next_i jmp .end .end: ; emms popad ret

А вот и данные для кода:

;--------------- GOST 34.11–2012 -----------------------------------------------------------------; ; Matrix A for MixColumns (L) function align 32 matrix_A: dq 0×8e20faa72ba0b470, 0×47107ddd9b505a38, 0xad08b0e0c3282d1c, 0xd8045870ef14980e dq 0×6c022c38f90a4c07, 0×3601161cf205268d, 0×1b8e0b0e798c13c8, 0×83478b07b2468764 ; dq 0xa011d380818e8f40, 0×5086e740ce47c920, 0×2843fd2067adea10, 0×14aff010bdd87508 dq 0×0ad97808d06cb404, 0×05e23c0468365a02, 0×8c711e02341b2d01, 0×46b60f011a83988e ; dq 0×90dab52a387ae76f, 0×486dd4151c3dfdb9, 0×24b86a840e90f0d2, 0×125c354207487869 dq 0×092e94218d243cba, 0×8a174a9ec8121e5d, 0×4585254f64090fa0, 0xaccc9ca9328a8950 ; dq 0×9d4df05d5f661451, 0xc0a878a0a1330aa6, 0×60543c50de970553, 0×302a1e286fc58ca7 dq 0×18150f14b9ec46dd, 0×0c84890ad27623e0, 0×0642ca05693b9f70, 0×0321658cba93c138 ; dq 0×86275df09ce8aaa8, 0×439da0784e745554, 0xafc0503c273aa42a, 0xd960281e9d1d5215 dq 0xe230140fc0802984, 0×71180a8960409a42, 0xb60c05ca30204d21, 0×5b068c651810a89e ; dq 0×456c34887a3805b9, 0xac361a443d1c8cd2, 0×561b0d22900e4669, 0×2b838811480723ba dq 0×9bcf4486248d9f5d, 0xc3e9224312c8c1a0, 0xeffa11af0964ee50, 0xf97d86d98a327728 ; dq 0xe4fa2054a80b329c, 0×727d102a548b194e, 0×39b008152acb8227, 0×9258048415eb419d dq 0×492c024284fbaec0, 0xaa16012142f35760, 0×550b8e9e21f7a530, 0xa48b474f9ef5dc18 ; dq 0×70a6a56e2440598e, 0×3853dc371220a247, 0×1ca76e95091051ad, 0×0edd37c48a08a6d8 dq 0×07e095624504536c, 0×8d70c431ac02a736, 0xc83862965601dd1b, 0×641c314b2b8ee083 ; Substitution for SubBytes function align 32 G12_Sbox: db 0xFC, 0xEE, 0xDD, 0×11, 0xCF, 0×6E, 0×31, 0×16, 0xFB, 0xC4, 0xFA, 0xDA, 0×23, 0xC5, 0×04, 0×4D db 0xE9, 0×77, 0xF0, 0xDB, 0×93, 0×2E, 0×99, 0xBA, 0×17, 0×36, 0xF1, 0xBB, 0×14, 0xCD, 0×5F, 0xC1 db 0xF9, 0×18, 0×65, 0×5A, 0xE2, 0×5C, 0xEF, 0×21, 0×81, 0×1C, 0×3C, 0×42, 0×8B, 0×01, 0×8E, 0×4F db 0×05, 0×84, 0×02, 0xAE, 0xE3, 0×6A, 0×8F, 0xA0, 0×06, 0×0B, 0xED, 0×98, 0×7F, 0xD4, 0xD3, 0×1F db 0xEB, 0×34, 0×2C, 0×51, 0xEA, 0xC8, 0×48, 0xAB, 0xF2, 0×2A, 0×68, 0xA2, 0xFD, 0×3A, 0xCE, 0xCC db 0xB5, 0×70, 0×0E, 0×56, 0×08, 0×0C, 0×76, 0×12, 0xBF, 0×72, 0×13, 0×47, 0×9C, 0xB7, 0×5D, 0×87 db 0×15, 0xA1, 0×96, 0×29, 0×10, 0×7B, 0×9A, 0xC7, 0xF3, 0×91, 0×78, 0×6F, 0×9D, 0×9E, 0xB2, 0xB1 db 0×32, 0×75, 0×19, 0×3D, 0xFF, 0×35, 0×8A, 0×7E, 0×6D, 0×54, 0xC6, 0×80, 0xC3, 0xBD, 0×0D, 0×57 db 0xDF, 0xF5, 0×24, 0xA9, 0×3E, 0xA8, 0×43, 0xC9, 0xD7, 0×79, 0xD6, 0xF6, 0×7C, 0×22, 0xB9, 0×03 db 0xE0, 0×0F, 0xEC, 0xDE, 0×7A, 0×94, 0xB0, 0xBC, 0xDC, 0xE8, 0×28, 0×50, 0×4E, 0×33, 0×0A, 0×4A db 0xA7, 0×97, 0×60, 0×73, 0×1E, 0×00, 0×62, 0×44, 0×1A, 0xB8, 0×38, 0×82, 0×64, 0×9F, 0×26, 0×41 db 0xAD, 0×45, 0×46, 0×92, 0×27, 0×5E, 0×55, 0×2F, 0×8C, 0xA3, 0xA5, 0×7D, 0×69, 0xD5, 0×95, 0×3B db 0×07, 0×58, 0xB3, 0×40, 0×86, 0xAC, 0×1D, 0xF7, 0×30, 0×37, 0×6B, 0xE4, 0×88, 0xD9, 0xE7, 0×89 db 0xE1, 0×1B, 0×83, 0×49, 0×4C, 0×3F, 0xF8, 0xFE, 0×8D, 0×53, 0xAA, 0×90, 0xCA, 0xD8, 0×85, 0×61 db 0×20, 0×71, 0×67, 0xA4, 0×2D, 0×2B, 0×09, 0×5B, 0xCB, 0×9B, 0×25, 0xD0, 0xBE, 0xE5, 0×6C, 0×52 db 0×59, 0xA6, 0×74, 0xD2, 0xE6, 0xF4, 0xB4, 0xC0, 0xD1, 0×66, 0xAF, 0xC2, 0×39, 0×4B, 0×63, 0xB6

; Substitution for Transposition (P) function align 32 Tau: db 0, 8, 16, 24, 32, 40, 48, 56 db 1, 9, 17, 25, 33, 41, 49, 57 db 2, 10, 18, 26, 34, 42, 50, 58 db 3, 11, 19, 27, 35, 43, 51, 59 db 4, 12, 20, 28, 36, 44, 52, 60 db 5, 13, 21, 29, 37, 45, 53, 61 db 6, 14, 22, 30, 38, 46, 54, 62 db 7, 15, 23, 31, 39, 47, 55, 63

; Constant values for KeySchedule function [12][64] align 32 const_C: db 0xb1,0×08,0×5b,0xda,0×1e,0xca,0xda,0xe9,0xeb,0xcb,0×2f,0×81,0xc0,0×65,0×7c,0×1f db 0×2f,0×6a,0×76,0×43,0×2e,0×45,0xd0,0×16,0×71,0×4e,0xb8,0×8d,0×75,0×85,0xc4,0xfc db 0×4b,0×7c,0xe0,0×91,0×92,0×67,0×69,0×01,0xa2,0×42,0×2a,0×08,0xa4,0×60,0xd3,0×15 db 0×05,0×76,0×74,0×36,0xcc,0×74,0×4d,0×23,0xdd,0×80,0×65,0×59,0xf2,0xa6,0×45,0×07 ; db 0×6f,0xa3,0xb5,0×8a,0xa9,0×9d,0×2f,0×1a,0×4f,0xe3,0×9d,0×46,0×0f,0×70,0xb5,0xd7 db 0xf3,0xfe,0xea,0×72,0×0a,0×23,0×2b,0×98,0×61,0xd5,0×5e,0×0f,0×16,0xb5,0×01,0×31 db 0×9a,0xb5,0×17,0×6b,0×12,0xd6,0×99,0×58,0×5c,0xb5,0×61,0xc2,0xdb,0×0a,0xa7,0xca db 0×55,0xdd,0xa2,0×1b,0xd7,0xcb,0xcd,0×56,0xe6,0×79,0×04,0×70,0×21,0xb1,0×9b,0xb7 ; db 0xf5,0×74,0xdc,0xac,0×2b,0xce,0×2f,0xc7,0×0a,0×39,0xfc,0×28,0×6a,0×3d,0×84,0×35 db 0×06,0xf1,0×5e,0×5f,0×52,0×9c,0×1f,0×8b,0xf2,0xea,0×75,0×14,0xb1,0×29,0×7b,0×7b db 0xd3,0xe2,0×0f,0xe4,0×90,0×35,0×9e,0xb1,0xc1,0xc9,0×3a,0×37,0×60,0×62,0xdb,0×09 db 0xc2,0xb6,0xf4,0×43,0×86,0×7a,0xdb,0×31,0×99,0×1e,0×96,0xf5,0×0a,0xba,0×0a,0xb2 ; db 0xef,0×1f,0xdf,0xb3,0xe8,0×15,0×66,0xd2,0xf9,0×48,0xe1,0xa0,0×5d,0×71,0xe4,0xdd db 0×48,0×8e,0×85,0×7e,0×33,0×5c,0×3c,0×7d,0×9d,0×72,0×1c,0xad,0×68,0×5e,0×35,0×3f db 0xa9,0xd7,0×2c,0×82,0xed,0×03,0xd6,0×75,0xd8,0xb7,0×13,0×33,0×93,0×52,0×03,0xbe db 0×34,0×53,0xea,0xa1,0×93,0xe8,0×37,0xf1,0×22,0×0c,0xbe,0xbc,0×84,0xe3,0xd1,0×2e ; db 0×4b,0xea,0×6b,0xac,0xad,0×47,0×47,0×99,0×9a,0×3f,0×41,0×0c,0×6c,0xa9,0×23,0×63 db 0×7f,0×15,0×1c,0×1f,0×16,0×86,0×10,0×4a,0×35,0×9e,0×35,0xd7,0×80,0×0f,0xff,0xbd db 0xbf,0xcd,0×17,0×47,0×25,0×3a,0xf5,0xa3,0xdf,0xff,0×00,0xb7,0×23,0×27,0×1a,0×16 db 0×7a,0×56,0xa2,0×7e,0xa9,0xea,0×63,0xf5,0×60,0×17,0×58,0xfd,0×7c,0×6c,0xfe,0×57 ; db 0xae,0×4f,0xae,0xae,0×1d,0×3a,0xd3,0xd9,0×6f,0xa4,0xc3,0×3b,0×7a,0×30,0×39,0xc0 db 0×2d,0×66,0xc4,0xf9,0×51,0×42,0xa4,0×6c,0×18,0×7f,0×9a,0xb4,0×9a,0xf0,0×8e,0xc6 db 0xcf,0xfa,0xa6,0xb7,0×1c,0×9a,0xb7,0xb4,0×0a,0xf2,0×1f,0×66,0xc2,0xbe,0xc6,0xb6 db 0xbf,0×71,0xc5,0×72,0×36,0×90,0×4f,0×35,0xfa,0×68,0×40,0×7a,0×46,0×64,0×7d,0×6e ; db 0xf4,0xc7,0×0e,0×16,0xee,0xaa,0xc5,0xec,0×51,0xac,0×86,0xfe,0xbf,0×24,0×09,0×54 db 0×39,0×9e,0xc6,0xc7,0xe6,0xbf,0×87,0xc9,0xd3,0×47,0×3e,0×33,0×19,0×7a,0×93,0xc9 db 0×09,0×92,0xab,0xc5,0×2d,0×82,0×2c,0×37,0×06,0×47,0×69,0×83,0×28,0×4a,0×05,0×04 db 0×35,0×17,0×45,0×4c,0xa2,0×3c,0×4a,0xf3,0×88,0×86,0×56,0×4d,0×3a,0×14,0xd4,0×93 ; db 0×9b,0×1f,0×5b,0×42,0×4d,0×93,0xc9,0xa7,0×03,0xe7,0xaa,0×02,0×0c,0×6e,0×41,0×41 db 0×4e,0xb7,0xf8,0×71,0×9c,0×36,0xde,0×1e,0×89,0xb4,0×44,0×3b,0×4d,0xdb,0xc4,0×9a db 0xf4,0×89,0×2b,0xcb,0×92,0×9b,0×06,0×90,0×69,0xd1,0×8d,0×2b,0xd1,0xa5,0xc4,0×2f db 0×36,0xac,0xc2,0×35,0×59,0×51,0xa8,0xd9,0xa4,0×7f,0×0d,0xd4,0xbf,0×02,0xe7,0×1e ; db 0×37,0×8f,0×5a,0×54,0×16,0×31,0×22,0×9b,0×94,0×4c,0×9a,0xd8,0xec,0×16,0×5f,0xde db 0×3a,0×7d,0×3a,0×1b,0×25,0×89,0×42,0×24,0×3c,0xd9,0×55,0xb7,0xe0,0×0d,0×09,0×84 db 0×80,0×0a,0×44,0×0b,0xdb,0xb2,0xce,0xb1,0×7b,0×2b,0×8a,0×9a,0xa6,0×07,0×9c,0×54 db 0×0e,0×38,0xdc,0×92,0xcb,0×1f,0×2a,0×60,0×72,0×61,0×44,0×51,0×83,0×23,0×5a,0xdb ; db 0xab,0xbe,0xde,0xa6,0×80,0×05,0×6f,0×52,0×38,0×2a,0xe5,0×48,0xb2,0xe4,0xf3,0xf3 db 0×89,0×41,0xe7,0×1c,0xff,0×8a,0×78,0xdb,0×1f,0xff,0xe1,0×8a,0×1b,0×33,0×61,0×03 db 0×9f,0xe7,0×67,0×02,0xaf,0×69,0×33,0×4b,0×7a,0×1e,0×6c,0×30,0×3b,0×76,0×52,0xf4 db 0×36,0×98,0xfa,0xd1,0×15,0×3b,0xb6,0xc3,0×74,0xb4,0xc7,0xfb,0×98,0×45,0×9c,0xed ; db 0×7b,0xcd,0×9e,0xd0,0xef,0xc8,0×89,0xfb,0×30,0×02,0xc6,0xcd,0×63,0×5a,0xfe,0×94 db 0xd8,0xfa,0×6b,0xbb,0xeb,0xab,0×07,0×61,0×20,0×01,0×80,0×21,0×14,0×84,0×66,0×79 db 0×8a,0×1d,0×71,0xef,0xea,0×48,0xb9,0xca,0xef,0xba,0xcd,0×1d,0×7d,0×47,0×6e,0×98 db 0xde,0xa2,0×59,0×4a,0xc0,0×6f,0xd8,0×5d,0×6b,0xca,0xa4,0xcd,0×81,0xf3,0×2d,0×1b ; db 0×37,0×8e,0xe7,0×67,0xf1,0×16,0×31,0xba,0xd2,0×13,0×80,0xb0,0×04,0×49,0xb1,0×7a db 0xcd,0xa4,0×3c,0×32,0xbc,0xdf,0×1d,0×77,0xf8,0×20,0×12,0xd4,0×30,0×21,0×9f,0×9b db 0×5d,0×80,0xef,0×9d,0×18,0×91,0xcc,0×86,0xe7,0×1d,0xa4,0xaa,0×88,0xe1,0×28,0×52 db 0xfa,0xf4,0×17,0xd5,0xd9,0xb2,0×1b,0×99,0×48,0xbc,0×92,0×4a,0xf1,0×1b,0xd7,0×20 ; ; ; align 32 G12_VARS: fn_P_t db 64 dup 0 fn_g_N_t db 64 dup 0 fn_g_N_K db 64 dup 0 g12_X_m db 64 dup 0 gosth_hash db 64 dup 0 hash_X_v512: db 0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00 db 0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00 db 0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00 db 0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×02,0×00 hash_X_v0: db 0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00 db 0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00 db 0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00 db 0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00 hash_X_Sigma: db 0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00 db 0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00 db 0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00 db 0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00 hash_X_N: db 0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00 db 0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00 db 0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00 db 0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00 G12_VARS_SZ = $ — G12_VARS ;--------------- end of GOST 34.11–2012 ------------------------------------------------------------;

© Habrahabr.ru