fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. class SyncTask {
  8. static final byte[] PADDING = new byte[]{Byte.MIN_VALUE, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0};
  9. static final int S11 = 7;
  10. static final int S12 = 12;
  11. static final int S13 = 17;
  12. static final int S14 = 22;
  13. static final int S21 = 5;
  14. static final int S22 = 9;
  15. static final int S23 = 14;
  16. static final int S24 = 20;
  17. static final int S31 = 4;
  18. static final int S32 = 11;
  19. static final int S33 = 16;
  20. static final int S34 = 23;
  21. static final int S41 = 6;
  22. static final int S42 = 10;
  23. static final int S43 = 15;
  24. static final int S44 = 21;
  25. private byte[] buffer = new byte[64];
  26. private long[] count = new long[2];
  27. private byte[] digest = new byte[16];
  28. public String digestHexStr;
  29. private long[] state = new long[4];
  30.  
  31. public String sync(String inbuf) {
  32. syncinit();
  33. syncupdate(inbuf.getBytes(), inbuf.length());
  34. syncfinal();
  35. this.digestHexStr = "";
  36. for (int i = 0; i < 16; i++) {
  37. StringBuilder stringBuilder = new StringBuilder();
  38. stringBuilder.append(this.digestHexStr);
  39. stringBuilder.append(byteHEX(this.digest[i]));
  40. this.digestHexStr = stringBuilder.toString();
  41. }
  42. return this.digestHexStr;
  43. }
  44.  
  45. public void compute() {
  46. syncinit();
  47. }
  48.  
  49. private void syncinit() {
  50. this.count[0] = 0;
  51. this.count[1] = 0;
  52. this.state[0] = 1665475329;
  53. this.state[1] = 4023233417L;
  54. this.state[2] = 2561989886L;
  55. this.state[3] = 271733878;
  56. }
  57.  
  58. /* renamed from: F */
  59. private long m3F(long x, long y, long z) {
  60. return (x & y) | ((~x) & z);
  61. }
  62.  
  63. /* renamed from: G */
  64. private long m4G(long x, long y, long z) {
  65. return (x & z) | ((~z) & y);
  66. }
  67.  
  68. /* renamed from: H */
  69. private long m5H(long x, long y, long z) {
  70. return (x ^ y) ^ z;
  71. }
  72.  
  73. /* renamed from: I */
  74. private long m6I(long x, long y, long z) {
  75. return ((~z) | x) ^ y;
  76. }
  77.  
  78. private long FF(long a, long b, long c, long d, long x, long s, long ac) {
  79. long j = s;
  80. long a2 = ((m3F(b, c, d) + x) + ac) + a;
  81. return ((long) ((((int) a2) << ((int) j)) | (((int) a2) >>> ((int) (32 - j))))) + b;
  82. }
  83.  
  84. private long GG(long a, long b, long c, long d, long x, long s, long ac) {
  85. long j = s;
  86. long a2 = ((m4G(b, c, d) + x) + ac) + a;
  87. return ((long) ((((int) a2) << ((int) j)) | (((int) a2) >>> ((int) (32 - j))))) + b;
  88. }
  89.  
  90. private long HH(long a, long b, long c, long d, long x, long s, long ac) {
  91. long j = s;
  92. long a2 = ((m5H(b, c, d) + x) + ac) + a;
  93. return ((long) ((((int) a2) << ((int) j)) | (((int) a2) >>> ((int) (32 - j))))) + b;
  94. }
  95.  
  96. private long II(long a, long b, long c, long d, long x, long s, long ac) {
  97. long j = s;
  98. long a2 = ((m6I(b, c, d) + x) + ac) + a;
  99. return ((long) ((((int) a2) << ((int) j)) | (((int) a2) >>> ((int) (32 - j))))) + b;
  100. }
  101.  
  102. private void syncupdate(byte[] inbuf, int inputLen) {
  103. int i;
  104. byte[] block = new byte[64];
  105. int index = ((int) (this.count[0] >>> 3)) & 63;
  106. long[] jArr = this.count;
  107. long j = jArr[0] + ((long) (inputLen << 3));
  108. jArr[0] = j;
  109. if (j < ((long) (inputLen << 3))) {
  110. jArr = this.count;
  111. jArr[1] = jArr[1] + 1;
  112. }
  113. jArr = this.count;
  114. jArr[1] = jArr[1] + ((long) (inputLen >>> 29));
  115. int partLen = 64 - index;
  116. if (inputLen >= partLen) {
  117. syncMemcopy(this.buffer, inbuf, index, 0, partLen);
  118. syncTransform(this.buffer);
  119. int i2 = partLen;
  120. while (true) {
  121. i = i2;
  122. if (i + 63 >= inputLen) {
  123. break;
  124. }
  125. syncMemcopy(block, inbuf, 0, i, 64);
  126. syncTransform(block);
  127. i2 = i + 64;
  128. }
  129. index = 0;
  130. } else {
  131. i = 0;
  132. }
  133. syncMemcopy(this.buffer, inbuf, index, i, inputLen - i);
  134. }
  135.  
  136. private void syncfinal() {
  137. byte[] bits = new byte[8];
  138. Encode(bits, this.count, 8);
  139. int index = ((int) (this.count[0] >>> 3)) & 63;
  140. syncupdate(PADDING, index < 56 ? 56 - index : 120 - index);
  141. syncupdate(bits, 8);
  142. Encode(this.digest, this.state, 16);
  143. }
  144.  
  145. private void syncMemcopy(byte[] output, byte[] input, int outpos, int inpos, int len) {
  146. for (int i = 0; i < len; i++) {
  147. output[outpos + i] = input[inpos + i];
  148. }
  149. }
  150.  
  151. private void syncTransform(byte[] block) {
  152. long a = this.state[0];
  153. long b = this.state[1];
  154. long c = this.state[2];
  155. long d = this.state[3];
  156. long[] x = new long[16];
  157. Decode(x, block, 64);
  158. long[] x2 = x;
  159. a = FF(a, b, c, d, x[0], 7, 3614090360L);
  160. d = FF(d, a, b, c, x2[1], 12, 3905402710L);
  161. c = FF(c, d, a, b, x2[2], 17, 606105819);
  162. b = FF(b, c, d, a, x2[3], 22, 3250441966L);
  163. a = FF(a, b, c, d, x2[4], 7, 4118548399L);
  164. d = FF(d, a, b, c, x2[5], 12, 1200080426);
  165. c = FF(c, d, a, b, x2[6], 17, 2821735955L);
  166. b = FF(b, c, d, a, x2[7], 22, 4249261313L);
  167. a = FF(a, b, c, d, x2[8], 7, 1770035416);
  168. d = FF(d, a, b, c, x2[9], 12, 2336552879L);
  169. c = FF(c, d, a, b, x2[10], 17, 4294925233L);
  170. b = FF(b, c, d, a, x2[11], 22, 2304563134L);
  171. a = FF(a, b, c, d, x2[12], 7, 1804603682);
  172. d = FF(d, a, b, c, x2[13], 12, 4254626195L);
  173. c = FF(c, d, a, b, x2[14], 17, 2792965006L);
  174. b = FF(b, c, d, a, x2[15], 22, 1236535329);
  175. a = GG(a, b, c, d, x2[1], 5, 4129170786L);
  176. d = GG(d, a, b, c, x2[6], 9, 3225465664L);
  177. c = GG(c, d, a, b, x2[11], 14, 643717713);
  178. b = GG(b, c, d, a, x2[0], 20, 3921069994L);
  179. a = GG(a, b, c, d, x2[5], 5, 3593408605L);
  180. d = GG(d, a, b, c, x2[10], 9, 38016083);
  181. c = GG(c, d, a, b, x2[15], 14, 3634488961L);
  182. b = GG(b, c, d, a, x2[4], 20, 3889429448L);
  183. a = GG(a, b, c, d, x2[9], 5, 568446438);
  184. d = GG(d, a, b, c, x2[14], 9, 3275163606L);
  185. c = GG(c, d, a, b, x2[3], 14, 4107603335L);
  186. b = GG(b, c, d, a, x2[8], 20, 1163531501);
  187. a = GG(a, b, c, d, x2[13], 5, 2850285829L);
  188. d = GG(d, a, b, c, x2[2], 9, 4243563512L);
  189. c = GG(c, d, a, b, x2[7], 14, 1735328473);
  190. b = GG(b, c, d, a, x2[12], 20, 2368359562L);
  191. a = HH(a, b, c, d, x2[5], 4, 4294588738L);
  192. d = HH(d, a, b, c, x2[8], 11, 2272392833L);
  193. c = HH(c, d, a, b, x2[11], 16, 1839030562);
  194. b = HH(b, c, d, a, x2[14], 23, 4259657740L);
  195. a = HH(a, b, c, d, x2[1], 4, 2763975236L);
  196. d = HH(d, a, b, c, x2[4], 11, 1272893353);
  197. c = HH(c, d, a, b, x2[7], 16, 4139469664L);
  198. b = HH(b, c, d, a, x2[10], 23, 3200236656L);
  199. a = HH(a, b, c, d, x2[13], 4, 681279174);
  200. d = HH(d, a, b, c, x2[0], 11, 3936430074L);
  201. c = HH(c, d, a, b, x2[3], 16, 3572445317L);
  202. b = HH(b, c, d, a, x2[6], 23, 76029189);
  203. a = HH(a, b, c, d, x2[9], 4, 3654602809L);
  204. d = HH(d, a, b, c, x2[12], 11, 3873151461L);
  205. c = HH(c, d, a, b, x2[15], 16, 530742520);
  206. b = HH(b, c, d, a, x2[2], 23, 3299628645L);
  207. a = II(a, b, c, d, x2[0], 6, 4096336452L);
  208. d = II(d, a, b, c, x2[7], 10, 1126891415);
  209. c = II(c, d, a, b, x2[14], 15, 2878612391L);
  210. b = II(b, c, d, a, x2[5], 21, 4237533241L);
  211. a = II(a, b, c, d, x2[12], 6, 1700485571);
  212. d = II(d, a, b, c, x2[3], 10, 2399980690L);
  213. c = II(c, d, a, b, x2[10], 15, 4293915773L);
  214. b = II(b, c, d, a, x2[1], 21, 2240044497L);
  215. a = II(a, b, c, d, x2[8], 6, 1873313359);
  216. d = II(d, a, b, c, x2[15], 10, 4264355552L);
  217. c = II(c, d, a, b, x2[6], 15, 2734768916L);
  218. b = II(b, c, d, a, x2[13], 21, 1309151649);
  219. a = II(a, b, c, d, x2[4], 6, 4149444226L);
  220. d = II(d, a, b, c, x2[11], 10, 3174756917L);
  221. c = II(c, d, a, b, x2[2], 15, 718787259);
  222. long b2 = II(b, c, d, a, x2[9], 21, 3951481745L);
  223. long[] jArr = this.state;
  224. jArr[0] = jArr[0] + a;
  225. jArr = this.state;
  226. jArr[1] = jArr[1] + b2;
  227. jArr = this.state;
  228. jArr[2] = jArr[2] + c;
  229. jArr = this.state;
  230. jArr[3] = jArr[3] + d;
  231. }
  232.  
  233. private void Encode(byte[] output, long[] input, int len) {
  234. int i = 0;
  235. for (int j = 0; j < len; j += 4) {
  236. output[j] = (byte) ((int) (input[i] & 255));
  237. output[j + 1] = (byte) ((int) ((input[i] >>> 8) & 255));
  238. output[j + 2] = (byte) ((int) ((input[i] >>> 16) & 255));
  239. output[j + 3] = (byte) ((int) ((input[i] >>> 24) & 255));
  240. i++;
  241. }
  242. }
  243.  
  244. private void Decode(long[] output, byte[] input, int len) {
  245. int i = 0;
  246. for (int j = 0; j < len; j += 4) {
  247. output[i] = ((b2iu(input[j]) | (b2iu(input[j + 1]) << 8)) | (b2iu(input[j + 2]) << 16)) | (b2iu(input[j + 3]) << 24);
  248. i++;
  249. }
  250. }
  251.  
  252. public static long b2iu(byte b) {
  253. return b < (byte) 0 ? (long) (b & 255) : (long) b;
  254. }
  255.  
  256. public static String byteHEX(byte ib) {
  257. char[] Digit = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
  258. return new String(new char[]{Digit[(ib >>> 4) & 15], Digit[ib & 15]});
  259. }
  260.  
  261.  
  262. public static void main(String[] args) {
  263. System.out.println(new SyncTask().sync("06:61:90:22:0а:0с").substring(0, 8).toLowerCase());
  264. }
  265. }
Success #stdin #stdout 0.05s 2184192KB
stdin
Standard input is empty
stdout
03189b27