本文整理汇总了Java中com.jcraft.jsch.HASH类的典型用法代码示例。如果您正苦于以下问题:Java HASH类的具体用法?Java HASH怎么用?Java HASH使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HASH类属于com.jcraft.jsch包,在下文中一共展示了HASH类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getJschFingerprint
import com.jcraft.jsch.HASH; //导入依赖的package包/类
public static String getJschFingerprint(byte[] keyBlob) throws Exception {
final String[] fingerPrintChars = {
"0","1","2","3","4","5","6","7","8","9", "a","b","c","d","e","f"
};
HASH hash = new MD5();
hash.init();
hash.update(keyBlob, 0, keyBlob.length);
byte[] foo = hash.digest();
StringBuffer sb = new StringBuffer();
int bar;
for(int i = 0; i < foo.length; i++){
bar = foo[i]&0xff;
sb.append(fingerPrintChars[(bar>>>4)&0xf]);
sb.append(fingerPrintChars[(bar)&0xf]);
if(i + 1 < foo.length) {
sb.append(":");
}
}
return sb.toString();
}
示例2: getFingerPrint
import com.jcraft.jsch.HASH; //导入依赖的package包/类
public static String getFingerPrint(final HASH hash, final byte[] data)
{
checkNotNull(hash);
checkNotNull(data);
try
{
hash.init();
hash.update(data, 0, data.length);
byte[] digest = hash.digest();
StringBuffer sb = new StringBuffer();
int offset;
for (int i = 0; i < digest.length; i++)
{
offset = digest[i] & 0xff;
sb.append(CHARS[(offset >>> 4) & 0xf]);
sb.append(CHARS[(offset) & 0xf]);
if (i + 1 < digest.length)
{
sb.append(":");
}
}
return sb.toString();
}
catch (Exception exception)
{
return "???";
}
}
示例3: md5
import com.jcraft.jsch.HASH; //导入依赖的package包/类
public static HASH md5()
{
return new com.jcraft.jsch.jce.MD5();
}