draft-ietf-tls-cached-info-08.txt | draft-ietf-tls-cached-info-09.txt | |||
---|---|---|---|---|
INTERNET-DRAFT S. Santesson (3xA Security) | INTERNET-DRAFT S. Santesson (3xA Security) | |||
Intended Status: Proposed Standard | Intended Status: Proposed Standard | |||
Expires: October 22, 2010 April 20, 2010 | Expires: January 13, 2011 July 12, 2010 | |||
Transport Layer Security (TLS) Cached Information Extension | Transport Layer Security (TLS) Cached Information Extension | |||
<draft-ietf-tls-cached-info-08.txt> | <draft-ietf-tls-cached-info-09.txt> | |||
Abstract | Abstract | |||
This document defines a Transport Layer Security (TLS) extension for | This document defines a Transport Layer Security (TLS) extension for | |||
cached information. This extension allows the TLS client to inform a | cached information. This extension allows the TLS client to inform a | |||
server of cached information from previous TLS sessions, allowing the | server of cached information from previous TLS handshakes, allowing | |||
server to omit sending cached static information to the client during | the server to omit sending cached static information to the client | |||
the TLS handshake protocol exchange. | during the TLS handshake protocol exchange. | |||
Status of this Memo | Status of this Memo | |||
This Internet-Draft is submitted to IETF in full conformance with the | This Internet-Draft is submitted to IETF in full conformance with the | |||
provisions of BCP 78 and BCP 79. | provisions of BCP 78 and BCP 79. | |||
Internet-Drafts are working documents of the Internet Engineering | Internet-Drafts are working documents of the Internet Engineering | |||
Task Force (IETF), its areas, and its working groups. Note that | Task Force (IETF), its areas, and its working groups. Note that | |||
other groups may also distribute working documents as | other groups may also distribute working documents as | |||
Internet-Drafts. | Internet-Drafts. | |||
skipping to change at page 2, line 26 | skipping to change at page 2, line 26 | |||
include Simplified BSD License text as described in Section 4.e of | include Simplified BSD License text as described in Section 4.e of | |||
the Trust Legal Provisions and are provided without warranty as | the Trust Legal Provisions and are provided without warranty as | |||
described in the Simplified BSD License. | described in the Simplified BSD License. | |||
Table of Contents | Table of Contents | |||
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 | 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 | |||
1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 | 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 | |||
2. Cached Information Extension . . . . . . . . . . . . . . . . . 4 | 2. Cached Information Extension . . . . . . . . . . . . . . . . . 4 | |||
3. Extension Exchange . . . . . . . . . . . . . . . . . . . . . . 5 | 3. Extension Exchange . . . . . . . . . . . . . . . . . . . . . . 5 | |||
3.1. Reconnaissance . . . . . . . . . . . . . . . . . . . . . . 5 | 3.1. Cached Information . . . . . . . . . . . . . . . . . . . . 5 | |||
3.2. Cached Information . . . . . . . . . . . . . . . . . . . . 5 | 3.2. Reconnaissance . . . . . . . . . . . . . . . . . . . . . . 5 | |||
4. Data Substitution . . . . . . . . . . . . . . . . . . . . . . . 6 | 4. Cached Information Substitution . . . . . . . . . . . . . . . . 6 | |||
4.1. Data Substitution Syntax for certificate_chain . . . . . . 6 | 4.1. Substitution Syntax for certificate_chain . . . . . . . . 6 | |||
4.2. Data Substitution Syntax for trusted_cas . . . . . . . . . 7 | 4.2. Substitution Syntax for trusted_cas . . . . . . . . . . . 6 | |||
5. Security Considerations . . . . . . . . . . . . . . . . . . . . 8 | 5. Security Considerations . . . . . . . . . . . . . . . . . . . . 8 | |||
6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 8 | 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 8 | |||
7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 8 | 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 8 | |||
8. Normative References . . . . . . . . . . . . . . . . . . . . . 9 | 8. Normative References . . . . . . . . . . . . . . . . . . . . . 9 | |||
Annex A - 64 bit FNV-1a digest . . . . . . . . . . . . . . . . . 10 | Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 10 | |||
A.1. Definition (Normative) . . . . . . . . . . . . . . . . . 10 | ||||
A.2 Java code sample (Informative) . . . . . . . . . . . . . 11 | ||||
A.3. C code sample (Informative) . . . . . . . . . . . . . . . 12 | ||||
A.4. Digest samples (Informative) . . . . . . . . . . . . . . 13 | ||||
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 14 | ||||
1. Introduction | 1. Introduction | |||
TLS handshakes often include fairly static information such as server | TLS handshakes often include fairly static information such as server | |||
certificate and a list of trusted Certification Authorities (CAs). | certificate and a list of trusted Certification Authorities (CAs). | |||
Static information such as a server certificate can be of | Static information such as a server certificate can be of | |||
considerable size. This is the case in particular if the server | considerable size. This is the case in particular if the server | |||
certificate is bundled with a complete certificate path, including | certificate is bundled with a complete certificate path, including | |||
all intermediary certificates up to the trust anchor public key. | all intermediary certificates up to the trust anchor public key. | |||
Significant benefits can be achieved in low bandwidth and high | Significant benefits can be achieved in low bandwidth and high | |||
latency networks, in particular if the communication channel also has | latency networks, in particular if the communication channel also has | |||
a relatively high rate of transmission errors, if a known and | a relatively high rate of transmission errors, if a known and | |||
previously cached server certificate path can be omitted from the TLS | previously cached server certificate path can be omitted from the TLS | |||
handshake. | handshake. | |||
This specification defines the Cached Information TLS extension, | This specification defines the Cached Information TLS extension, | |||
which may be used by a client and a server to exclude transmission of | which may be used by a client and a server to exclude transmission of | |||
known cached parameters from the TLS handshake. | cached information from the TLS handshake. | |||
1.1. Terminology | 1.1. Terminology | |||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", | |||
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this | |||
document are to be interpreted as described in RFC 2119 [RFC2119]. | document are to be interpreted as described in RFC 2119 [RFC2119]. | |||
2. Cached Information Extension | 2. Cached Information Extension | |||
A new extension type (cached_information(TBD)) is defined and used in | A new extension type (cached_information(TBD)) is defined and used in | |||
both the client hello and server hello messages. The extension type | both the client hello and server hello messages. The extension type | |||
is specified as follows. | is specified as follows. | |||
enum { | enum { | |||
cached_information(TBD), (65535) | cached_information(TBD), (65535) | |||
} ExtensionType; | } ExtensionType; | |||
The "extension_data" field of this extension, when included in the | The extension_data field of this extension, when included in the | |||
client hello, SHALL contain "CachedInformation" according to the | client hello, SHALL contain CachedInformation according to the | |||
following structure: | following structure: | |||
enum { | enum { | |||
certificate_chain(1), trusted_cas(2), (255) | certificate_chain(1), trusted_cas(2), (255) | |||
} CachedInformationType; | } CachedInformationType; | |||
struct { | struct { | |||
CachedInformationType type; | CachedInformationType type; | |||
opaque digest_value<0..8>; | HashAlgorithm hash; | |||
opaque hash_value<1..255>; | ||||
} CachedObject; | } CachedObject; | |||
struct { | struct { | |||
CachedObject cached_info<1..2048>; | CachedObject cached_info<1..2^16-1>; | |||
} CachedInformation; | } CachedInformation; | |||
The digest_value of a CachedObject MUST either be empty (0 bytes) or | ||||
contain a 64 bit FNV digest (8 bytes) as specified in Annex A. The 64 | ||||
bit integer is represented as an 8 byte digest_value in big-endian | ||||
order (with most significant bits in the first byte and least | ||||
significant bits in the last byte). | ||||
When CachedInformationType identifies certificate_chain, then | When CachedInformationType identifies certificate_chain, then | |||
digest_value MUST include a digest calculated over the | hash_value MUST include a hash calculated over the certificate_list | |||
certificate_list element of a server side Certificate message, | element of a server side Certificate message, excluding the three | |||
excluding the three length bytes of the certificate_list vector. | length bytes of the certificate_list vector. | |||
When CachedInformationType identifies trusted_cas, then digest_value | When CachedInformationType identifies trusted_cas, then hash_value | |||
MUST include a digest calculated over the certificate_authorities | MUST include a hash calculated over the certificate_authorities | |||
element of a server side CertificateRequest message, excluding the | element of a server side CertificateRequest message, excluding the | |||
two length bytes of the certificate_authorities vector. | two length bytes of the certificate_authorities vector. | |||
The hash algorithm used to calculate hash values SHALL be the hash | ||||
algorithm that was used to generate the Finished message in the | ||||
handshake exchange from which the hashed information was cached. Hash | ||||
algorithm identifiers are defined in the RFC 5246 [RFC5246] | ||||
HashAlgorithm registry. | ||||
Other specifications MAY define more CachedInformationType types. | Other specifications MAY define more CachedInformationType types. | |||
3. Extension Exchange | 3. Extension Exchange | |||
3.1. Reconnaissance | 3.1. Cached Information | |||
A client MAY include an empty cached_information extension (with | ||||
empty extension_data field) in its (extended) client hello to query | ||||
whether the server supports cached information. | ||||
A server indicates that it supports cached information in handshakes | ||||
according to section 3.2. by including a cached_information extension | ||||
in its (extended) server hello. | ||||
3.2. Cached Information | ||||
Clients MAY specify cached information from previous handshakes by | Clients MAY include a "cached_information" extension in the | |||
including a "cached_information" extension in the (extended) client | (extended) client hello, which MAY contain zero or more cached | |||
hello, which contains at least one cached object (CachedObject) for | objects (CachedObject). | |||
each present object type (CachedInformationType), as specified in | ||||
section 2. Clients MAY need the ability to cache different values | ||||
depending on other information in the Client Hello that modify what | ||||
values the server uses, in particular the Server Name Indication | ||||
[RFC4366] value. Clients sending a non-empty cached_information | ||||
extension MUST provide a 64 bit (8 byte) digest_value for each cached | ||||
object. | ||||
Servers that receive an extended client hello containing a | Servers that receive an extended client hello containing a | |||
"cached_information" extension, MAY indicate that they support | "cached_information" extension MAY indicate that they support cached | |||
caching of information objects by including an cached_information | information objects by including a cached_information extension in | |||
extension in their (extended) server hello. | their (extended) server hello. | |||
A cached_information extension provided in the server hello has the | A cached_information extension provided in the server hello has the | |||
following semantics: | following semantics: | |||
o An empty cached_information extension indicates that the server | o An empty cached_information extension indicates that the server | |||
supports information caching but provides no information about | supports information caching but provides no information about | |||
what information types it supports. | what information types it supports. | |||
o A non-empty cached information extension indicates that the | o A non-empty cached information extension indicates that the | |||
server supports only those CachedInformationType types that are | server supports caching of each present CachedObject that matches | |||
identified by each present CachedObject. | the specified hash value. The server MAY support other cached | |||
objects that are not present in the extension. | ||||
o A CachedObject with an empty digest_value indicates that the | Note: Clients may need the ability to cache different values | |||
server supports caching of the specified object type | depending on other information in the Client Hello that modify what | |||
(CachedInformationType), but does not specify any digest values | values the server uses, in particular the Server Name Indication | |||
it will accept. | [RFC4366] value. | |||
o A present non-empty digest_value indicates that the server will | 3.2. Reconnaissance | |||
honor caching of objects of the specified type that matches the | ||||
present digest value. | ||||
4. Data Substitution | A client MAY include an empty cached_information extension (with | |||
empty extension_data field) in its (extended) client hello to query | ||||
whether the server supports cached information. | ||||
Upon receiving an empty cached_information extension, a server MAY | ||||
indicate that it supports cached information in handshakes by | ||||
including a cached_information extension in its (extended) server | ||||
hello according to any of the available options in section 3.1. | ||||
4. Cached Information Substitution | ||||
Following a successful exchange of "cached_information" extensions, | Following a successful exchange of "cached_information" extensions, | |||
the server may substitute data objects in the handshake exchange with | the server MAY substitute cached information in the handshake | |||
a matching digest_value representing a matching object type. received | exchange with a matching CachedObject from the client hello | |||
from the client in its client hello. | "cached_information" extension. | |||
The handshake protocol will proceed using the cached data as if it | A substitution syntax that defines how the CachedObject structure is | |||
was provided in the handshake protocol. The Finished message will | carried in the handshake message MUST be defined for each | |||
however be calculated over the actual data exchanged in the handshake | CachedInformationType in a way that does not violate the syntax of | |||
protocol. That is, the Finished message will be calculated over the | the handshake message. The substitution syntax for | |||
digest values of cached information objects and not over the cached | certificate_chain(1) and trusted_cas(2) is provided below. | |||
objects that were omitted from transmission. | ||||
Each CachedInformationType MUST specify how actual data is replaced | The handshake protocol SHALL proceed using the cached information as | |||
by a digest in a way that does not violate the defined syntax of | if it was provided in the handshake protocol. The Finished message | |||
existing handshake messages. the data exchange syntax for | SHALL be calculated over the actual data exchanged in the handshake | |||
certificate_chain(1) and trusted_cas(2) are provided below. | protocol. That is, the Finished message will be calculated over the | |||
hash values of cached information objects and not over the cached | ||||
information that were omitted from transmission. | ||||
The server MUST NOT provide more than one digest value as | The server MUST NOT include more than one CachedObject as | |||
substitution for the cached data. | substitution for the cached information. | |||
4.1. Data Substitution Syntax for certificate_chain | 4.1. Substitution Syntax for certificate_chain | |||
When a digest for an object of type certificate_chain is provided in | When an object of type certificate_chain is provided in the client | |||
the client hello, the server MAY substitute the cached data with a | hello, the server MAY substitute the cached information with a | |||
matching digest value received from the client by expanding the | matching hash value received from the client by expanding the | |||
Certificate handshake message as follows. | Certificate handshake message as follows. | |||
Original handshake message syntax defined in RFC 5246 [RFC5246]: | Original handshake message syntax defined in RFC 5246 [RFC5246]: | |||
opaque ASN.1Cert<1..2^24-1>; | opaque ASN.1Cert<1..2^24-1>; | |||
struct { | struct { | |||
ASN.1Cert certificate_list<0..2^24-1>; | ASN.1Cert certificate_list<0..2^24-1>; | |||
} Certificate; | } Certificate; | |||
Substitution syntax is defined by expanding the definition of the | Substitution syntax is defined by expanding the syntax of the opaque | |||
opaque ASN.1Cert structure: | ASN.1Cert structure: | |||
DigestInfo ASN.1Cert<1..2^24-1>; | ||||
struct { | CachedObject ASN.1Cert<1..2^24-1>; | |||
opaque digest_value<0..8>; | ||||
} DigestInfo; | ||||
4.2. Data Substitution Syntax for trusted_cas | 4.2. Substitution Syntax for trusted_cas | |||
When a digest for an object of type trusted_cas is provided in the | When a hash for an object of type trusted_cas is provided in the | |||
client hello, the server MAY substitute the cached data with a | client hello, the server MAY substitute the cached information with a | |||
matching digest value received from the client by expanding the | matching hash value received from the client by expanding the | |||
CertificateRequest handshake message as follows. | CertificateRequest handshake message as follows. | |||
Original handshake message syntax defined in RFC 5246 [RFC5246]: | Original handshake message syntax defined in RFC 5246 [RFC5246]: | |||
opaque DistinguishedName<1..2^16-1>; | opaque DistinguishedName<1..2^16-1>; | |||
struct { | struct { | |||
ClientCertificateType certificate_types<1..2^8-1>; | ClientCertificateType certificate_types<1..2^8-1>; | |||
SignatureAndHashAlgorithm | SignatureAndHashAlgorithm | |||
supported_signature_algorithms<2^16-1>; | supported_signature_algorithms<2^16-1>; | |||
DistinguishedName certificate_authorities<0..2^16-1>; | DistinguishedName certificate_authorities<0..2^16-1>; | |||
} CertificateRequest | } CertificateRequest | |||
The substitution syntax is defined by expanding the definition of the | The substitution syntax is defined by expanding the syntax of the | |||
opaque DistinguishedName structure: | opaque DistinguishedName structure: | |||
DigestInfo DistinguishedName<1..2^16-1>; | CachedObject DistinguishedName<1..2^16-1>; | |||
struct { | ||||
opaque digest_value<0..8>; | ||||
} DigestInfo; | ||||
5. Security Considerations | 5. Security Considerations | |||
The digest algorithm used in this specification is required to have | The hash algorithm used in this specification is required to have | |||
reasonable random properties in order to provide reasonably unique | reasonable random properties in order to provide reasonably unique | |||
identifiers. There is no requirement that this digest algorithm must | identifiers. There is no clearly identified requirement that this | |||
have strong collision resistance. A non unique digest may at most | hash algorithm must have strong collision resistance. However since | |||
lead to a failed TLS handshake followed by a new attempt without the | the hash algorithm is used to represent data in the finished | |||
cached information extension. There are no identified security | calculation, the security properties of the finished calculation will | |||
threats that require the selected digest algorithm to have strong | change if a weaker hash algorithm is used to represent cached | |||
collision resistance. | information compared with the hash algorithm used to calculate the | |||
finished message. | ||||
Caching information in an encrypted handshake (such as a renegotiated | ||||
handshake) and sending a hash of that cached information in an | ||||
unencrypted handshake might introduce integrity or data disclosure | ||||
issues as it enables an attacker to identify if a known object (such | ||||
as a known server certificate) has been used in previous encrypted | ||||
handshakes. Information object types defined in this specification, | ||||
such as server certificates, are public objects and usually not | ||||
sensitive in this regard, but implementers should be aware if any | ||||
cached information are subject to such security concerns and in such | ||||
case SHOULD NOT send a hash over encrypted data in en unencrypted | ||||
handshake. | ||||
6. IANA Considerations | 6. IANA Considerations | |||
1) Create an entry, cached_information(TBD), in the existing registry | 1) Create an entry, cached_information(TBD), in the existing registry | |||
for ExtensionType (defined in RFC 5246 [RFC5246]). | for ExtensionType (defined in RFC 5246 [RFC5246]). | |||
2) Establish a registry for TLS CachedInformationType values. The | 2) Establish a registry for TLS CachedInformationType values. The | |||
first entries in the registry are certificate_chain(1) and | first entries in the registry are certificate_chain(1) and | |||
trusted_cas(2). TLS CachedInformationType values in the inclusive | trusted_cas(2). TLS CachedInformationType values in the inclusive | |||
range 0-63 (decimal) are assigned via RFC 5226 [RFC5226] Standards | range 0-63 (decimal) are assigned via RFC 5226 [RFC5226] Standards | |||
Action. Values from the inclusive range 64-223 (decimal) are | Action. Values from the inclusive range 64-223 (decimal) are | |||
assigned via RFC 5226 Specification Required. Values from the | assigned via RFC 5226 Specification Required. Values from the | |||
inclusive range 224-255 (decimal) are reserved for RFC 5226 | inclusive range 224-255 (decimal) are reserved for RFC 5226 | |||
Private Use. | Private Use. | |||
7. Acknowledgements | 7. Acknowledgements | |||
The author acknowledge input from many members of the TLS working | The author acknowledges input from many members of the TLS working | |||
group, Martin Rex for extensive review and input, Marsh Ray and Simon | group. | |||
Josefsson for coding and test vectors. | ||||
8. Normative References | 8. Normative References | |||
[RFC2119] S. Bradner, "Key words for use in RFCs to Indicate | [RFC2119] S. Bradner, "Key words for use in RFCs to Indicate | |||
Requirement Levels", BCP 14, RFC 2119, March 1997 | Requirement Levels", BCP 14, RFC 2119, March 1997 | |||
[RFC5226] T. Narten, H. Alvestrand, "Guidelines for Writing an IANA | [RFC5226] T. Narten, H. Alvestrand, "Guidelines for Writing an IANA | |||
Considerations Section in RFCs", RFC 5226, May 2008 | Considerations Section in RFCs", RFC 5226, May 2008 | |||
[RFC5246] T. Dierks, E. Rescorla, "The Transport Layer Security | [RFC5246] T. Dierks, E. Rescorla, "The Transport Layer Security | |||
(TLS) Protocol Version 1.2", RFC 5246, August 2008 | (TLS) Protocol Version 1.2", RFC 5246, August 2008 | |||
[RFC4366] S. Blake-Wilson, M. Nystrom, D. Hopwood, J. Mikkelsen, T. | [RFC4366] S. Blake-Wilson, M. Nystrom, D. Hopwood, J. Mikkelsen, T. | |||
Wright, "Transport Layer Security (TLS) Extensions", RFC | Wright, "Transport Layer Security (TLS) Extensions", RFC | |||
4366, April 2006 | 4366, April 2006 | |||
NOTE: RFC 4366 will be updated by RFC4366bis, currently in IESG | NOTE: RFC 4366 will be updated by RFC4366bis, currently in IESG | |||
process. | process. | |||
Annex A - 64 bit FNV-1a digest | ||||
A.1. Definition (Normative) | ||||
FNV-1 digest algorithm is a non-cryptographic hash function created | ||||
by Glenn Fowler, Landon Curt Noll, and Phong Vo. The FNV digest | ||||
algorithms and sample FNV source code have been released into the | ||||
public domain. FNV-1 has two defined variants, FNV-1 and FNV-1a. The | ||||
algorithm specified in this annex specifies the FNV-1a variant. | ||||
The FNV-1a digest is generated as follows: | ||||
digest = FNV_offset_basis | ||||
for each octet_of_data to be digested { | ||||
digest = digest XOR octet_of_data | ||||
digest = digest * FNV_prime } | ||||
return digest | ||||
In the above pseudocode, all variables are unsigned integers. All | ||||
variables, except for octet_of_data, have the same number of bits as | ||||
the FNV digest (64 Bits). The variable, octet_of_data, is an 8 bit | ||||
unsigned integer. Specifically for a 64 bit FNV-1a digest the | ||||
following applies: | ||||
o All variables, except for octet_of_data, are 64-bit unsigned | ||||
integers. | ||||
o The variable, octet_of_data, is an 8 bit unsigned integer. | ||||
o The FNV_offset_basis is the 64-bit FNV offset basis value: | ||||
14695981039346656037. | ||||
o The FNV_prime is the 64-bit FNV prime value: 1099511628211. | ||||
o The multiply function (indicated by the '*' symbol) returns the | ||||
lower 64-bits of the product. | ||||
o The XOR is an 8-bit operation that modifies only the lower 8-bits | ||||
of the digest value. | ||||
o The digest value returned is an 64-bit unsigned integer. | ||||
A.2 Java code sample (Informative) | ||||
/** | ||||
* Java code sample, implementing 64 bit FNV-1a | ||||
* By Stefan Santesson | ||||
*/ | ||||
import java.math.BigInteger; | ||||
public class FNV { | ||||
static public BigInteger getFNV1a64Digest (String inpString) { | ||||
BigInteger m = new BigInteger("2").pow(64); | ||||
BigInteger fnvPrime = new BigInteger("1099511628211"); | ||||
BigInteger fnvOffsetBasis = new BigInteger | ||||
("14695981039346656037"); | ||||
BigInteger digest = fnvOffsetBasis; | ||||
for (int i = 0; i < inpString.length(); i++) { | ||||
digest = digest.xor(BigInteger.valueOf( | ||||
(int) inpString.charAt(i))); | ||||
digest = digest.multiply(fnvPrime).mod(m); | ||||
} | ||||
return (digest); | ||||
} | ||||
} | ||||
A.3. C code sample (Informative) | ||||
fnv1a64.h: | ||||
#ifndef FNV1A64_H | ||||
#define FNV1A64_H | ||||
#include <string.h> /* For size_t */ | ||||
#include <stdint.h> /* For uint64_t */ | ||||
extern uint64_t fnv1a64 (const uint8_t *buffer, size_t len); | ||||
#endif | ||||
fnv1a64.c: | ||||
/* fnv1a.c -- Implementation of the FNV-1A non-cryptographic | ||||
* hash function. | ||||
* By Simon Josefsson <simon@josefsson.org> on 2010-03-30. | ||||
*/ | ||||
#include "fnv1a64.h" | ||||
#define FNV1A64_OFFSET_BASIS 14695981039346656037ULL | ||||
#define FNV1A64_PRIME 1099511628211ULL | ||||
uint64_t | ||||
fnv1a64 (const uint8_t *buffer, size_t len) | ||||
{ | ||||
uint64_t hash; | ||||
size_t i; | ||||
hash = FNV1A64_OFFSET_BASIS; | ||||
for (i = 0; i < len; i++) | ||||
{ | ||||
hash = hash ^ buffer[i]; | ||||
hash = hash * FNV1A64_PRIME; | ||||
} | ||||
return hash; | ||||
} | ||||
A.4. Digest samples (Informative) | ||||
Digest samples for 64 bit FNV-1a | ||||
For input data: | ||||
null ("") | ||||
0 bytes | ||||
Digest is: CB F2 9C E4 84 22 23 25 | ||||
For input data: | ||||
hex: 61 ("a") | ||||
1 byte | ||||
Digest is: AF 63 DC 4C 86 01 EC 8C | ||||
For input data: | ||||
hex: FF 00 00 01 | ||||
4 bytes | ||||
Digest is: 69 61 19 64 91 CC 68 2D | ||||
For input data: | ||||
hex: 68 74 74 70 3A 2F 2F 65 6E 2E 77 69 6B 69 70 65 | ||||
64 69 61 2E 6F 72 67 2F 77 69 6B 69 2F 46 6F 77 | ||||
6C 65 72 5F 4E 6F 6C 6C 5F 56 6F 5F 68 61 73 68 | ||||
("http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash") | ||||
48 bytes | ||||
Digest is: D9 B9 57 FB 7F E7 94 C5 | ||||
Authors' Addresses | Authors' Addresses | |||
Stefan Santesson | Stefan Santesson | |||
3xA Security AB | 3xA Security AB | |||
Bjornstorp 744 | Scheelev. 17 | |||
247 98 Genarp | 223 70 Sweden | |||
Sweden | ||||
EMail: sts@aaa-sec.com | EMail: sts@aaa-sec.com | |||
End of changes. 37 change blocks. | ||||
261 lines changed or deleted | 106 lines changed or added | |||
This html diff was produced by rfcdiff 1.38. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |