Arduino Cryptography Library
SHA384.cpp
1 /*
2  * Copyright (C) 2015 Southern Storm Software, Pty Ltd.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #include "SHA384.h"
24 #include "Crypto.h"
25 #include "utility/ProgMemUtil.h"
26 #include <string.h>
27 
51 {
52  reset();
53 }
54 
55 size_t SHA384::hashSize() const
56 {
57  return 48;
58 }
59 
61 {
62  static uint64_t const hashStart[8] PROGMEM = {
63  0xcbbb9d5dc1059ed8ULL, 0x629a292a367cd507ULL, 0x9159015a3070dd17ULL,
64  0x152fecd8f70e5939ULL, 0x67332667ffc00b31ULL, 0x8eb44a8768581511ULL,
65  0xdb0c2e0d64f98fa7ULL, 0x47b5481dbefa4fa4ULL
66  };
67  memcpy_P(state.h, hashStart, sizeof(hashStart));
68  state.chunkSize = 0;
69  state.lengthLow = 0;
70  state.lengthHigh = 0;
71 }
SHA384()
Constructs a SHA-384 hash object.
Definition: SHA384.cpp:50
size_t hashSize() const
Size of the hash result from finalize().
Definition: SHA384.cpp:55
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA384.cpp:60