MCPcopy Create free account
hub / github.com/f0ng/autoDecoder / sm4_one_round

Method sm4_one_round

src/com/autoDecoder/util/SM4.java:151–166  ·  view source on GitHub ↗
(long[] sk, byte[] input, byte[] output)

Source from the content-addressed store, hash-verified

149 }
150
151 private void sm4_one_round(long[] sk, byte[] input, byte[] output) {
152 int i = 0;
153 long[] ulbuf = new long[36];
154 ulbuf[0] = GET_ULONG_BE(input, 0);
155 ulbuf[1] = GET_ULONG_BE(input, 4);
156 ulbuf[2] = GET_ULONG_BE(input, 8);
157 ulbuf[3] = GET_ULONG_BE(input, 12);
158 while (i < 32) {
159 ulbuf[(i + 4)] = sm4F(ulbuf[i], ulbuf[(i + 1)], ulbuf[(i + 2)], ulbuf[(i + 3)], sk[i]);
160 i++;
161 }
162 PUT_ULONG_BE(ulbuf[35], output, 0);
163 PUT_ULONG_BE(ulbuf[34], output, 4);
164 PUT_ULONG_BE(ulbuf[33], output, 8);
165 PUT_ULONG_BE(ulbuf[32], output, 12);
166 }
167 //修改了填充模式,为模式
168 private byte[] padding(byte[] input, int mode) {
169 if (input == null) {

Callers 2

sm4_crypt_ecbMethod · 0.95
sm4_crypt_cbcMethod · 0.95

Calls 3

GET_ULONG_BEMethod · 0.95
sm4FMethod · 0.95
PUT_ULONG_BEMethod · 0.95

Tested by

no test coverage detected