8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: Hash.java,v 1.4 2008/06/25 05:41:41 qcheng Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Portions Copyrighted 2011 ForgeRock AS
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.iplanet.services.util.internal.TextCrypt;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The class <code>Hash</code> provides generic methods to hash data.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @deprecated As of OpenSSO version 8.0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * {@link com.sun.identity.shared.encode.Hash}
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Generates a SHA1 digest of the string and returns BASE64 encoded digest.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param string
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * a string to be hashed return a BASE64 encoded hashed String or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * null if an error occurred
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Hash of the provided string or string read from a file specified with a
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "-f" option
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Hash the first argument and return
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else if (args.length == 2 && args[0].equals("-f")) {