cosine-fast_hammer 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/fast_hammer/fast_hammer.c +4 -3
- data/ext/fast_hammer/sha1.c +4 -4
- data/ext/fast_hammer/sha1.h +4 -4
- metadata +1 -1
|
@@ -36,7 +36,7 @@ static long bits_in_byte[256] = {
|
|
|
36
36
|
/*
|
|
37
37
|
* internal_fast_hammer -- calculate hamming distance of two numbers.
|
|
38
38
|
*/
|
|
39
|
-
uint32_t internal_fast_hammer (const uint8_t *a, const uint8_t *b,
|
|
39
|
+
static inline uint32_t internal_fast_hammer (const uint8_t *a, const uint8_t *b,
|
|
40
40
|
register uint32_t length)
|
|
41
41
|
{
|
|
42
42
|
register uint32_t i;
|
|
@@ -61,8 +61,9 @@ VALUE meth_FastHammer_fast_hammer (VALUE self, VALUE a, VALUE b)
|
|
|
61
61
|
/*
|
|
62
62
|
* multi_sha1_ripper -- recursive function to rip through the hashs.
|
|
63
63
|
*/
|
|
64
|
-
void multi_sha1_ripper (const uint8_t *match_hash,
|
|
65
|
-
char *
|
|
64
|
+
static void multi_sha1_ripper (const uint8_t *match_hash,
|
|
65
|
+
const char *base_string, char *end_of_base_string,
|
|
66
|
+
const SHA1_CTX *base_context,
|
|
66
67
|
char *hammer_string, uint32_t *lowest_hammer, uint32_t depth)
|
|
67
68
|
{
|
|
68
69
|
uint8_t iter_character;
|
data/ext/fast_hammer/sha1.c
CHANGED
|
@@ -129,7 +129,7 @@ do_R4(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LON
|
|
|
129
129
|
/*
|
|
130
130
|
* Hash a single 512-bit block. This is the core of the algorithm.
|
|
131
131
|
*/
|
|
132
|
-
void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64])
|
|
132
|
+
static inline void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64])
|
|
133
133
|
{
|
|
134
134
|
uint32_t a, b, c, d, e;
|
|
135
135
|
CHAR64LONG16 *block;
|
|
@@ -199,7 +199,7 @@ void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64])
|
|
|
199
199
|
/*
|
|
200
200
|
* SHA1_Init - Initialize new context
|
|
201
201
|
*/
|
|
202
|
-
void SHA1_Init(SHA1_CTX *context)
|
|
202
|
+
static inline void SHA1_Init(SHA1_CTX *context)
|
|
203
203
|
{
|
|
204
204
|
|
|
205
205
|
_DIAGASSERT(context != 0);
|
|
@@ -217,7 +217,7 @@ void SHA1_Init(SHA1_CTX *context)
|
|
|
217
217
|
/*
|
|
218
218
|
* Run your data through this.
|
|
219
219
|
*/
|
|
220
|
-
void SHA1_Update(SHA1_CTX *context, const uint8_t *data, size_t len)
|
|
220
|
+
static inline void SHA1_Update(SHA1_CTX *context, const uint8_t *data, size_t len)
|
|
221
221
|
{
|
|
222
222
|
uint32_t i, j;
|
|
223
223
|
|
|
@@ -244,7 +244,7 @@ void SHA1_Update(SHA1_CTX *context, const uint8_t *data, size_t len)
|
|
|
244
244
|
/*
|
|
245
245
|
* Add padding and return the message digest.
|
|
246
246
|
*/
|
|
247
|
-
void SHA1_Finish(SHA1_CTX* context, uint8_t digest[20])
|
|
247
|
+
static inline void SHA1_Finish(SHA1_CTX* context, uint8_t digest[20])
|
|
248
248
|
{
|
|
249
249
|
size_t i;
|
|
250
250
|
uint8_t finalcount[8];
|
data/ext/fast_hammer/sha1.h
CHANGED
|
@@ -29,10 +29,10 @@ typedef struct {
|
|
|
29
29
|
#define SHA1_Finish rb_Digest_SHA1_Finish
|
|
30
30
|
#endif
|
|
31
31
|
|
|
32
|
-
void SHA1_Transform _((uint32_t state[5], const uint8_t buffer[64]));
|
|
33
|
-
void SHA1_Init _((SHA1_CTX *context));
|
|
34
|
-
void SHA1_Update _((SHA1_CTX *context, const uint8_t *data, size_t len));
|
|
35
|
-
void SHA1_Finish _((SHA1_CTX *context, uint8_t digest[20]));
|
|
32
|
+
static inline void SHA1_Transform _((uint32_t state[5], const uint8_t buffer[64]));
|
|
33
|
+
static inline void SHA1_Init _((SHA1_CTX *context));
|
|
34
|
+
static inline void SHA1_Update _((SHA1_CTX *context, const uint8_t *data, size_t len));
|
|
35
|
+
static inline void SHA1_Finish _((SHA1_CTX *context, uint8_t digest[20]));
|
|
36
36
|
|
|
37
37
|
#define SHA1_BLOCK_LENGTH 64
|
|
38
38
|
#define SHA1_DIGEST_LENGTH 20
|