Revision 2c6361e0

View differences:

libavutil/sha1.c
29 29
    uint64_t count;       ///< number of bytes in buffer
30 30
    uint8_t  buffer[64];  ///< 512-bit buffer of input values used in hash updating
31 31
    uint32_t state[8];    ///< current hash value
32
    /** function used to update hash for 512-bit input block */
33
    void     (*transform)(uint32_t *state, const uint8_t buffer[64]);
32 34
} AVSHA1;
33 35

  
34 36
const int av_sha1_size = sizeof(AVSHA1);
......
132 134
    ctx->state[2] = 0x98BADCFE;
133 135
    ctx->state[3] = 0x10325476;
134 136
    ctx->state[4] = 0xC3D2E1F0;
137
    ctx->transform = transform;
135 138
    ctx->count    = 0;
136 139
}
137 140

  
......
145 148
    for (i = 0; i < len; i++) {
146 149
        ctx->buffer[j++] = data[i];
147 150
        if (64 == j) {
148
            transform(ctx->state, ctx->buffer);
151
            ctx->transform(ctx->state, ctx->buffer);
149 152
            j = 0;
150 153
        }
151 154
    }
152 155
#else
153 156
    if ((j + len) > 63) {
154 157
        memcpy(&ctx->buffer[j], data, (i = 64 - j));
155
        transform(ctx->state, ctx->buffer);
158
        ctx->transform(ctx->state, ctx->buffer);
156 159
        for (; i + 63 < len; i += 64)
157
            transform(ctx->state, &data[i]);
160
            ctx->transform(ctx->state, &data[i]);
158 161
        j = 0;
159 162
    } else
160 163
        i = 0;

Also available in: Unified diff