ext/iodine/fio.c
/**
Writes data to the sha1 buffer.
*/
Writes data to the sha1 buffer.
Writes data to the sha1 buffer .
void fio_sha1_write(fio_sha1_s *s, const void *data, size_t len) {
  size_t in_buffer = s->length & 63;
  size_t partial = 64 - in_buffer;
  s->length += len;
  if (partial > len) {
    memcpy(s->buffer + in_buffer, data, len);
    return;
  }
  if (in_buffer) {
    memcpy(s->buffer + in_buffer, data, partial);
    len -= partial;
    data = (void *)((uintptr_t)data + partial);
    fio_sha1_perform_all_rounds(s, s->buffer);
  }
  while (len >= 64) {
    fio_sha1_perform_all_rounds(s, data);
    data = (void *)((uintptr_t)data + 64);
    len -= 64;
  }
  if (len) {
    memcpy(s->buffer + in_buffer, data, len);
  }
  return;
}
void fio_sha1_write ( fio_sha1_s * s , const void * data , size_t len ) { size_t in_buffer = s -> length & 63 ; size_t partial = 64 - in_buffer ; s -> length += len ; if ( partial > len ) { memcpy ( s -> buffer + in_buffer , data , len ) ; return ; } if ( in_buffer ) { memcpy ( s -> buffer + in_buffer , data , partial ) ; len -= partial ; data = ( void * ) ( ( uintptr_t ) data + partial ) ; fio_sha1_perform_all_rounds ( s , s -> buffer ) ; } while ( len >= 64 ) { fio_sha1_perform_all_rounds ( s , data ) ; data = ( void * ) ( ( uintptr_t ) data + 64 ) ; len -= 64 ; } if ( len ) { memcpy ( s -> buffer + in_buffer , data , len ) ; } return ; }
Writes data to the sha1 buffer.
Writes data to the sha1 buffer .