#include <string.h>#include <stdlib.h>#include "sha1.h"Go to the source code of this file.
Defines | |
| #define | SHA_LITTLE_ENDIAN 1234 |
| #define | SHA_BIG_ENDIAN 4321 |
| #define | rotl32(x, n) (((x) << n) | ((x) >> (32 - n))) |
| #define | swap_b32(x) ((rotl32((x), 8) & 0x00ff00ff) | (rotl32((x), 24) & 0xff00ff00)) |
| #define | SHA1_MASK (SHA1_BLOCK_SIZE - 1) |
| #define | ch(x, y, z) (((x) & (y)) ^ (~(x) & (z))) |
| #define | parity(x, y, z) ((x) ^ (y) ^ (z)) |
| #define | maj(x, y, z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) |
| #define | rnd(f, k) |
Functions | |
| void | sha1_compile (sha1_ctx ctx[1]) |
| void | sha1_begin (sha1_ctx ctx[1]) |
| void | sha1_hash (const unsigned char data[], unsigned int len, sha1_ctx ctx[1]) |
| void | sha1_end (unsigned char hval[], sha1_ctx ctx[1]) |
| void | sha1 (unsigned char hval[], const unsigned char data[], unsigned int len) |
Variables | |
| static sha1_32t | mask [4] |
| static sha1_32t | bits [4] |
| #define ch | ( | x, | |||
| y, | |||||
| z | ) | (((x) & (y)) ^ (~(x) & (z))) |
Definition at line 74 of file sha1.cpp.
Referenced by Curl_httpchunk_read(), inet_pton4(), asio::basic_socket_streambuf< Protocol, StreamSocketService >::overflow(), and sha1_compile().
| #define maj | ( | x, | |||
| y, | |||||
| z | ) | (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) |
| #define parity | ( | x, | |||
| y, | |||||
| z | ) | ((x) ^ (y) ^ (z)) |
| #define rnd | ( | f, | |||
| k | ) |
| #define SHA1_MASK (SHA1_BLOCK_SIZE - 1) |
| #define swap_b32 | ( | x | ) | ((rotl32((x), 8) & 0x00ff00ff) | (rotl32((x), 24) & 0xff00ff00)) |
| void sha1 | ( | unsigned char | hval[], | |
| const unsigned char | data[], | |||
| unsigned int | len | |||
| ) |
Definition at line 206 of file sha1.cpp.
References sha1_begin(), sha1_end(), and sha1_hash().
Referenced by vmsHash::Hash_SHA1().
| void sha1_begin | ( | sha1_ctx | ctx[1] | ) |
Definition at line 127 of file sha1.cpp.
References sha1_ctx::count, and sha1_ctx::hash.
Referenced by vmsHash::Hash_SHA1(), and sha1().
| void sha1_compile | ( | sha1_ctx | ctx[1] | ) |
Definition at line 82 of file sha1.cpp.
References a, b, c, ch, simple_client::e, sha1_ctx::hash, maj, parity, rnd, rotl32, SHA1_BLOCK_SIZE, swap_b32, and sha1_ctx::wbuf.
Referenced by sha1_end(), and sha1_hash().
| void sha1_end | ( | unsigned char | hval[], | |
| sha1_ctx | ctx[1] | |||
| ) |
Definition at line 167 of file sha1.cpp.
References bits, sha1_ctx::count, sha1_ctx::hash, mask, SHA1_BLOCK_SIZE, sha1_compile(), SHA1_DIGEST_SIZE, SHA1_MASK, swap_b32, and sha1_ctx::wbuf.
Referenced by vmsHash::Hash_SHA1(), and sha1().
| void sha1_hash | ( | const unsigned char | data[], | |
| unsigned int | len, | |||
| sha1_ctx | ctx[1] | |||
| ) |
Definition at line 137 of file sha1.cpp.
References sha1_ctx::count, pos(), SHA1_BLOCK_SIZE, sha1_compile(), SHA1_MASK, and sha1_ctx::wbuf.
Referenced by vmsHash::Hash_SHA1(), main(), and sha1().
sha1_32t bits[4] [static] |
Initial value:
{ 0x80000000, 0x00800000, 0x00008000, 0x00000080 }
Definition at line 163 of file sha1.cpp.
Referenced by CreateConnection(), fixedtables(), gen_bitlen(), gen_codes(), inflate(), inflate_fast(), inflateBack(), MD5_Final(), libtorrent::aux::piece_checker_data::parse_resume_data(), sha1_end(), and tr_static_init().
sha1_32t mask[4] [static] |
Initial value:
{ 0x00000000, 0xff000000, 0xffff0000, 0xffffff00 }
Definition at line 161 of file sha1.cpp.
Referenced by inflate_table(), libtorrent::dht::node_impl::refresh_bucket(), and sha1_end().
1.5.6