HMAC算法

HMAC是一种使用密钥和哈希函数进行消息认证的机制,适用于验证通过不可靠媒介传输或存储信息的完整性。它依赖于迭代的哈希函数,如MD5或SHA-1,结合共享的秘密密钥。本文档介绍了HMAC的定义、工作原理和安全性,并提供了使用MD5、SHA-1等哈希函数的实例。尽管MD5的安全性受到质疑,但根据当前的分析,HMAC在使用MD5时仍然安全,但SHA-1被认为是更安全的选择。
摘要由CSDN通过智能技术生成

RFC 2104 - HMAC: Keyed-Hashing for Message Authentication

前言:
【1】“message authentication codes” (MAC)
【2】“hash-based message authentication codes” (HMAC)
【3】https://www.packetizer.com/rfc/rfc2104/

HMAC: Keyed-Hashing for Message Authentication

Status of This Memo

This memo provides information for the Internet community. This memo
does not specify an Internet standard of any kind. Distribution of
this memo is unlimited.

Abstract

This document describes HMAC, a mechanism for message authentication
using cryptographic hash functions. HMAC can be used with any
iterative cryptographic hash function, e.g., MD5, SHA-1, in
combination with a secret shared key. The cryptographic strength of
HMAC depends on the properties of the underlying hash function.

  1. Introduction

    Providing a way to check the integrity of information transmitted
    over or stored in an unreliable medium is a prime necessity in the
    world of open computing and communications. Mechanisms that provide
    such integrity check based on a secret key are usually called
    “message authentication codes” (MAC). Typically, message
    authentication codes are used between two parties that share a secret
    key in order to validate information transmitted between these
    parties. In this document we present such a MAC mechanism based on
    cryptographic hash functions. This mechanism, called HMAC, is based
    on work by the authors [BCK1] where the construction is presented and
    cryptographically analyzed. We refer to that work for the details on
    the rationale and security analysis of HMAC, and its comparison to
    other keyed-hash methods.

Krawczyk, et. al. Informational [Page 1]

RFC 2104 HMAC February 1997

HMAC can be used in combination with any iterated cryptographic hash
function. MD5 and SHA-1 are examples of such hash functions. HMAC
also uses a secret key for calculation and verification of the
message authentication values. The main goals behind this
construction are

  • To use, without modifications, available hash functions.
    In particular, hash functions that perform well in software,
    and for which code is freely and widely available.

  • To preserve the original performance of the hash function without
    incurring a significant degradation.

  • To use and handle keys in a simple way.

  • To have a well understood cryptographic analysis of the strength of
    the authentication mechanism based on reasonable assumptions on the
    underlying hash function.

  • To allow for easy replaceability of the underlying hash function in
    case that faster or more secure hash functions are found or
    required.

This document specifies HMAC using a generic cryptographic hash
function (denoted by H). Specific instantiations of HMAC need to
define a particular hash function. Current candidates for such hash
functions include SHA-1 [SHA], MD5 [MD5], RIPEMD-128/160 [RIPEMD].
These different realizations of HMAC will be denoted by HMAC-SHA1,
HMAC-MD5, HMAC-RIPEMD, etc.

Note: To the date of writing of this document MD5 and SHA-1 are the
most widely used cryptographic hash functions. MD5 has been recently
shown to be vulnerable to collision search attacks [Dobb]. This
attack and other currently known weaknesses of MD5 do not compromise
the use of MD5 within HMAC as specified in this document (see
[Dobb]); however, SHA-1 appears to be a cryptographically stronger
function. To this date, MD5 can be considered for use in HMAC for
applications where the superior performance of MD5 is critical. In
any case, implementers and users need to be aware of possible
cryptanalytic developments regarding any of these cryptographic hash
functions, and the eventual need to replace the underlying hash
function. (See section 6 for more information on the security of
HMAC.)

Krawczyk, et. al. Informational [Page 2]

RFC 2104 HMAC February 1997

  1. Definition of HMAC

    The definition of HMAC requires a cryptographic hash function, which

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值