Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.99 KB | None | 0 0
  1.  
  2. import java.math.BigInteger;
  3. import sign.signlink;
  4.  
  5. public final class Stream extends NodeSub {
  6.  
  7. public static Stream create() {
  8. synchronized(nodeList) {
  9. Stream stream = null;
  10. if(anInt1412 > 0) {
  11. anInt1412--;
  12. stream = (Stream) nodeList.popHead();
  13. }
  14. if(stream != null) {
  15. stream.currentOffset = 0;
  16. return stream;
  17. }
  18. }
  19. Stream stream_1 = new Stream();
  20. stream_1.currentOffset = 0;
  21. stream_1.buffer = new byte[5000];
  22. return stream_1;
  23. }
  24.  
  25. private Stream() {
  26. }
  27.  
  28. public Stream(byte abyte0[]) {
  29. buffer = abyte0;
  30. currentOffset = 0;
  31. }
  32.  
  33. public void createFrame(int i) {
  34. buffer[currentOffset++] = (byte)(i + encryption.getNextKey());
  35. }
  36.  
  37. public void writeWordBigEndian(int i) {
  38. buffer[currentOffset++] = (byte)i;
  39. }
  40.  
  41. public int readUSmart2()
  42. {
  43. int baseVal = 0;
  44. int lastVal = 0;
  45. while ((lastVal = method422()) == 32767) {
  46. baseVal += 32767;
  47. }
  48. return baseVal + lastVal;
  49. }
  50.  
  51. public String readNewString()
  52. {
  53. int i = currentOffset;
  54. while(buffer[currentOffset++] != 0) ;
  55. return new String(buffer, i, currentOffset - i - 1);
  56. }
  57.  
  58. public void writeWord(int i) {
  59. buffer[currentOffset++] = (byte)(i >> 8);
  60. buffer[currentOffset++] = (byte)i;
  61. }
  62.  
  63. public void method400(int i) {
  64. buffer[currentOffset++] = (byte)i;
  65. buffer[currentOffset++] = (byte)(i >> 8);
  66. }
  67.  
  68. public void writeDWordBigEndian(int i) {
  69. buffer[currentOffset++] = (byte)(i >> 16);
  70. buffer[currentOffset++] = (byte)(i >> 8);
  71. buffer[currentOffset++] = (byte)i;
  72. }
  73.  
  74. public void writeDWord(int i) {
  75. buffer[currentOffset++] = (byte)(i >> 24);
  76. buffer[currentOffset++] = (byte)(i >> 16);
  77. buffer[currentOffset++] = (byte)(i >> 8);
  78. buffer[currentOffset++] = (byte)i;
  79. }
  80.  
  81. public void method403(int j) {
  82. buffer[currentOffset++] = (byte)j;
  83. buffer[currentOffset++] = (byte)(j >> 8);
  84. buffer[currentOffset++] = (byte)(j >> 16);
  85. buffer[currentOffset++] = (byte)(j >> 24);
  86. }
  87.  
  88. public void writeQWord(long l) {
  89. try {
  90. buffer[currentOffset++] = (byte)(int)(l >> 56);
  91. buffer[currentOffset++] = (byte)(int)(l >> 48);
  92. buffer[currentOffset++] = (byte)(int)(l >> 40);
  93. buffer[currentOffset++] = (byte)(int)(l >> 32);
  94. buffer[currentOffset++] = (byte)(int)(l >> 24);
  95. buffer[currentOffset++] = (byte)(int)(l >> 16);
  96. buffer[currentOffset++] = (byte)(int)(l >> 8);
  97. buffer[currentOffset++] = (byte)(int)l;
  98. } catch(RuntimeException runtimeexception) {
  99. signlink.reporterror("14395, " + 5 + ", " + l + ", " + runtimeexception.toString());
  100. throw new RuntimeException();
  101. }
  102. }
  103.  
  104. public void writeString(String s) {
  105. //s.getBytes(0, s.length(), buffer, currentOffset); //deprecated
  106. System.arraycopy(s.getBytes(), 0, buffer, currentOffset, s.length());
  107. currentOffset += s.length();
  108. buffer[currentOffset++] = 10;
  109. }
  110.  
  111. public void writeBytes(byte abyte0[], int i, int j) {
  112. for(int k = j; k < j + i; k++)
  113. buffer[currentOffset++] = abyte0[k];
  114. }
  115.  
  116. public void writeByte(int i)
  117. {
  118. buffer[currentOffset++] = (byte)i;
  119. }
  120.  
  121. public void writeBytes(int i) {
  122. buffer[currentOffset - i - 1] = (byte)i;
  123. }
  124.  
  125. public int readUnsignedByte() {
  126. return buffer[currentOffset++] & 0xff;
  127. }
  128.  
  129. public byte readSignedByte() {
  130. return buffer[currentOffset++];
  131. }
  132.  
  133. public int readUnsignedWord() {
  134. currentOffset += 2;
  135. return ((buffer[currentOffset - 2] & 0xff) << 8) + (buffer[currentOffset - 1] & 0xff);
  136. }
  137.  
  138. public int readSignedWord() {
  139. currentOffset += 2;
  140. int i = ((buffer[currentOffset - 2] & 0xff) << 8) + (buffer[currentOffset - 1] & 0xff);
  141. if(i > 32767)
  142. i -= 0x10000;
  143. return i;
  144. }
  145.  
  146. public int read3Bytes() {
  147. currentOffset += 3;
  148. return ((buffer[currentOffset - 3] & 0xff) << 16) + ((buffer[currentOffset - 2] & 0xff) << 8) + (buffer[currentOffset - 1] & 0xff);
  149. }
  150.  
  151. public int readDWord() {
  152. currentOffset += 4;
  153. return ((buffer[currentOffset - 4] & 0xff) << 24) + ((buffer[currentOffset - 3] & 0xff) << 16) + ((buffer[currentOffset - 2] & 0xff) << 8) + (buffer[currentOffset - 1] & 0xff);
  154. }
  155.  
  156. public long readQWord() {
  157. long l = (long) readDWord() & 0xffffffffL;
  158. long l1 = (long) readDWord() & 0xffffffffL;
  159. return (l << 32) + l1;
  160. }
  161.  
  162. public String readString() {
  163. int i = currentOffset;
  164. while(buffer[currentOffset++] != 10) ;
  165. return new String(buffer, i, currentOffset - i - 1);
  166. }
  167.  
  168. public byte[] readBytes() {
  169. int i = currentOffset;
  170. while(buffer[currentOffset++] != 10) ;
  171. byte abyte0[] = new byte[currentOffset - i - 1];
  172. System.arraycopy(buffer, i, abyte0, i - i, currentOffset - 1 - i);
  173. return abyte0;
  174. }
  175.  
  176. public void readBytes(int i, int j, byte abyte0[]) {
  177. for(int l = j; l < j + i; l++)
  178. abyte0[l] = buffer[currentOffset++];
  179. }
  180.  
  181. public void initBitAccess() {
  182. bitPosition = currentOffset * 8;
  183. }
  184.  
  185. public int readBits(int i) {
  186. int k = bitPosition >> 3;
  187. int l = 8 - (bitPosition & 7);
  188. int i1 = 0;
  189. bitPosition += i;
  190. for(; i > l; l = 8)
  191. {
  192. i1 += (buffer[k++] & anIntArray1409[l]) << i - l;
  193. i -= l;
  194. }
  195. if(i == l)
  196. i1 += buffer[k] & anIntArray1409[l];
  197. else
  198. i1 += buffer[k] >> l - i & anIntArray1409[i];
  199. return i1;
  200. }
  201.  
  202. public void finishBitAccess() {
  203. currentOffset = (bitPosition + 7) / 8;
  204. }
  205.  
  206. public int method421() {
  207. int i = buffer[currentOffset] & 0xff;
  208. if(i < 128)
  209. return readUnsignedByte() - 64;
  210. else
  211. return readUnsignedWord() - 49152;
  212. }
  213.  
  214. public int method422() {
  215. int i = buffer[currentOffset] & 0xff;
  216. if(i < 128)
  217. return readUnsignedByte();
  218. else
  219. return readUnsignedWord() - 32768;
  220. }
  221.  
  222. public void doKeys() {
  223. int i = currentOffset;
  224. currentOffset = 0;
  225. byte abyte0[] = new byte[i];
  226. readBytes(i, 0, abyte0);
  227. BigInteger biginteger2 = new BigInteger(abyte0);
  228. BigInteger biginteger3 = biginteger2/*.modPow(biginteger, biginteger1)*/;
  229. byte abyte1[] = biginteger3.toByteArray();
  230. currentOffset = 0;
  231. writeWordBigEndian(abyte1.length);
  232. writeBytes(abyte1, abyte1.length, 0);
  233. }
  234.  
  235. public void method424(int i) {
  236. buffer[currentOffset++] = (byte)(-i);
  237. }
  238.  
  239. public void method425(int j) {
  240. buffer[currentOffset++] = (byte)(128 - j);
  241. }
  242.  
  243. public int method426() {
  244. return buffer[currentOffset++] - 128 & 0xff;
  245. }
  246.  
  247. public int method427() {
  248. return -buffer[currentOffset++] & 0xff;
  249. }
  250.  
  251. public int method428() {
  252. return 128 - buffer[currentOffset++] & 0xff;
  253. }
  254.  
  255. public byte method429() {
  256. return (byte)(-buffer[currentOffset++]);
  257. }
  258.  
  259. public byte method430() {
  260. return (byte)(128 - buffer[currentOffset++]);
  261. }
  262.  
  263. public void method431(int i) {
  264. buffer[currentOffset++] = (byte)i;
  265. buffer[currentOffset++] = (byte)(i >> 8);
  266. }
  267.  
  268. public void method432(int j) {
  269. buffer[currentOffset++] = (byte)(j >> 8);
  270. buffer[currentOffset++] = (byte)(j + 128);
  271. }
  272.  
  273. public void method433(int j) {
  274. buffer[currentOffset++] = (byte)(j + 128);
  275. buffer[currentOffset++] = (byte)(j >> 8);
  276. }
  277.  
  278. public int method434() {
  279. currentOffset += 2;
  280. return ((buffer[currentOffset - 1] & 0xff) << 8) + (buffer[currentOffset - 2] & 0xff);
  281. }
  282.  
  283. public int method435() {
  284. currentOffset += 2;
  285. return ((buffer[currentOffset - 2] & 0xff) << 8) + (buffer[currentOffset - 1] - 128 & 0xff);
  286. }
  287.  
  288. public int method436() {
  289. currentOffset += 2;
  290. return ((buffer[currentOffset - 1] & 0xff) << 8) + (buffer[currentOffset - 2] - 128 & 0xff);
  291. }
  292.  
  293. public int method437() {
  294. currentOffset += 2;
  295. int j = ((buffer[currentOffset - 1] & 0xff) << 8) + (buffer[currentOffset - 2] & 0xff);
  296. if(j > 32767)
  297. j -= 0x10000;
  298. return j;
  299. }
  300.  
  301. public int method438() {
  302. currentOffset += 2;
  303. int j = ((buffer[currentOffset - 1] & 0xff) << 8) + (buffer[currentOffset - 2] - 128 & 0xff);
  304. if(j > 32767)
  305. j -= 0x10000;
  306. return j;
  307. }
  308.  
  309. public int method439() {
  310. currentOffset += 4;
  311. return ((buffer[currentOffset - 2] & 0xff) << 24) + ((buffer[currentOffset - 1] & 0xff) << 16) + ((buffer[currentOffset - 4] & 0xff) << 8) + (buffer[currentOffset - 3] & 0xff);
  312. }
  313.  
  314. public int method440() {
  315. currentOffset += 4;
  316. return ((buffer[currentOffset - 3] & 0xff) << 24) + ((buffer[currentOffset - 4] & 0xff) << 16) + ((buffer[currentOffset - 1] & 0xff) << 8) + (buffer[currentOffset - 2] & 0xff);
  317. }
  318.  
  319. public void method441(int i, byte abyte0[], int j) {
  320. for(int k = (i + j) - 1; k >= i; k--)
  321. buffer[currentOffset++] = (byte)(abyte0[k] + 128);
  322.  
  323. }
  324.  
  325. public void method442(int i, int j, byte abyte0[]) {
  326. for(int k = (j + i) - 1; k >= j; k--)
  327. abyte0[k] = buffer[currentOffset++];
  328.  
  329. }
  330.  
  331. public byte buffer[];
  332. public int currentOffset;
  333. public int bitPosition;
  334. private static final int[] anIntArray1409 = {
  335. 0, 1, 3, 7, 15, 31, 63, 127, 255, 511,
  336. 1023, 2047, 4095, 8191, 16383, 32767, 65535, 0x1ffff, 0x3ffff, 0x7ffff,
  337. 0xfffff, 0x1fffff, 0x3fffff, 0x7fffff, 0xffffff, 0x1ffffff, 0x3ffffff, 0x7ffffff, 0xfffffff, 0x1fffffff,
  338. 0x3fffffff, 0x7fffffff, -1
  339. };
  340. public ISAACRandomGen encryption;
  341. private static int anInt1412;
  342. private static final NodeList nodeList = new NodeList();
  343. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement