001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.util;
016    
017    import java.nio.ByteBuffer;
018    
019    /**
020     * @author Brian Wing Shun Chan
021     * @author Alexander Chow
022     * @author Connor McKay
023     */
024    public interface Digester {
025    
026            public static final String DEFAULT_ALGORITHM = "SHA";
027    
028            public static final String ENCODING = StringPool.UTF8;
029    
030            public static final String MD5 = "MD5";
031    
032            public static final String SHA = "SHA";
033    
034            public static final String SHA_1 = "SHA-1";
035    
036            public String digest(ByteBuffer byteBuffer);
037    
038            public String digest(String text);
039    
040            public String digest(String algorithm, ByteBuffer byteBuffer);
041    
042            public String digest(String algorithm, String... text);
043    
044            public String digestBase64(ByteBuffer byteBuffer);
045    
046            public String digestBase64(String text);
047    
048            public String digestBase64(String algorithm, ByteBuffer byteBuffer);
049    
050            public String digestBase64(String algorithm, String... text);
051    
052            public String digestHex(ByteBuffer byteBuffer);
053    
054            public String digestHex(String text);
055    
056            public String digestHex(String algorithm, ByteBuffer byteBuffer);
057    
058            public String digestHex(String algorithm, String... text);
059    
060            public byte[] digestRaw(ByteBuffer byteBuffer);
061    
062            public byte[] digestRaw(String text);
063    
064            public byte[] digestRaw(String algorithm, ByteBuffer byteBuffer);
065    
066            public byte[] digestRaw(String algorithm, String... text);
067    
068    }