Skip to content

HashPadding

Morard Dany edited this page Aug 16, 2018 · 1 revision

Overview

This padding algorithm is used by MD5, SHA2 and works as follow :

  1. Add a one bit at the end of the message
  2. Add as sequence of 0 until a block of 448-bits
  3. Write the size in bits of the message on 64 bits (l0 l1) e.g. 24 => 00000018 00000000

Core available

  • HashPadding_Std uses the PaddingIO interface.

Measure

Core Target Performance Aera RAM
*_Std Altera Cyclone V (C6) - - -

Example

import spinal.crypto.padding.{HashPadding_Config, HashPadding_Std}

val config = HashPadding_Config(
    dataInWidth  = 32 bits ,
    dataOutWidth = 512 bits,
    endianess    = LITTLE_endian
  )

val padding = new HashPadding_Std(config)
padding.io.init := ...
padding.io.cmd <> 
padding.io.rsp <>
Clone this wiki locally