Examples of HashAlgorithm


Examples of net.spy.memcached.HashAlgorithm

                    + jsonObject, e);
        }
    }

    private HashAlgorithm lookupHashAlgorithm(String algorithm) {
        HashAlgorithm ha = HashAlgorithm.NATIVE_HASH;
        if ("crc".equalsIgnoreCase(algorithm)) {
            ha = HashAlgorithm.CRC32_HASH;
        } else if ("fnv1_32".equalsIgnoreCase(algorithm)) {
            ha = HashAlgorithm.FNV1_32_HASH;
        } else if ("fnv1_64".equalsIgnoreCase(algorithm)) {
View Full Code Here

Examples of net.spy.memcached.HashAlgorithm

    }

  /* ep is for ep-engine, a.k.a. membase */
    private Config parseEpJSON(JSONObject jsonObject) throws JSONException {

        HashAlgorithm hashAlgorithm = lookupHashAlgorithm(jsonObject.getString("hashAlgorithm"));
        int replicasCount = jsonObject.getInt("numReplicas");
        if (replicasCount > VBucket.MAX_REPLICAS) {
            throw new ConfigParsingException("Expected number <= "
                    + VBucket.MAX_REPLICAS + " for replicas.");
        }
View Full Code Here

Examples of net.spy.memcached.HashAlgorithm

    throws JSONException {
    final JSONObject vBucketServerMap =
      source.getJSONObject("vBucketServerMap");

    final String algorithm = vBucketServerMap.getString("hashAlgorithm");
    HashAlgorithm hashAlgorithm =
      HashAlgorithmRegistry.lookupHashAlgorithm(algorithm);
    if (hashAlgorithm == null) {
      throw new IllegalArgumentException("Unhandled hash algorithm type: "
          + algorithm);
    }
View Full Code Here

Examples of net.spy.memcached.HashAlgorithm

    throws JSONException {
    final JSONObject vBucketServerMap =
      source.getJSONObject("vBucketServerMap");

    final String algorithm = vBucketServerMap.getString("hashAlgorithm");
    HashAlgorithm hashAlgorithm =
      HashAlgorithmRegistry.lookupHashAlgorithm(algorithm);
    if (hashAlgorithm == null) {
      throw new IllegalArgumentException("Unhandled hash algorithm type: "
          + algorithm);
    }
View Full Code Here

Examples of org.apache.poi.poifs.crypt.HashAlgorithm

            throw new EncryptedDocumentException(e);
        }
    }
   
    protected static SecretKey generateSecretKey(String password, EncryptionVerifier ver, int keySize) {
        HashAlgorithm hashAlgo = ver.getHashAlgorithm();

        byte pwHash[] = hashPassword(password, hashAlgo, ver.getSalt(), ver.getSpinCount());

        byte[] blockKey = new byte[4];
        LittleEndian.putInt(blockKey, 0, 0);
View Full Code Here

Examples of org.apache.poi.poifs.crypt.HashAlgorithm

        byte salt[] = safeGetDocumentProtection().getSalt();
        BigInteger spinCount = safeGetDocumentProtection().getCryptSpinCount();
       
        if (sid == null || hash == null || salt == null || spinCount == null) return false;
       
        HashAlgorithm hashAlgo;
        switch (sid.intValue()) {
        case 1: hashAlgo = HashAlgorithm.md2; break;
        case 2: hashAlgo = HashAlgorithm.md4; break;
        case 3: hashAlgo = HashAlgorithm.md5; break;
        case 4: hashAlgo = HashAlgorithm.sha1; break;
View Full Code Here

Examples of org.apache.poi.poifs.crypt.HashAlgorithm

            throw new EncryptedDocumentException("Unsupported chaining mode - "+keyData.getCipherChaining().toString());
        }
   
        int hashSize = keyData.getHashSize();
       
        HashAlgorithm ha = HashAlgorithm.fromEcmaId(keyData.getHashAlgorithm().toString());
        setHashAlgorithm(ha);

        if (getHashAlgorithmEx().hashSize != hashSize) {
            throw new EncryptedDocumentException("Unsupported hash algorithm: " +
                    keyData.getHashAlgorithm() + " @ " + hashSize + " bytes");
View Full Code Here

Examples of org.apache.poi.poifs.crypt.HashAlgorithm

  public void confirmPassword(String password, byte keySpec[], byte keySalt[], byte verifier[], byte verifierSalt[], byte integritySalt[]) {
        AgileEncryptionVerifier ver = builder.getVerifier();
        ver.setSalt(verifierSalt);
        AgileEncryptionHeader header = builder.getHeader();
        header.setKeySalt(keySalt);
        HashAlgorithm hashAlgo = ver.getHashAlgorithm();

        int blockSize = header.getBlockSize();
     
        pwHash = hashPassword(password, hashAlgo, verifierSalt, ver.getSpinCount());
       
View Full Code Here

Examples of org.apache.poi.poifs.crypt.HashAlgorithm

        keyPass.setBlockSize(header.getBlockSize());

        keyData.setKeyBits(header.getKeySize());
        keyPass.setKeyBits(header.getKeySize());

        HashAlgorithm hashAlgo = header.getHashAlgorithmEx();
        keyData.setHashSize(hashAlgo.hashSize);
        keyPass.setHashSize(hashAlgo.hashSize);

        STCipherAlgorithm.Enum xmlCipherAlgo = STCipherAlgorithm.Enum.forString(header.getCipherAlgorithm().xmlId);
        if (xmlCipherAlgo == null) {
View Full Code Here

Examples of org.apache.poi.poifs.crypt.HashAlgorithm

            throw new EncryptedDocumentException(e);
        }
    }
   
    protected static SecretKey generateSecretKey(String password, EncryptionVerifier ver, int keySize) {
        HashAlgorithm hashAlgo = ver.getHashAlgorithm();

        byte pwHash[] = hashPassword(password, hashAlgo, ver.getSalt(), ver.getSpinCount());

        byte[] blockKey = new byte[4];
        LittleEndian.putInt(blockKey, 0, 0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.