slip_mask_transcript
stdlib/slip/slip_mask_transcript.nbv
slip_mask_transcript(static mask)
transcript encoding of a static bit mask (dags BitMask::transcript_elements): the length, then four 16 bit chunks of every 64 bit word
- Precompiles
div_ceil!,if_lt!,len!,loop!- Used by
slip/slip_r1cs_arg_verify
Source
# transcript encoding of a static bit mask (dags BitMask::transcript_elements):
# the length, then four 16 bit chunks of every 64 bit word
(static mask)
static mask_len = len! mask
static words = div_ceil! mask_len, 64
static mut two_pows[16]
two_pows[0] = 1
loop! 15, i {
two_pows[i + 1] = 2 * two_pows[i]
}
static mut out[1 + 4 * words]
out[0] = mask_len
loop! words, w {
loop! 4, chunk {
static mut v = 0
loop! 16, b {
static bit = 64 * w + 16 * chunk + b
if_lt! bit, mask_len {
v = v + mask[bit] * two_pows[b]
}
}
out[1 + 4 * w + chunk] = v
}
}
out