~ehmry/nim_sphincs

1e8596f53e4943b50a6b03bc73a65dcf413669af — Emery Hemingway 3 years ago 036bfb8
Cleanup stale comments
1 files changed, 1 insertions(+), 4 deletions(-)

M src/sphincs/private/sphincs_shake256.nim
M src/sphincs/private/sphincs_shake256.nim => src/sphincs/private/sphincs_shake256.nim +1 -4
@@ 106,8 106,6 @@ proc Hmsg(R: Nbytes; pk: PK; M: string|openArray[byte]): (array[partialDigestByt
  var
    digest: array[m, byte]
    ctx: SHA3
  # TODO: the reference implementation does this wrong,
  # they overrun and hash some extra memory
  sha3_init(ctx, SHA3_SHAKE256, m)
  sha3_update(ctx, R)
  sha3_update(ctx, pk.seed)


@@ 117,8 115,7 @@ proc Hmsg(R: Nbytes; pk: PK; M: string|openArray[byte]): (array[partialDigestByt

  copyMem(result[0].addr, digest.addr, partialDigestBytes)

  # XXX
  # take the last bits from these regions, not the first bits as the spec might decribe
  # take the last bits from the tree and leaf index regions
  bigEndian64(result[1].addr, digest[digest.len-8-leafIndexBytes].addr)
  when h - h div d < 64:
    result[1] = result[1] and (not(int64.high shl (h - h div d)))