@Test public void testHashPassword() { assertEquals("invalid hashed password", "25280520", hashPassword("12345", "603356072")); assertEquals("invalid hashed password", "119537670", hashPassword("12345", "410501656")); assertEquals("invalid hashed password", "537331200", hashPassword("12345", "523781130")); assertEquals("invalid hashed password", "4269684735", hashPassword("12345", "630292165")); assertEquals("invalid hashed password", "4294049715", hashPassword("12345", "771219008")); assertEquals("invalid hashed password", "4288646655", hashPassword("12345", "461695564")); assertEquals("invalid hashed password", "268665345", hashPassword("12345", "864771381")); }
static String hashPassword(String password, String nonce) { long msr = 0x7FFFFFFFL; long m_1 = 0xFFFFFFFFL; long m_8 = 0xFFFFFFF8L; long m_16 = 0xFFFFFFF0L; long m_128 = 0xFFFFFF80L; long m_16777216 = 0XFF000000L; boolean length = true; boolean flag = true; long num1 = 0L; long num2 = 0L; for (char c : nonce.toCharArray()) { num1 = num1 & m_1; num2 = num2 & m_1; switch (c) { case '1': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & m_128; num1 = num1 >> 1; num1 = num1 & msr; num1 = num1 >> 6; num2 = num2 << 25; num1 = num1 + num2; flag = false; break; case '2': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & m_16; num1 = num1 >> 1; num1 = num1 & msr; num1 = num1 >> 3; num2 = num2 << 28; num1 = num1 + num2; flag = false; break; case '3': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & m_8; num1 = num1 >> 1; num1 = num1 & msr; num1 = num1 >> 2; num2 = num2 << 29; num1 = num1 + num2; flag = false; break; case '4': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 << 1; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 30; num1 = num1 + num2; flag = false; break; case '5': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 << 5; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 26; num1 = num1 + num2; flag = false; break; case '6': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 << 12; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 19; num1 = num1 + num2; flag = false; break; case '7': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & 0xFF00; num1 = num1 + ((num2 & 0xFF) << 24); num1 = num1 + ((num2 & 0xFF0000) >> 16); num2 = num2 & m_16777216; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 7; num1 = num1 + num2; flag = false; break; case '8': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & 0xFFFF; num1 = num1 << 16; long numx = num2 >> 1; numx = numx & msr; numx = numx >> 23; num1 = num1 + numx; num2 = num2 & 0xFF0000; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 7; num1 = num1 + num2; flag = false; break; case '9': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = ~num2; flag = false; break; default: num1 = num2; break; } num2 = num1; } return String.valueOf(num1 & m_1); }
OpenWebNetObservable { static String hashPassword(String password, String nonce) { long msr = 0x7FFFFFFFL; long m_1 = 0xFFFFFFFFL; long m_8 = 0xFFFFFFF8L; long m_16 = 0xFFFFFFF0L; long m_128 = 0xFFFFFF80L; long m_16777216 = 0XFF000000L; boolean length = true; boolean flag = true; long num1 = 0L; long num2 = 0L; for (char c : nonce.toCharArray()) { num1 = num1 & m_1; num2 = num2 & m_1; switch (c) { case '1': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & m_128; num1 = num1 >> 1; num1 = num1 & msr; num1 = num1 >> 6; num2 = num2 << 25; num1 = num1 + num2; flag = false; break; case '2': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & m_16; num1 = num1 >> 1; num1 = num1 & msr; num1 = num1 >> 3; num2 = num2 << 28; num1 = num1 + num2; flag = false; break; case '3': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & m_8; num1 = num1 >> 1; num1 = num1 & msr; num1 = num1 >> 2; num2 = num2 << 29; num1 = num1 + num2; flag = false; break; case '4': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 << 1; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 30; num1 = num1 + num2; flag = false; break; case '5': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 << 5; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 26; num1 = num1 + num2; flag = false; break; case '6': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 << 12; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 19; num1 = num1 + num2; flag = false; break; case '7': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & 0xFF00; num1 = num1 + ((num2 & 0xFF) << 24); num1 = num1 + ((num2 & 0xFF0000) >> 16); num2 = num2 & m_16777216; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 7; num1 = num1 + num2; flag = false; break; case '8': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & 0xFFFF; num1 = num1 << 16; long numx = num2 >> 1; numx = numx & msr; numx = numx >> 23; num1 = num1 + numx; num2 = num2 & 0xFF0000; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 7; num1 = num1 + num2; flag = false; break; case '9': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = ~num2; flag = false; break; default: num1 = num2; break; } num2 = num1; } return String.valueOf(num1 & m_1); } }
OpenWebNetObservable { static String hashPassword(String password, String nonce) { long msr = 0x7FFFFFFFL; long m_1 = 0xFFFFFFFFL; long m_8 = 0xFFFFFFF8L; long m_16 = 0xFFFFFFF0L; long m_128 = 0xFFFFFF80L; long m_16777216 = 0XFF000000L; boolean length = true; boolean flag = true; long num1 = 0L; long num2 = 0L; for (char c : nonce.toCharArray()) { num1 = num1 & m_1; num2 = num2 & m_1; switch (c) { case '1': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & m_128; num1 = num1 >> 1; num1 = num1 & msr; num1 = num1 >> 6; num2 = num2 << 25; num1 = num1 + num2; flag = false; break; case '2': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & m_16; num1 = num1 >> 1; num1 = num1 & msr; num1 = num1 >> 3; num2 = num2 << 28; num1 = num1 + num2; flag = false; break; case '3': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & m_8; num1 = num1 >> 1; num1 = num1 & msr; num1 = num1 >> 2; num2 = num2 << 29; num1 = num1 + num2; flag = false; break; case '4': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 << 1; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 30; num1 = num1 + num2; flag = false; break; case '5': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 << 5; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 26; num1 = num1 + num2; flag = false; break; case '6': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 << 12; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 19; num1 = num1 + num2; flag = false; break; case '7': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & 0xFF00; num1 = num1 + ((num2 & 0xFF) << 24); num1 = num1 + ((num2 & 0xFF0000) >> 16); num2 = num2 & m_16777216; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 7; num1 = num1 + num2; flag = false; break; case '8': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & 0xFFFF; num1 = num1 << 16; long numx = num2 >> 1; numx = numx & msr; numx = numx >> 23; num1 = num1 + numx; num2 = num2 & 0xFF0000; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 7; num1 = num1 + num2; flag = false; break; case '9': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = ~num2; flag = false; break; default: num1 = num2; break; } num2 = num1; } return String.valueOf(num1 & m_1); } private  OpenWebNetObservable(); }
OpenWebNetObservable { static String hashPassword(String password, String nonce) { long msr = 0x7FFFFFFFL; long m_1 = 0xFFFFFFFFL; long m_8 = 0xFFFFFFF8L; long m_16 = 0xFFFFFFF0L; long m_128 = 0xFFFFFF80L; long m_16777216 = 0XFF000000L; boolean length = true; boolean flag = true; long num1 = 0L; long num2 = 0L; for (char c : nonce.toCharArray()) { num1 = num1 & m_1; num2 = num2 & m_1; switch (c) { case '1': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & m_128; num1 = num1 >> 1; num1 = num1 & msr; num1 = num1 >> 6; num2 = num2 << 25; num1 = num1 + num2; flag = false; break; case '2': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & m_16; num1 = num1 >> 1; num1 = num1 & msr; num1 = num1 >> 3; num2 = num2 << 28; num1 = num1 + num2; flag = false; break; case '3': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & m_8; num1 = num1 >> 1; num1 = num1 & msr; num1 = num1 >> 2; num2 = num2 << 29; num1 = num1 + num2; flag = false; break; case '4': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 << 1; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 30; num1 = num1 + num2; flag = false; break; case '5': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 << 5; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 26; num1 = num1 + num2; flag = false; break; case '6': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 << 12; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 19; num1 = num1 + num2; flag = false; break; case '7': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & 0xFF00; num1 = num1 + ((num2 & 0xFF) << 24); num1 = num1 + ((num2 & 0xFF0000) >> 16); num2 = num2 & m_16777216; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 7; num1 = num1 + num2; flag = false; break; case '8': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & 0xFFFF; num1 = num1 << 16; long numx = num2 >> 1; numx = numx & msr; numx = numx >> 23; num1 = num1 + numx; num2 = num2 & 0xFF0000; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 7; num1 = num1 + num2; flag = false; break; case '9': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = ~num2; flag = false; break; default: num1 = num2; break; } num2 = num1; } return String.valueOf(num1 & m_1); } private  OpenWebNetObservable();  }
OpenWebNetObservable { static String hashPassword(String password, String nonce) { long msr = 0x7FFFFFFFL; long m_1 = 0xFFFFFFFFL; long m_8 = 0xFFFFFFF8L; long m_16 = 0xFFFFFFF0L; long m_128 = 0xFFFFFF80L; long m_16777216 = 0XFF000000L; boolean length = true; boolean flag = true; long num1 = 0L; long num2 = 0L; for (char c : nonce.toCharArray()) { num1 = num1 & m_1; num2 = num2 & m_1; switch (c) { case '1': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & m_128; num1 = num1 >> 1; num1 = num1 & msr; num1 = num1 >> 6; num2 = num2 << 25; num1 = num1 + num2; flag = false; break; case '2': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & m_16; num1 = num1 >> 1; num1 = num1 & msr; num1 = num1 >> 3; num2 = num2 << 28; num1 = num1 + num2; flag = false; break; case '3': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & m_8; num1 = num1 >> 1; num1 = num1 & msr; num1 = num1 >> 2; num2 = num2 << 29; num1 = num1 + num2; flag = false; break; case '4': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 << 1; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 30; num1 = num1 + num2; flag = false; break; case '5': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 << 5; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 26; num1 = num1 + num2; flag = false; break; case '6': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 << 12; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 19; num1 = num1 + num2; flag = false; break; case '7': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & 0xFF00; num1 = num1 + ((num2 & 0xFF) << 24); num1 = num1 + ((num2 & 0xFF0000) >> 16); num2 = num2 & m_16777216; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 7; num1 = num1 + num2; flag = false; break; case '8': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = num2 & 0xFFFF; num1 = num1 << 16; long numx = num2 >> 1; numx = numx & msr; numx = numx >> 23; num1 = num1 + numx; num2 = num2 & 0xFF0000; num2 = num2 >> 1; num2 = num2 & msr; num2 = num2 >> 7; num1 = num1 + num2; flag = false; break; case '9': length = !flag; if (!length) { num2 = Long.parseLong(password); } num1 = ~num2; flag = false; break; default: num1 = num2; break; } num2 = num1; } return String.valueOf(num1 & m_1); } private  OpenWebNetObservable();   }