Embedded systems coursework 2.
Fork of Crypto_light by
Embed:
(wiki syntax)
Show/hide line numbers
SHA2_64.h
00001 #ifndef SHA2_64_H 00002 #define SHA2_64_H 00003 00004 #include <stdint.h> 00005 00006 enum SHA2_64_TYPE 00007 { 00008 SHA_384, 00009 SHA_512 00010 }; 00011 00012 class SHA2_64 00013 { 00014 public : 00015 00016 SHA2_64(SHA2_64_TYPE type); 00017 00018 void update(uint8_t *data, uint32_t length); 00019 void finalize(uint8_t *hash); 00020 00021 static void computeHash(SHA2_64_TYPE type, uint8_t *hash, uint8_t *data, uint32_t length); 00022 00023 private : 00024 00025 static void computeBlock(uint64_t *h02, 00026 uint64_t *h12, 00027 uint64_t *h22, 00028 uint64_t *h32, 00029 uint64_t *h42, 00030 uint64_t *h52, 00031 uint64_t *h62, 00032 uint64_t *h72, 00033 uint8_t *buffer); 00034 00035 SHA2_64_TYPE type; 00036 uint64_t h0, h1, h2, h3, h4, h5, h6, h7; 00037 uint32_t totalBufferLength; 00038 uint8_t buffer[128]; 00039 uint8_t bufferLength; 00040 }; 00041 00042 #endif
Generated on Wed Jul 20 2022 22:55:43 by 1.7.2