Revision f522310b libavutil/sha1.c
libavutil/sha1.c | ||
---|---|---|
34 | 34 |
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) |
35 | 35 |
|
36 | 36 |
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ |
37 |
#define blk0(i) (block[i] = be2me_32(((uint32_t*)buffer)[i])) |
|
37 |
#define blk0(i) (block[i] = be2me_32(((const uint32_t*)buffer)[i]))
|
|
38 | 38 |
#define blk(i) (block[i] = rol(block[i-3]^block[i-8]^block[i-14]^block[i-16],1)) |
39 | 39 |
|
40 | 40 |
#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y) +blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); |
... | ... | |
45 | 45 |
|
46 | 46 |
/* Hash a single 512-bit block. This is the core of the algorithm. */ |
47 | 47 |
|
48 |
static void transform(uint32_t state[5], uint8_t buffer[64]){ |
|
48 |
static void transform(uint32_t state[5], const uint8_t buffer[64]){
|
|
49 | 49 |
uint32_t block[80]; |
50 | 50 |
unsigned int i, a, b, c, d, e; |
51 | 51 |
|
... | ... | |
105 | 105 |
ctx->count = 0; |
106 | 106 |
} |
107 | 107 |
|
108 |
void av_sha1_update(AVSHA1* ctx, uint8_t* data, unsigned int len){ |
|
108 |
void av_sha1_update(AVSHA1* ctx, const uint8_t* data, unsigned int len){
|
|
109 | 109 |
unsigned int i, j; |
110 | 110 |
|
111 | 111 |
j = ctx->count & 63; |
Also available in: Unified diff