本文整理匯總了Java中org.jivesoftware.smack.util.StringUtils.hash方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.hash方法的具體用法?Java StringUtils.hash怎麽用?Java StringUtils.hash使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jivesoftware.smack.util.StringUtils
的用法示例。
在下文中一共展示了StringUtils.hash方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setDigest
import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
/**
* Sets the digest value using a connection ID and password. Password
* digests offer a more secure alternative for authentication compared to
* plain text. The digest is the hex-encoded SHA-1 hash of the connection ID
* plus the user's password. If the digest and password are set, digest
* authentication will be used. If only one value is set, the respective
* authentication mode will be used.
*
* @param connectionID the connection ID.
* @param password the password.
* @see org.jivesoftware.smack.Connection#getConnectionID()
*/
public void setDigest(String connectionID, String password) {
this.digest = StringUtils.hash(connectionID + password);
}
示例2: createDigest
import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
/**
* Returns a SHA-1 digest of the given parameters as specified in <a
* href="http://xmpp.org/extensions/xep-0065.html#impl-socks5">XEP-0065</a>.
*
* @param sessionID for the SOCKS5 Bytestream
* @param initiatorJID JID of the initiator of a SOCKS5 Bytestream
* @param targetJID JID of the target of a SOCKS5 Bytestream
* @return SHA-1 digest of the given parameters
*/
public static String createDigest(String sessionID, String initiatorJID, String targetJID) {
StringBuilder b = new StringBuilder();
b.append(sessionID).append(initiatorJID).append(targetJID);
return StringUtils.hash(b.toString());
}