32 uint32_t x00 = input[0], x01 = input[1], x02 = input[2], x03 = input[3], x04 = input[4], x05 = input[5],
33 x06 = input[6], x07 = input[7], x08 = input[8], x09 = input[9], x10 = input[10], x11 = input[11],
34 x12 = input[12], x13 = input[13], x14 = input[14], x15 = input[15];
36 for(
size_t i = 0; i != 10; ++i) {
37 salsa20_quarter_round(x00, x04, x08, x12);
38 salsa20_quarter_round(x05, x09, x13, x01);
39 salsa20_quarter_round(x10, x14, x02, x06);
40 salsa20_quarter_round(x15, x03, x07, x11);
42 salsa20_quarter_round(x00, x01, x02, x03);
43 salsa20_quarter_round(x05, x06, x07, x04);
44 salsa20_quarter_round(x10, x11, x08, x09);
45 salsa20_quarter_round(x15, x12, x13, x14);
65 uint32_t x00 = input[0], x01 = input[1], x02 = input[2], x03 = input[3], x04 = input[4], x05 = input[5],
66 x06 = input[6], x07 = input[7], x08 = input[8], x09 = input[9], x10 = input[10], x11 = input[11],
67 x12 = input[12], x13 = input[13], x14 = input[14], x15 = input[15];
69 for(
size_t i = 0; i != rounds / 2; ++i) {
70 salsa20_quarter_round(x00, x04, x08, x12);
71 salsa20_quarter_round(x05, x09, x13, x01);
72 salsa20_quarter_round(x10, x14, x02, x06);
73 salsa20_quarter_round(x15, x03, x07, x11);
75 salsa20_quarter_round(x00, x01, x02, x03);
76 salsa20_quarter_round(x05, x06, x07, x04);
77 salsa20_quarter_round(x10, x11, x08, x09);
78 salsa20_quarter_round(x15, x12, x13, x14);
81 store_le(x00 + input[0], output + 4 * 0);
82 store_le(x01 + input[1], output + 4 * 1);
83 store_le(x02 + input[2], output + 4 * 2);
84 store_le(x03 + input[3], output + 4 * 3);
85 store_le(x04 + input[4], output + 4 * 4);
86 store_le(x05 + input[5], output + 4 * 5);
87 store_le(x06 + input[6], output + 4 * 6);
88 store_le(x07 + input[7], output + 4 * 7);
89 store_le(x08 + input[8], output + 4 * 8);
90 store_le(x09 + input[9], output + 4 * 9);
91 store_le(x10 + input[10], output + 4 * 10);
92 store_le(x11 + input[11], output + 4 * 11);
93 store_le(x12 + input[12], output + 4 * 12);
94 store_le(x13 + input[13], output + 4 * 13);
95 store_le(x14 + input[14], output + 4 * 14);
96 store_le(x15 + input[15], output + 4 * 15);
105 while(length >= m_buffer.size() - m_position) {
106 const size_t available = m_buffer.size() - m_position;
108 xor_buf(out, in, &m_buffer[m_position], available);
109 salsa_core(m_buffer.data(), m_state.data(), 20);
112 m_state[9] += (m_state[8] == 0);
121 xor_buf(out, in, &m_buffer[m_position], length);
123 m_position += length;