Java Code Examples for org.telegram.tgnet.TLRPC#TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow

The following examples show how to use org.telegram.tgnet.TLRPC#TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SRPHelper.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public static BigInteger getV(byte[] passwordBytes, TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) {
    BigInteger g = BigInteger.valueOf(algo.g);
    byte[] g_bytes = getBigIntegerBytes(g);
    BigInteger p = new BigInteger(1, algo.p);

    byte[] x_bytes = getX(passwordBytes, algo);
    BigInteger x = new BigInteger(1, x_bytes);
    return g.modPow(x, p);
}
 
Example 2
Source File: TwoStepVerificationSetupActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
protected TLRPC.TL_inputCheckPasswordSRP getNewSrpPassword() {
    if (currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
        TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo = (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) currentPassword.current_algo;
        return SRPHelper.startCheck(currentPasswordHash, currentPassword.srp_id, currentPassword.srp_B, algo);
    }
    return null;
}
 
Example 3
Source File: TwoStepVerificationActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
protected TLRPC.TL_inputCheckPasswordSRP getNewSrpPassword() {
    if (currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
        TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo = (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) currentPassword.current_algo;
        return SRPHelper.startCheck(currentPasswordHash, currentPassword.srp_id, currentPassword.srp_B, algo);
    }
    return null;
}
 
Example 4
Source File: SRPHelper.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public static BigInteger getV(byte[] passwordBytes, TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) {
    BigInteger g = BigInteger.valueOf(algo.g);
    byte[] g_bytes = getBigIntegerBytes(g);
    BigInteger p = new BigInteger(1, algo.p);

    byte[] x_bytes = getX(passwordBytes, algo);
    BigInteger x = new BigInteger(1, x_bytes);
    return g.modPow(x, p);
}
 
Example 5
Source File: TwoStepVerificationSetupActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
protected TLRPC.TL_inputCheckPasswordSRP getNewSrpPassword() {
    if (currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
        TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo = (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) currentPassword.current_algo;
        return SRPHelper.startCheck(currentPasswordHash, currentPassword.srp_id, currentPassword.srp_B, algo);
    }
    return null;
}
 
Example 6
Source File: TwoStepVerificationActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
protected TLRPC.TL_inputCheckPasswordSRP getNewSrpPassword() {
    if (currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
        TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo = (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) currentPassword.current_algo;
        return SRPHelper.startCheck(currentPasswordHash, currentPassword.srp_id, currentPassword.srp_B, algo);
    }
    return null;
}
 
Example 7
Source File: TwoStepVerificationActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private TLRPC.TL_inputCheckPasswordSRP getNewSrpPassword() {
    if (currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
        TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo = (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) currentPassword.current_algo;
        return SRPHelper.startCheck(currentPasswordHash, currentPassword.srp_id, currentPassword.srp_B, algo);
    }
    return null;
}
 
Example 8
Source File: SRPHelper.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public static BigInteger getV(byte[] passwordBytes, TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) {
    BigInteger g = BigInteger.valueOf(algo.g);
    byte[] g_bytes = getBigIntegerBytes(g);
    BigInteger p = new BigInteger(1, algo.p);

    byte[] x_bytes = getX(passwordBytes, algo);
    BigInteger x = new BigInteger(1, x_bytes);
    return g.modPow(x, p);
}
 
Example 9
Source File: TwoStepVerificationActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private TLRPC.TL_inputCheckPasswordSRP getNewSrpPassword() {
    if (currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
        TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo = (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) currentPassword.current_algo;
        return SRPHelper.startCheck(currentPasswordHash, currentPassword.srp_id, currentPassword.srp_B, algo);
    }
    return null;
}
 
Example 10
Source File: SRPHelper.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public static BigInteger getV(byte[] passwordBytes, TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) {
    BigInteger g = BigInteger.valueOf(algo.g);
    byte[] g_bytes = getBigIntegerBytes(g);
    BigInteger p = new BigInteger(1, algo.p);

    byte[] x_bytes = getX(passwordBytes, algo);
    BigInteger x = new BigInteger(1, x_bytes);
    return g.modPow(x, p);
}
 
Example 11
Source File: SRPHelper.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public static byte[] getVBytes(byte[] passwordBytes, TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) {
    if (!Utilities.isGoodPrime(algo.p, algo.g)) {
        return null;
    }
    return getBigIntegerBytes(getV(passwordBytes, algo));
}
 
Example 12
Source File: SRPHelper.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public static byte[] getX(byte[] passwordBytes, TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) {
    byte[] x_bytes = Utilities.computeSHA256(algo.salt1, passwordBytes, algo.salt1);
    x_bytes = Utilities.computeSHA256(algo.salt2, x_bytes, algo.salt2);
    x_bytes = Utilities.computePBKDF2(x_bytes, algo.salt1);
    return Utilities.computeSHA256(algo.salt2, x_bytes, algo.salt2);
}
 
Example 13
Source File: SRPHelper.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public static byte[] getX(byte[] passwordBytes, TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) {
    byte[] x_bytes = Utilities.computeSHA256(algo.salt1, passwordBytes, algo.salt1);
    x_bytes = Utilities.computeSHA256(algo.salt2, x_bytes, algo.salt2);
    x_bytes = Utilities.computePBKDF2(x_bytes, algo.salt1);
    return Utilities.computeSHA256(algo.salt2, x_bytes, algo.salt2);
}
 
Example 14
Source File: SRPHelper.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public static byte[] getVBytes(byte[] passwordBytes, TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) {
    if (!Utilities.isGoodPrime(algo.p, algo.g)) {
        return null;
    }
    return getBigIntegerBytes(getV(passwordBytes, algo));
}
 
Example 15
Source File: SRPHelper.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public static byte[] getX(byte[] passwordBytes, TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) {
    byte[] x_bytes = Utilities.computeSHA256(algo.salt1, passwordBytes, algo.salt1);
    x_bytes = Utilities.computeSHA256(algo.salt2, x_bytes, algo.salt2);
    x_bytes = Utilities.computePBKDF2(x_bytes, algo.salt1);
    return Utilities.computeSHA256(algo.salt2, x_bytes, algo.salt2);
}
 
Example 16
Source File: SRPHelper.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public static byte[] getX(byte[] passwordBytes, TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) {
    byte[] x_bytes = Utilities.computeSHA256(algo.salt1, passwordBytes, algo.salt1);
    x_bytes = Utilities.computeSHA256(algo.salt2, x_bytes, algo.salt2);
    x_bytes = Utilities.computePBKDF2(x_bytes, algo.salt1);
    return Utilities.computeSHA256(algo.salt2, x_bytes, algo.salt2);
}
 
Example 17
Source File: SRPHelper.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public static byte[] getVBytes(byte[] passwordBytes, TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) {
    if (!Utilities.isGoodPrime(algo.p, algo.g)) {
        return null;
    }
    return getBigIntegerBytes(getV(passwordBytes, algo));
}
 
Example 18
Source File: SRPHelper.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public static byte[] getVBytes(byte[] passwordBytes, TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) {
    if (!Utilities.isGoodPrime(algo.p, algo.g)) {
        return null;
    }
    return getBigIntegerBytes(getV(passwordBytes, algo));
}