/**
* 保存手势密码
*/
private void saveChosenPattern(List<LockPatternView.Cell> cells)
{
byte[] bytes = LockPatternUtil.patternToHash(cells);
aCache.put(Constant.GESTURE_PASSWORD, bytes);
}
/**
* Generate an SHA-1 hash for the pattern.
* Not the most secure, but it is at
* least a second level of protection. First level is that the file is in a
* location only readable by the system process.*
* @param pattern
* @return the hash of the pattern in a byte array.
*/
public static byte[] patternToHash(List<LockPatternView.Cell> pattern)
{
if (pattern == null) {
return null;
} else {
int size = pattern.size();
byte[] res = new byte[size];
for (int i = 0; i < size; i++) {
LockPatternView.Cell cell = pattern.get(i);
res[i] = (byte) cell.getIndex();
}
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
return md.digest(res);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return res;
}
}
}
/** * Set whether the view will use tactile feedback.
*If true, there will be
* tactile feedback as the user enters the pattern.
* @param tactileFeedbackEnabled Whether tactile feedback is enabled
*/
public void setTactileFeedbackEnabled(boolean tactileFeedbackEnabled) {
mEnableHapticFeedback = tactileFeedbackEnabled;
}
/**
* Set whether the view is in stealth mode. If true, there will be no
* visible feedback as the user enters the pattern.
* @param inStealthMode Whether in stealth mode.
*/public void setInStealthMode(boolean inStealthMode) {
mInStealthMode = inStealthMode;
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有