Main step of GOST 28147-89: Difference between revisions
Content added Content deleted
Line 410: | Line 410: | ||
k1 = [13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7] |
k1 = [13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7] |
||
k87, k65, k43, k21 = newSeq[ |
k87, k65, k43, k21 = newSeq[int64](256) |
||
proc kboxInit = |
proc kboxInit = |
||
Line 419: | Line 419: | ||
k21[i] = k2[i shr 4] shl 4 or k1[i and 15] |
k21[i] = k2[i shr 4] shl 4 or k1[i and 15] |
||
proc f(x): |
proc f(x): int64 = |
||
let x = k87[x shr 24 and 255] shl 24 or k65[x shr 16 and 255] shl 16 or |
let x = k87[x shr 24 and 255] shl 24 or k65[x shr 16 and 255] shl 16 or |
||
k43[x shr 8 and 255] shl 8 or k21[x and 255] |
k43[x shr 8 and 255] shl 8 or k21[x and 255] |