144 | 195M | } md5::compress::soft::compress_block Line | Count | Source | 45 | 115M | pub fn compress_block(state: &mut [u32; 4], input: &[u8; 64]) { | 46 | 115M | let mut a = state[0]; | 47 | 115M | let mut b = state[1]; | 48 | 115M | let mut c = state[2]; | 49 | 115M | let mut d = state[3]; | 50 | 115M | | 51 | 115M | let mut data = [0u32; 16]; | 52 | 1.85G | for (o, chunk) in data.iter_mut().zip(input.chunks_exact(4)) { | 53 | 1.85G | *o = u32::from_le_bytes(chunk.try_into().unwrap()); | 54 | 1.85G | } | 55 | | | 56 | | // round 1 | 57 | 115M | a = op_f(a, b, c, d, data[0], RC[0], 7); | 58 | 115M | d = op_f(d, a, b, c, data[1], RC[1], 12); | 59 | 115M | c = op_f(c, d, a, b, data[2], RC[2], 17); | 60 | 115M | b = op_f(b, c, d, a, data[3], RC[3], 22); | 61 | 115M | | 62 | 115M | a = op_f(a, b, c, d, data[4], RC[4], 7); | 63 | 115M | d = op_f(d, a, b, c, data[5], RC[5], 12); | 64 | 115M | c = op_f(c, d, a, b, data[6], RC[6], 17); | 65 | 115M | b = op_f(b, c, d, a, data[7], RC[7], 22); | 66 | 115M | | 67 | 115M | a = op_f(a, b, c, d, data[8], RC[8], 7); | 68 | 115M | d = op_f(d, a, b, c, data[9], RC[9], 12); | 69 | 115M | c = op_f(c, d, a, b, data[10], RC[10], 17); | 70 | 115M | b = op_f(b, c, d, a, data[11], RC[11], 22); | 71 | 115M | | 72 | 115M | a = op_f(a, b, c, d, data[12], RC[12], 7); | 73 | 115M | d = op_f(d, a, b, c, data[13], RC[13], 12); | 74 | 115M | c = op_f(c, d, a, b, data[14], RC[14], 17); | 75 | 115M | b = op_f(b, c, d, a, data[15], RC[15], 22); | 76 | 115M | | 77 | 115M | // round 2 | 78 | 115M | a = op_g(a, b, c, d, data[1], RC[16], 5); | 79 | 115M | d = op_g(d, a, b, c, data[6], RC[17], 9); | 80 | 115M | c = op_g(c, d, a, b, data[11], RC[18], 14); | 81 | 115M | b = op_g(b, c, d, a, data[0], RC[19], 20); | 82 | 115M | | 83 | 115M | a = op_g(a, b, c, d, data[5], RC[20], 5); | 84 | 115M | d = op_g(d, a, b, c, data[10], RC[21], 9); | 85 | 115M | c = op_g(c, d, a, b, data[15], RC[22], 14); | 86 | 115M | b = op_g(b, c, d, a, data[4], RC[23], 20); | 87 | 115M | | 88 | 115M | a = op_g(a, b, c, d, data[9], RC[24], 5); | 89 | 115M | d = op_g(d, a, b, c, data[14], RC[25], 9); | 90 | 115M | c = op_g(c, d, a, b, data[3], RC[26], 14); | 91 | 115M | b = op_g(b, c, d, a, data[8], RC[27], 20); | 92 | 115M | | 93 | 115M | a = op_g(a, b, c, d, data[13], RC[28], 5); | 94 | 115M | d = op_g(d, a, b, c, data[2], RC[29], 9); | 95 | 115M | c = op_g(c, d, a, b, data[7], RC[30], 14); | 96 | 115M | b = op_g(b, c, d, a, data[12], RC[31], 20); | 97 | 115M | | 98 | 115M | // round 3 | 99 | 115M | a = op_h(a, b, c, d, data[5], RC[32], 4); | 100 | 115M | d = op_h(d, a, b, c, data[8], RC[33], 11); | 101 | 115M | c = op_h(c, d, a, b, data[11], RC[34], 16); | 102 | 115M | b = op_h(b, c, d, a, data[14], RC[35], 23); | 103 | 115M | | 104 | 115M | a = op_h(a, b, c, d, data[1], RC[36], 4); | 105 | 115M | d = op_h(d, a, b, c, data[4], RC[37], 11); | 106 | 115M | c = op_h(c, d, a, b, data[7], RC[38], 16); | 107 | 115M | b = op_h(b, c, d, a, data[10], RC[39], 23); | 108 | 115M | | 109 | 115M | a = op_h(a, b, c, d, data[13], RC[40], 4); | 110 | 115M | d = op_h(d, a, b, c, data[0], RC[41], 11); | 111 | 115M | c = op_h(c, d, a, b, data[3], RC[42], 16); | 112 | 115M | b = op_h(b, c, d, a, data[6], RC[43], 23); | 113 | 115M | | 114 | 115M | a = op_h(a, b, c, d, data[9], RC[44], 4); | 115 | 115M | d = op_h(d, a, b, c, data[12], RC[45], 11); | 116 | 115M | c = op_h(c, d, a, b, data[15], RC[46], 16); | 117 | 115M | b = op_h(b, c, d, a, data[2], RC[47], 23); | 118 | 115M | | 119 | 115M | // round 4 | 120 | 115M | a = op_i(a, b, c, d, data[0], RC[48], 6); | 121 | 115M | d = op_i(d, a, b, c, data[7], RC[49], 10); | 122 | 115M | c = op_i(c, d, a, b, data[14], RC[50], 15); | 123 | 115M | b = op_i(b, c, d, a, data[5], RC[51], 21); | 124 | 115M | | 125 | 115M | a = op_i(a, b, c, d, data[12], RC[52], 6); | 126 | 115M | d = op_i(d, a, b, c, data[3], RC[53], 10); | 127 | 115M | c = op_i(c, d, a, b, data[10], RC[54], 15); | 128 | 115M | b = op_i(b, c, d, a, data[1], RC[55], 21); | 129 | 115M | | 130 | 115M | a = op_i(a, b, c, d, data[8], RC[56], 6); | 131 | 115M | d = op_i(d, a, b, c, data[15], RC[57], 10); | 132 | 115M | c = op_i(c, d, a, b, data[6], RC[58], 15); | 133 | 115M | b = op_i(b, c, d, a, data[13], RC[59], 21); | 134 | 115M | | 135 | 115M | a = op_i(a, b, c, d, data[4], RC[60], 6); | 136 | 115M | d = op_i(d, a, b, c, data[11], RC[61], 10); | 137 | 115M | c = op_i(c, d, a, b, data[2], RC[62], 15); | 138 | 115M | b = op_i(b, c, d, a, data[9], RC[63], 21); | 139 | 115M | | 140 | 115M | state[0] = state[0].wrapping_add(a); | 141 | 115M | state[1] = state[1].wrapping_add(b); | 142 | 115M | state[2] = state[2].wrapping_add(c); | 143 | 115M | state[3] = state[3].wrapping_add(d); | 144 | 115M | } |
md5::compress::soft::compress_block Line | Count | Source | 45 | 80.2M | pub fn compress_block(state: &mut [u32; 4], input: &[u8; 64]) { | 46 | 80.2M | let mut a = state[0]; | 47 | 80.2M | let mut b = state[1]; | 48 | 80.2M | let mut c = state[2]; | 49 | 80.2M | let mut d = state[3]; | 50 | 80.2M | | 51 | 80.2M | let mut data = [0u32; 16]; | 52 | 1.28G | for (o, chunk) in data.iter_mut().zip(input.chunks_exact(4)) { | 53 | 1.28G | *o = u32::from_le_bytes(chunk.try_into().unwrap()); | 54 | 1.28G | } | 55 | | | 56 | | // round 1 | 57 | 80.2M | a = op_f(a, b, c, d, data[0], RC[0], 7); | 58 | 80.2M | d = op_f(d, a, b, c, data[1], RC[1], 12); | 59 | 80.2M | c = op_f(c, d, a, b, data[2], RC[2], 17); | 60 | 80.2M | b = op_f(b, c, d, a, data[3], RC[3], 22); | 61 | 80.2M | | 62 | 80.2M | a = op_f(a, b, c, d, data[4], RC[4], 7); | 63 | 80.2M | d = op_f(d, a, b, c, data[5], RC[5], 12); | 64 | 80.2M | c = op_f(c, d, a, b, data[6], RC[6], 17); | 65 | 80.2M | b = op_f(b, c, d, a, data[7], RC[7], 22); | 66 | 80.2M | | 67 | 80.2M | a = op_f(a, b, c, d, data[8], RC[8], 7); | 68 | 80.2M | d = op_f(d, a, b, c, data[9], RC[9], 12); | 69 | 80.2M | c = op_f(c, d, a, b, data[10], RC[10], 17); | 70 | 80.2M | b = op_f(b, c, d, a, data[11], RC[11], 22); | 71 | 80.2M | | 72 | 80.2M | a = op_f(a, b, c, d, data[12], RC[12], 7); | 73 | 80.2M | d = op_f(d, a, b, c, data[13], RC[13], 12); | 74 | 80.2M | c = op_f(c, d, a, b, data[14], RC[14], 17); | 75 | 80.2M | b = op_f(b, c, d, a, data[15], RC[15], 22); | 76 | 80.2M | | 77 | 80.2M | // round 2 | 78 | 80.2M | a = op_g(a, b, c, d, data[1], RC[16], 5); | 79 | 80.2M | d = op_g(d, a, b, c, data[6], RC[17], 9); | 80 | 80.2M | c = op_g(c, d, a, b, data[11], RC[18], 14); | 81 | 80.2M | b = op_g(b, c, d, a, data[0], RC[19], 20); | 82 | 80.2M | | 83 | 80.2M | a = op_g(a, b, c, d, data[5], RC[20], 5); | 84 | 80.2M | d = op_g(d, a, b, c, data[10], RC[21], 9); | 85 | 80.2M | c = op_g(c, d, a, b, data[15], RC[22], 14); | 86 | 80.2M | b = op_g(b, c, d, a, data[4], RC[23], 20); | 87 | 80.2M | | 88 | 80.2M | a = op_g(a, b, c, d, data[9], RC[24], 5); | 89 | 80.2M | d = op_g(d, a, b, c, data[14], RC[25], 9); | 90 | 80.2M | c = op_g(c, d, a, b, data[3], RC[26], 14); | 91 | 80.2M | b = op_g(b, c, d, a, data[8], RC[27], 20); | 92 | 80.2M | | 93 | 80.2M | a = op_g(a, b, c, d, data[13], RC[28], 5); | 94 | 80.2M | d = op_g(d, a, b, c, data[2], RC[29], 9); | 95 | 80.2M | c = op_g(c, d, a, b, data[7], RC[30], 14); | 96 | 80.2M | b = op_g(b, c, d, a, data[12], RC[31], 20); | 97 | 80.2M | | 98 | 80.2M | // round 3 | 99 | 80.2M | a = op_h(a, b, c, d, data[5], RC[32], 4); | 100 | 80.2M | d = op_h(d, a, b, c, data[8], RC[33], 11); | 101 | 80.2M | c = op_h(c, d, a, b, data[11], RC[34], 16); | 102 | 80.2M | b = op_h(b, c, d, a, data[14], RC[35], 23); | 103 | 80.2M | | 104 | 80.2M | a = op_h(a, b, c, d, data[1], RC[36], 4); | 105 | 80.2M | d = op_h(d, a, b, c, data[4], RC[37], 11); | 106 | 80.2M | c = op_h(c, d, a, b, data[7], RC[38], 16); | 107 | 80.2M | b = op_h(b, c, d, a, data[10], RC[39], 23); | 108 | 80.2M | | 109 | 80.2M | a = op_h(a, b, c, d, data[13], RC[40], 4); | 110 | 80.2M | d = op_h(d, a, b, c, data[0], RC[41], 11); | 111 | 80.2M | c = op_h(c, d, a, b, data[3], RC[42], 16); | 112 | 80.2M | b = op_h(b, c, d, a, data[6], RC[43], 23); | 113 | 80.2M | | 114 | 80.2M | a = op_h(a, b, c, d, data[9], RC[44], 4); | 115 | 80.2M | d = op_h(d, a, b, c, data[12], RC[45], 11); | 116 | 80.2M | c = op_h(c, d, a, b, data[15], RC[46], 16); | 117 | 80.2M | b = op_h(b, c, d, a, data[2], RC[47], 23); | 118 | 80.2M | | 119 | 80.2M | // round 4 | 120 | 80.2M | a = op_i(a, b, c, d, data[0], RC[48], 6); | 121 | 80.2M | d = op_i(d, a, b, c, data[7], RC[49], 10); | 122 | 80.2M | c = op_i(c, d, a, b, data[14], RC[50], 15); | 123 | 80.2M | b = op_i(b, c, d, a, data[5], RC[51], 21); | 124 | 80.2M | | 125 | 80.2M | a = op_i(a, b, c, d, data[12], RC[52], 6); | 126 | 80.2M | d = op_i(d, a, b, c, data[3], RC[53], 10); | 127 | 80.2M | c = op_i(c, d, a, b, data[10], RC[54], 15); | 128 | 80.2M | b = op_i(b, c, d, a, data[1], RC[55], 21); | 129 | 80.2M | | 130 | 80.2M | a = op_i(a, b, c, d, data[8], RC[56], 6); | 131 | 80.2M | d = op_i(d, a, b, c, data[15], RC[57], 10); | 132 | 80.2M | c = op_i(c, d, a, b, data[6], RC[58], 15); | 133 | 80.2M | b = op_i(b, c, d, a, data[13], RC[59], 21); | 134 | 80.2M | | 135 | 80.2M | a = op_i(a, b, c, d, data[4], RC[60], 6); | 136 | 80.2M | d = op_i(d, a, b, c, data[11], RC[61], 10); | 137 | 80.2M | c = op_i(c, d, a, b, data[2], RC[62], 15); | 138 | 80.2M | b = op_i(b, c, d, a, data[9], RC[63], 21); | 139 | 80.2M | | 140 | 80.2M | state[0] = state[0].wrapping_add(a); | 141 | 80.2M | state[1] = state[1].wrapping_add(b); | 142 | 80.2M | state[2] = state[2].wrapping_add(c); | 143 | 80.2M | state[3] = state[3].wrapping_add(d); | 144 | 80.2M | } |
|