https://msdn.microsoft.com/en-us/library/system.security.cryptography.hmacsha256(v=vs.110).aspx

Computes a Hash-based Message Authentication Code (HMAC) by using the SHA256 hash function.

Remarks

HMACSHA256 is a type of keyed hash algorithm that is constructed from the SHA-256 hash function and used as a Hash-based Message Authentication Code (HMAC).

The HMAC process mixes a secret key with the message data, hashes the result with the hash function, mixes that hash value with the secret key again, and then applies the hash function a second time.

The output hash is 256 bits in length.

An HMAC can be used to determine whether a message sent over an insecure channel has been tampered篡改 with, provided that the sender and receiver share a secret key.

The sender computes the hash value for the original data and sends both the original data and hash value as a single message.

The receiver recalculates the hash value on the received message and checks that the computed HMAC matches the transmitted HMAC.

Any change to the data or the hash value results in a mismatch, because knowledge of the secret key is required to change the message and reproduce the correct hash value.

Therefore, if the original and computed hash values match, the message is authenticated.

HMACSHA256 accepts keys of any size, and produces a hash sequence 256 bits in length.

=================================================

属性

Key,从父类继承的

Gets or sets the key to use in the hash algorithm.

public override byte[] Key { get; set; }

This property is the key for the keyed hash algorithm.

A Hash-based Message Authentication Code (HMAC) can be used to determine whether a message sent over an insecure channel has been tampered with, provided that the sender and receiver share a secret key.

The sender computes the hash value for the original data and sends both the original data and the HMAC as a single message.

The receiver recomputes the hash value on the received message and checks that the computed hash value matches the transmitted hash value.

HMAC can be used with any iterative cryptographic hash function, such as MD5 or SHA-1, in combination with a secret shared key.

The cryptographic strength of HMAC depends on the properties of the underlying hash function.

Any change to the data or the hash value results in a mismatch, because knowledge of the secret key is required to change the message and reproduce the correct hash value.

Therefore, if the original and computed hash values match, the message is authenticated.

实际使用https://github.com/chucklu/Tools/blob/master/Encryptor/FormHMACSHA256.cs

HMACSHA256 Class的更多相关文章

  1. HMAC-SHA256 签名方法各个语音的实现方式之前端JavaScriptes6

    sha256和16进制输出,网上很多种后端的验证方法,几乎没有前端的,所以自己写了个,希望给类似需求的人一个帮助,适用场景 腾讯云接口鉴权 v3签名 npm install sha256npm ins ...

  2. 微信小程序 HMACSHA256 哈希加密

    下载CryptoJS, 增加红色的这句 module.exports = CryptoJS /* CryptoJS code.google.com/p/crypto-js (c) 2009-2012 ...

  3. 对接微信支付使用HMAC-SHA256使用签名算法实现方式

    最近做微信押金支付对接,很多坑,心累!这里提醒一下各位: 首先,确保自己商户号进了白名单,没有需要联系客服,否则接口是调不通的,会一直提示参数错误 其次,确保接口文档是最新的,最好去官网去看,否则可能 ...

  4. python接口自动化22-签名(signature)鉴权(authentication)之加密(HEX、MD5、HMAC-SHA256)

    前言 开放的接口为了避免被别人乱调用,浪费服务器资源,这就涉及到签名(Signature)加密了 API 使用签名方法(Signature)对接口进行鉴权(Authentication).每一次请求都 ...

  5. Java算法HmacSHA256不可用 - Java Algorithm HmacSHA256 not available

    发布的jar包,运行后发现报错 Java Algorithm HmacSHA256 not available 百般思索,发现原生JAR包问题 解决办法: Copy sunjce_provider.j ...

  6. JWT & HMAC-SHA256

    JWT JSON Web Tokens https://jwt.io/ https://en.wikipedia.org/wiki/JSON_Web_Token#Structure HMACSHA25 ...

  7. Md5与HMAC-SHA256

    Md5签名算法 private string CalMd5(string str) { var md5 = MD5.Create(); var bs = md5.ComputeHash(Encodin ...

  8. 微信两种签名算法MD5和HMAC-SHA256

    在做微信接口开发的过程中, 有时候发现会提示签名校验失败, 一模一样的签名逻辑就是有些接口跑步通, 找了一圈发现挺坑的; 原来是有些接口的signType签名类型有区别, 有些接口signType要求 ...

  9. jmeter通过BeanShell,实现对接口参数HmacSHA256加密(转)

    jmeter通过BeanShell,实现对接口参数HmacSHA256加密2019-04-29 05:10 ps. 最近抓包网站的登陆请求,发现就2个参数,用户名和密码,通过工具去请求这个接口,一直返 ...

随机推荐

  1. Artisan 命令

    php artisan key:generate 生成 App Key php artisan make:controller 生成控制器 php artisan make:model 生成模型 ph ...

  2. java compare 时间排序

    所有数据存进resultList中 Collections.sort(resultList, new Comparator<HashMap<String, Object>>() ...

  3. ztree实现根节点单击事件,显示节点信息

    这段时间在维护公司的项目,去年做的项目里面有ztree树的例子,想起之前还没有开始写博客,一些知识点也无从找起,要新加一个右击节点事件,折腾了半天,其中也包含了一些知识点,稍稍做了一些demo. zT ...

  4. ADT+NDK搭建jni编译环境

    jni是android调用C++编写的库的接口.C++和java的差别不在此文的讨论范畴,另外这里也仅仅是记录下.怎样搭建好开发环境. 首先是下载ADT包和NDK包. ADT包包括了eclipse.所 ...

  5. 这两道题目很相似 最优还钱方式 & 除法推导

    http://www.cnblogs.com/grandyang/p/6108158.html http://www.cnblogs.com/grandyang/p/5880133.html 都是根据 ...

  6. rest_framework 分页三种

    .分页 a. 分页 看第n页 每页显示n条数据: b. 分页 在某个位置 向后查看多少条数据 c. 加密分页 上一页和下一页 本质:查看 记住页码id的最大值和最小值 通过其来准确扫描 过去的话 会从 ...

  7. 数据结构之fhq-treap

    本文内容部分转自某大佬博客:https://blog.csdn.net/CABI_ZGX/article/details/79963427 例题:https://www.luogu.org/probl ...

  8. Random words

    To choose a random word from the histogram, the simplest algorithm is to build a list with multiple ...

  9. spinlock参考资料

    spinlock:http://irl.cs.ucla.edu/~yingdi/web/paperreading/smp_locking.pdf

  10. <Sicily>Fibonacci

    一.题目描述 In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn-1 + Fn-2 for n ≥ 2. For exampl ...