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

Method sm4Lt

src/com/autoDecoder/util/SM4.java:99–112  ·  view source on GitHub ↗
(long ka)

Source from the content-addressed store, hash-verified

97 }
98
99 private long sm4Lt(long ka) {
100 long bb = 0L;
101 long c = 0L;
102 byte[] a = new byte[4];
103 byte[] b = new byte[4];
104 PUT_ULONG_BE(ka, a, 0);
105 b[0] = sm4Sbox(a[0]);
106 b[1] = sm4Sbox(a[1]);
107 b[2] = sm4Sbox(a[2]);
108 b[3] = sm4Sbox(a[3]);
109 bb = GET_ULONG_BE(b, 0);
110 c = bb ^ ROTL(bb, 2) ^ ROTL(bb, 10) ^ ROTL(bb, 18) ^ ROTL(bb, 24);
111 return c;
112 }
113
114 private long sm4F(long x0, long x1, long x2, long x3, long rk) {
115 return x0 ^ sm4Lt(x1 ^ x2 ^ x3 ^ rk);

Callers 1

sm4FMethod · 0.95

Calls 4

PUT_ULONG_BEMethod · 0.95
sm4SboxMethod · 0.95
GET_ULONG_BEMethod · 0.95
ROTLMethod · 0.95

Tested by

no test coverage detected