Package rocks.xmpp.extensions.hashes.model

Examples of rocks.xmpp.extensions.hashes.model.Hash


     * @return The MD5 sum.
     */
    public List<Hash> getHashes() {
        if (hash != null) {
            // XEP-0096 seem to be hex encoded, while XEP-300 are base64 encoded. Convert from hex to byte array.
            return Collections.unmodifiableList(Arrays.asList(new Hash(new BigInteger(hash, 16).toByteArray(), "md5")));
        } else {
            return Collections.emptyList();
        }
    }
View Full Code Here


    }

    @Test
    public void unmarshalHash() throws JAXBException, XMLStreamException {
        String xml = "<hash xmlns='urn:xmpp:hashes:1' algo='sha-1'>2AfMGH8O7UNPTvUVAM9aK13mpCY=</hash>\n";
        Hash hash = unmarshal(xml, Hash.class);
        Assert.assertNotNull(hash);
        Assert.assertEquals(hash.getAlgorithm(), "sha-1");
        Assert.assertEquals(DatatypeConverter.printBase64Binary(hash.getValue()), "2AfMGH8O7UNPTvUVAM9aK13mpCY=");
    }
View Full Code Here

TOP

Related Classes of rocks.xmpp.extensions.hashes.model.Hash

Copyright © 2018 www.massapicom. 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.