OTP研究记录
2016-07-23 17:02
495 查看
基于事件的
HOTP (Event Tokens)
和基于时间的
TOTP (Time Tokens)
以下是 HOTP 加密的一些知识
Let:
K be a secret key
C be a counter
HMAC(K,C)
= SHA1(K ⊕ 0x5c5c… ∥ SHA1(K ⊕ 0x3636… ∥ C)) be an HMAC calculated
with the SHA-1 cryptographic hash algorithm
Truncate be a function that selects 4 bytes from the result of h in
a defined manner
Then HOTP(K,C) is mathematically defined by
HOTP(K,C) = Truncate(HMAC(K,C))
& 0x7FFFFFFF
The mask is to disregard the most
significant bit to provide better interoperability between processors.
For HOTP to be useful for an individual to input to a system, the result must be converted into a HOTP value, a 6–8 digits number that is implementation dependent.
HOTP-Value = HOTP(K,C)
mod 10d, where d is the desired number of digits
HMAC算法
http://biz.chinabyte.com/106/2011106.shtml
异或算法:
http://www.cnblogs.com/jiangguanghe/archive/2012/02/20/2360553.html
TOTP的类似,但很不一样。
HOTP (Event Tokens)
和基于时间的
TOTP (Time Tokens)
以下是 HOTP 加密的一些知识
Let:
K be a secret key
C be a counter
HMAC(K,C)
= SHA1(K ⊕ 0x5c5c… ∥ SHA1(K ⊕ 0x3636… ∥ C)) be an HMAC calculated
with the SHA-1 cryptographic hash algorithm
Truncate be a function that selects 4 bytes from the result of h in
a defined manner
Then HOTP(K,C) is mathematically defined by
HOTP(K,C) = Truncate(HMAC(K,C))
& 0x7FFFFFFF
The mask is to disregard the most
significant bit to provide better interoperability between processors.
For HOTP to be useful for an individual to input to a system, the result must be converted into a HOTP value, a 6–8 digits number that is implementation dependent.
HOTP-Value = HOTP(K,C)
mod 10d, where d is the desired number of digits
HMAC算法
http://biz.chinabyte.com/106/2011106.shtml
异或算法:
http://www.cnblogs.com/jiangguanghe/archive/2012/02/20/2360553.html
TOTP的类似,但很不一样。
相关文章推荐
- yii2使用小知识(连续补充)
- Yii2创建表单(ActiveForm)方法详解
- phpstrom + ideavim 详细配置
- PHPCMS 当前分类名称
- window系统基于IIS搭建PHP服务器环境
- DedeCMS安全设置 目录执行php脚本限制方法
- php组数玩法
- PHP学习之路之Smarty自定义函数(中)
- [php-src]Php扩展的内存泄漏处理思路
- Ubuntu下matplotlib中文无法显示的解决方法
- windows 下wamp环境3 安装php7
- thinkPHP中通过pdo方法连接mysql数据库
- Yii2验证器(Validator)用法分析
- 1.PHP简介
- yii2 RBAC使用DbManager实现后台权限判断的方法
- PHP file_put_contents&file_get_contents的使用
- PhpStorm配置XDebug调试PHP
- Yii2简单实现多语言配置的方法
- OXWALL源码阅读
- PHP的spl_autoload_register用法