001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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    }