本文整理汇总了Java中org.apache.shiro.codec.Hex.encodeToString方法的典型用法代码示例。如果您正苦于以下问题:Java Hex.encodeToString方法的具体用法?Java Hex.encodeToString怎么用?Java Hex.encodeToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.shiro.codec.Hex
的用法示例。
在下文中一共展示了Hex.encodeToString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toHex
import org.apache.shiro.codec.Hex; //导入方法依赖的package包/类
@Override
public String toHex() {
if ( this.cachedHex == null ) {
this.cachedHex = Hex.encodeToString(getBytes());
}
return this.cachedHex;
}
示例2: testHex
import org.apache.shiro.codec.Hex; //导入方法依赖的package包/类
@Test
public void testHex(){
String str = "hello";
String hexEncode = Hex.encodeToString(str.getBytes());
String str2 = new String(Hex.decode(hexEncode.getBytes()));
Assert.assertEquals(str, str2);
}
示例3: toHex
import org.apache.shiro.codec.Hex; //导入方法依赖的package包/类
/**
*
* @return a hex-encoded string of the underlying {@link #getBytes byte array}.
*/
public String toHex() {
if (this.hexEncoded == null) {
this.hexEncoded = Hex.encodeToString(getBytes());
}
return this.hexEncoded;
}
示例4: toHex
import org.apache.shiro.codec.Hex; //导入方法依赖的package包/类
public String toHex() {
if ( this.cachedHex == null ) {
this.cachedHex = Hex.encodeToString(getBytes());
}
return this.cachedHex;
}
示例5: toHex
import org.apache.shiro.codec.Hex; //导入方法依赖的package包/类
public String toHex() {
if (this.cachedHex == null) {
this.cachedHex = Hex.encodeToString(getBytes());
}
return this.cachedHex;
}
示例6: generateSecretKey
import org.apache.shiro.codec.Hex; //导入方法依赖的package包/类
private String generateSecretKey() {
Key key = cipherService.generateNewKey();
return Hex.encodeToString(key.getEncoded());
}
示例7: toHex
import org.apache.shiro.codec.Hex; //导入方法依赖的package包/类
/**
* Returns a hex-encoded string of the underlying {@link #getBytes byte array}.
* <p/>
* This implementation caches the resulting hex string so multiple calls to this method remain efficient.
* However, calling {@link #setBytes setBytes} will null the cached value, forcing it to be recalculated the
* next time this method is called.
*
* @return a hex-encoded string of the underlying {@link #getBytes byte array}.
*/
public String toHex() {
if (this.hexEncoded == null) {
this.hexEncoded = Hex.encodeToString(getBytes());
}
return this.hexEncoded;
}
示例8: encrytHex
import org.apache.shiro.codec.Hex; //导入方法依赖的package包/类
/**
* 16进制加密
*
* @param content
* @return
*/
public static String encrytHex(String content) {
Preconditions.checkArgument(!Strings.isNullOrEmpty(content), "不能为空");
byte[] bytes = content.getBytes();
return Hex.encodeToString(bytes);
}
示例9: encrytHex
import org.apache.shiro.codec.Hex; //导入方法依赖的package包/类
/**
* 16进制加密
*
* @param password
* @return
*/
public static String encrytHex(String password) {
byte[] bytes = password.getBytes();
return Hex.encodeToString(bytes);
}