File: modthm.cry

package info (click to toggle)
aws-crt-python 0.16.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 78,328 kB
  • sloc: ansic: 330,743; python: 18,949; makefile: 6,271; sh: 3,712; asm: 754; cpp: 699; ruby: 208; java: 77; perl: 73; javascript: 46; xml: 11
file content (21 lines) | stat: -rw-r--r-- 726 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
valid_block_sizes : [16] -> [16] -> Bit
valid_block_sizes hbs bs =
  // We're not handling SSLv3 yet.
  //((bs, hbs) == (40, 64)) ||
  //((bs, hbs) == (48, 64)) ||
  ((bs, hbs) == (64, 64)) ||
  ((bs, hbs) == (128, 128))

modthm : [32] -> [32] -> [32] -> [16] -> [16] -> Bit
modthm x11 x15 x16 hash_block_size block_size =
  ((((x11 + (x16 % x17)) % x18) + (x15 % x17)) % x18)
  ==
  ((x11 + ((x16 + x15) % x17)) % x18)
  where x17 = zero # hash_block_size
        x18 = zero # block_size

modthm_precond : [32] -> [32] -> [32] -> [16] -> [16] -> Bit
modthm_precond x11 x15 x16 hash_block_size block_size =
  if (valid_block_sizes hash_block_size block_size) then
    modthm x11 x15 x16 hash_block_size block_size
  else True