Package net.rim.device.api.crypto

Examples of net.rim.device.api.crypto.SHA1Digest


        }
    }

    public static long generateId(String source) {
        String strValue = source;
        SHA1Digest sha1Digest = new SHA1Digest();
        sha1Digest.update(strValue.getBytes());
        byte[] hashValBytes = sha1Digest.getDigest();
        long hashValLong = 0;
        for(int i = 0; i < 8; i++) {
            hashValLong |= ((long) (hashValBytes[i]) & 0x0FF) << (8 * i);
        }
        return hashValLong;
View Full Code Here


        final byte[] uniqueCardData =
                new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
                        0x09, 0x0a, 0x0b };

        // Convert byte array to long.
        final SHA1Digest digest = new SHA1Digest();
        digest.update(uniqueCardData);
        final long idLong =
                byteArrayToLong(Arrays.copy(digest.getDigest(), 0, 8));

        // Using friendly display name.
        return new SmartCardID(idLong, ID_STRING, getSmartCard());
    }
View Full Code Here

TOP

Related Classes of net.rim.device.api.crypto.SHA1Digest

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.