pub fn new(sha: &'a mut pac::SHA256, input_len: usize) -> SHA256Ctx {
        let num_blocks = (input_len + 64 + 8) / 64;
        // Can hash up to 65536 blocks, this is the largest value that fits into data_cnt
        // (0 = 65536).
        assert!(num_blocks <= 0x10000);
        unsafe {
            sha.num_reg.write(|w|
                w.data_cnt().bits(((input_len + 64 + 8) / 64) as u16));
            sha.function_reg_0.write(|w|
                w.endian().variant(ENDIAN_A::BE)
                 .en().bit(true));
            sha.function_reg_1.write(|w|
                w.dma_en().bit(false));
        }
        SHA256Ctx { sha, block: 0, ptr: 0 }
    }
/** Create new SHA256 hardware context. As the peripheral has internal
     * state and supports only one context, this prevents creating multiple concurrent
     * contexts by requiring a mutable reference.
     * Unlike software SHA256, the peripheral needs to know the total number of blocks
     * in advance.`input_len` must match the number of bytes that will be fed using update
     * before calling finish, or the result will likely be incorrect or the engine will hang.
     */
Create new SHA256 hardware context. As the peripheral has internal
state and supports only one context, this prevents creating multiple concurrent
contexts by requiring a mutable reference.
Unlike software SHA256, the peripheral needs to know the total number of blocks
in advance.`input_len` must match the number of bytes that will be fed using update
before calling finish, or the result will likely be incorrect or the engine will hang.
Create new SHA256 hardware context . As the peripheral has internal state and supports only one context this prevents creating multiple concurrent contexts by requiring a mutable reference . Unlike software SHA256 the peripheral needs to know the total number of blocks in advance . ` input_len ` must match the number of bytes that will be fed using update before calling finish or the result will likely be incorrect or the engine will hang .
pub fn new(sha: &'a mut pac::SHA256, input_len: usize) -> SHA256Ctx {
        let num_blocks = (input_len + 64 + 8) / 64;
        // Can hash up to 65536 blocks, this is the largest value that fits into data_cnt
        // (0 = 65536).
        assert!(num_blocks <= 0x10000);
        unsafe {
            sha.num_reg.write(|w|
                w.data_cnt().bits(((input_len + 64 + 8) / 64) as u16));
            sha.function_reg_0.write(|w|
                w.endian().variant(ENDIAN_A::BE)
                 .en().bit(true));
            sha.function_reg_1.write(|w|
                w.dma_en().bit(false));
        }
        SHA256Ctx { sha, block: 0, ptr: 0 }
    }
pub fn new ( sha : & ' a mut pac :: SHA256 , input_len : usize ) -> SHA256Ctx { let num_blocks = ( input_len + 64 + 8 ) / 64 ; // Can hash up to 65536 blocks, this is the largest value that fits into data_cnt // (0 = 65536). assert ! ( num_blocks 0x10000 ) ; unsafe { sha . num_reg . write ( | w | w . data_cnt ( ) . bits ( ( ( input_len + 64 + 8 ) / 64 ) as u16 ) ) ; sha . function_reg_0 . write ( | w | w . endian ( ) . variant ( ENDIAN_A :: BE ) . en ( ) . bit ( true ) ) ; sha . function_reg_1 . write ( | w | w . dma_en ( ) . bit ( false ) ) ; } SHA256Ctx { sha , block : 0 , ptr : 0 } }
Create new SHA256 hardware context.
Create new SHA256 hardware context .
sha
&'a mut pac::SHA256
input_len
usize
sha
&'a mut pac::SHA256
input_len
usize