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 ^ -1) & z);
  61. }
  62.  
  63. /* renamed from: G */
  64. private long m4G(long x, long y, long z) {
  65. return (x & z) | (y & (z ^ -1));
  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 y ^ (x | (z ^ -1));
  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 = a + ((m3F(b, c, d) + x) + ac);
  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 = a + ((m4G(b, c, d) + x) + ac);
  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 = a + ((m5H(b, c, d) + x) + ac);
  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 = a + ((m6I(b, c, d) + x) + ac);
  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. int i2 = inputLen;
  105. byte[] block = new byte[64];
  106. int index = ((int) (this.count[0] >>> 3)) & 63;
  107. long[] jArr = this.count;
  108. long j = jArr[0] + ((long) (i2 << 3));
  109. jArr[0] = j;
  110. if (j < ((long) (i2 << 3))) {
  111. jArr = this.count;
  112. jArr[1] = jArr[1] + 1;
  113. }
  114. jArr = this.count;
  115. jArr[1] = jArr[1] + ((long) (i2 >>> 29));
  116. int partLen = 64 - index;
  117. if (i2 >= partLen) {
  118. syncMemcopy(this.buffer, inbuf, index, 0, partLen);
  119. syncTransform(this.buffer);
  120. int i3 = partLen;
  121. while (true) {
  122. i = i3;
  123. if (i + 63 >= i2) {
  124. break;
  125. }
  126. syncMemcopy(block, inbuf, 0, i, 64);
  127. syncTransform(block);
  128. i3 = i + 64;
  129. }
  130. index = 0;
  131. } else {
  132. i = 0;
  133. }
  134. syncMemcopy(this.buffer, inbuf, index, i, i2 - i);
  135. }
  136.  
  137. private void syncfinal() {
  138. byte[] bits = new byte[8];
  139. Encode(bits, this.count, 8);
  140. int index = ((int) (this.count[0] >>> 3)) & 63;
  141. syncupdate(PADDING, index < 56 ? 56 - index : 120 - index);
  142. syncupdate(bits, 8);
  143. Encode(this.digest, this.state, 16);
  144. }
  145.  
  146. private void syncMemcopy(byte[] output, byte[] input, int outpos, int inpos, int len) {
  147. for (int i = 0; i < len; i++) {
  148. output[outpos + i] = input[inpos + i];
  149. }
  150. }
  151.  
  152. private void syncTransform(byte[] block) {
  153. long a = this.state[0];
  154. long b = this.state[1];
  155. long c = this.state[2];
  156. long d = this.state[3];
  157. long[] x = new long[16];
  158. Decode(x, block, 64);
  159. long[] x2 = x;
  160. a = FF(a, b, c, d, x[0], 7, 3614090360L);
  161. d = FF(d, a, b, c, x2[1], 12, 3905402710L);
  162. c = FF(c, d, a, b, x2[2], 17, 606105819);
  163. b = FF(b, c, d, a, x2[3], 22, 3250441966L);
  164. a = FF(a, b, c, d, x2[4], 7, 4118548399L);
  165. d = FF(d, a, b, c, x2[5], 12, 1200080426);
  166. c = FF(c, d, a, b, x2[6], 17, 2821735955L);
  167. b = FF(b, c, d, a, x2[7], 22, 4249261313L);
  168. a = FF(a, b, c, d, x2[8], 7, 1770035416);
  169. d = FF(d, a, b, c, x2[9], 12, 2336552879L);
  170. c = FF(c, d, a, b, x2[10], 17, 4294925233L);
  171. b = FF(b, c, d, a, x2[11], 22, 2304563134L);
  172. a = FF(a, b, c, d, x2[12], 7, 1804603682);
  173. d = FF(d, a, b, c, x2[13], 12, 4254626195L);
  174. c = FF(c, d, a, b, x2[14], 17, 2792965006L);
  175. b = FF(b, c, d, a, x2[15], 22, 1236535329);
  176. a = GG(a, b, c, d, x2[1], 5, 4129170786L);
  177. d = GG(d, a, b, c, x2[6], 9, 3225465664L);
  178. c = GG(c, d, a, b, x2[11], 14, 643717713);
  179. b = GG(b, c, d, a, x2[0], 20, 3921069994L);
  180. a = GG(a, b, c, d, x2[5], 5, 3593408605L);
  181. d = GG(d, a, b, c, x2[10], 9, 38016083);
  182. c = GG(c, d, a, b, x2[15], 14, 3634488961L);
  183. b = GG(b, c, d, a, x2[4], 20, 3889429448L);
  184. a = GG(a, b, c, d, x2[9], 5, 568446438);
  185. d = GG(d, a, b, c, x2[14], 9, 3275163606L);
  186. c = GG(c, d, a, b, x2[3], 14, 4107603335L);
  187. b = GG(b, c, d, a, x2[8], 20, 1163531501);
  188. a = GG(a, b, c, d, x2[13], 5, 2850285829L);
  189. d = GG(d, a, b, c, x2[2], 9, 4243563512L);
  190. c = GG(c, d, a, b, x2[7], 14, 1735328473);
  191. b = GG(b, c, d, a, x2[12], 20, 2368359562L);
  192. a = HH(a, b, c, d, x2[5], 4, 4294588738L);
  193. d = HH(d, a, b, c, x2[8], 11, 2272392833L);
  194. c = HH(c, d, a, b, x2[11], 16, 1839030562);
  195. b = HH(b, c, d, a, x2[14], 23, 4259657740L);
  196. a = HH(a, b, c, d, x2[1], 4, 2763975236L);
  197. d = HH(d, a, b, c, x2[4], 11, 1272893353);
  198. c = HH(c, d, a, b, x2[7], 16, 4139469664L);
  199. b = HH(b, c, d, a, x2[10], 23, 3200236656L);
  200. a = HH(a, b, c, d, x2[13], 4, 681279174);
  201. d = HH(d, a, b, c, x2[0], 11, 3936430074L);
  202. c = HH(c, d, a, b, x2[3], 16, 3572445317L);
  203. b = HH(b, c, d, a, x2[6], 23, 76029189);
  204. a = HH(a, b, c, d, x2[9], 4, 3654602809L);
  205. d = HH(d, a, b, c, x2[12], 11, 3873151461L);
  206. c = HH(c, d, a, b, x2[15], 16, 530742520);
  207. b = HH(b, c, d, a, x2[2], 23, 3299628645L);
  208. a = II(a, b, c, d, x2[0], 6, 4096336452L);
  209. d = II(d, a, b, c, x2[7], 10, 1126891415);
  210. c = II(c, d, a, b, x2[14], 15, 2878612391L);
  211. b = II(b, c, d, a, x2[5], 21, 4237533241L);
  212. a = II(a, b, c, d, x2[12], 6, 1700485571);
  213. d = II(d, a, b, c, x2[3], 10, 2399980690L);
  214. c = II(c, d, a, b, x2[10], 15, 4293915773L);
  215. b = II(b, c, d, a, x2[1], 21, 2240044497L);
  216. a = II(a, b, c, d, x2[8], 6, 1873313359);
  217. d = II(d, a, b, c, x2[15], 10, 4264355552L);
  218. c = II(c, d, a, b, x2[6], 15, 2734768916L);
  219. b = II(b, c, d, a, x2[13], 21, 1309151649);
  220. a = II(a, b, c, d, x2[4], 6, 4149444226L);
  221. d = II(d, a, b, c, x2[11], 10, 3174756917L);
  222. c = II(c, d, a, b, x2[2], 15, 718787259);
  223. long b2 = II(b, c, d, a, x2[9], 21, 3951481745L);
  224. long[] jArr = this.state;
  225. jArr[0] = jArr[0] + a;
  226. jArr = this.state;
  227. jArr[1] = jArr[1] + b2;
  228. jArr = this.state;
  229. jArr[2] = jArr[2] + c;
  230. jArr = this.state;
  231. jArr[3] = jArr[3] + d;
  232. }
  233.  
  234. private void Encode(byte[] output, long[] input, int len) {
  235. int i = 0;
  236. for (int j = 0; j < len; j += 4) {
  237. output[j] = (byte) ((int) (input[i] & 255));
  238. output[j + 1] = (byte) ((int) ((input[i] >>> 8) & 255));
  239. output[j + 2] = (byte) ((int) ((input[i] >>> 16) & 255));
  240. output[j + 3] = (byte) ((int) ((input[i] >>> 24) & 255));
  241. i++;
  242. }
  243. }
  244.  
  245. private void Decode(long[] output, byte[] input, int len) {
  246. int i = 0;
  247. for (int j = 0; j < len; j += 4) {
  248. output[i] = ((b2iu(input[j]) | (b2iu(input[j + 1]) << 8)) | (b2iu(input[j + 2]) << 16)) | (b2iu(input[j + 3]) << 24);
  249. i++;
  250. }
  251. }
  252.  
  253. public static long b2iu(byte b) {
  254. return b < (byte) 0 ? (long) (b & 255) : (long) b;
  255. }
  256.  
  257. public static String byteHEX(byte ib) {
  258. char[] Digit = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
  259. return new String(new char[]{Digit[(ib >>> 4) & 15], Digit[ib & 15]});
  260. }
  261.  
  262.  
  263. public static boolean syncNow2() {
  264. return true;
  265. }
  266.  
  267. public static void main(String[] args) {
  268. System.out.println(new SyncTask().sync("048181227f19").substring(0, 8).toLowerCase());
  269. }
  270. }
Success #stdin #stdout 0.04s 2184192KB
stdin
Standard input is empty
stdout
4594ed21