Changeset 4459:552ec493bac9 in roaraudio
- Timestamp:
- 10/10/10 06:26:23 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/hash_tiger.c
r4458 r4459 622 622 return 0; 623 623 624 len = state->blocks * BLOCK_LEN + state->inlen; 624 len = state->blocks * BLOCK_LEN + state->inlen; 625 len *= 8; // byte -> bit 625 626 626 627 if ( state->inlen < 56 ) { /* enough room */ … … 714 715 uint64_t a, b, c, aa, bb, cc; 715 716 uint64_t x[8]; 717 718 ROAR_DBG("roar_hash_tiger_proc_block(state=%p, block=%p) = ?", state, block); 716 719 717 720 if ( state == NULL || block == NULL ) … … 757 760 state->c = c + cc; 758 761 762 state->blocks++; 763 764 ROAR_DBG("roar_hash_tiger_proc_block(state=%p, block=%p) = 0", state, block); 759 765 return 0; 760 766 } … … 764 770 } 765 771 766 int roar_hash_tiger_proc(struct roar_hash_tiger * state, void * data, size_t len); 772 int roar_hash_tiger_proc(struct roar_hash_tiger * state, void * data, size_t len) { 773 size_t needlen; 774 775 ROAR_DBG("roar_hash_tiger_proc(state=%p, data=%p, len=%llu) = ?", state, data, (long long unsigned int)len); 776 777 if ( state == NULL ) 778 return -1; 779 780 if ( len == 0 ) 781 return 0; 782 783 if ( data == NULL ) 784 return -1; 785 786 if ( state->inlen ) { 787 needlen = BLOCK_LEN - state->inlen; 788 ROAR_DBG("roar_hash_tiger_proc(state=%p, ...): adding %llu byte to inbuf block", state, (long long unsigned int)needlen); 789 790 if ( len < needlen ) { 791 ROAR_DBG("roar_hash_tiger_proc(state=%p, ...): inbufblock is short", state); 792 memcpy(state->inbuf + state->inlen, data, len); 793 state->inlen += len; 794 ROAR_DBG("roar_hash_tiger_proc(state=%p, ...) = 0", state); 795 return 0; 796 } 797 798 memcpy(state->inbuf + state->inlen, data, needlen); 799 len -= needlen; 800 data += needlen; 801 802 state->inlen = 0; 803 804 if ( roar_hash_tiger_proc_block(state, state->inbuf) == -1 ) 805 return -1; 806 } 807 808 for (; len >= BLOCK_LEN; ) { 809 ROAR_DBG("roar_hash_tiger_proc(state=%p, ...): running normal block...", state); 810 811 if ( roar_hash_tiger_proc_block(state, data) == -1 ) 812 return -1; 813 814 len -= BLOCK_LEN; 815 data += BLOCK_LEN; 816 } 817 818 if ( len ) { 819 ROAR_DBG("roar_hash_tiger_proc(state=%p, ...): adding %llu byte to new inbuf", state, (long long unsigned int)len); 820 memcpy(state->inbuf, data, len); 821 state->inlen = len; 822 } 823 824 ROAR_DBG("roar_hash_tiger_proc(state=%p, ...) = 0", state); 825 return 0; 826 } 767 827 768 828 //ll
Note: See TracChangeset
for help on using the changeset viewer.