Skip to content

Source: Sha1.h

Sha1

A minimal RFC 3174 implementation, used only where RFC 6455 mandates it.

Functions

Return Name Description
void sha1 inline Hash len bytes at data into out, which must hold 20 bytes.

sha1

inline

inline void sha1(const uint8_t * data, size_t len, uint8_t out)

Hash len bytes at data into out, which must hold 20 bytes.

More info

This is not a general-purpose crypto primitive. SHA-1 is broken for security, and it appears here solely because the WebSocket standard requires it for the accept-key derivation.

It sits out of class so it is not bound to one translation unit, and in the namespace so a caller needs no qualifier. It is inline so any future unit that wants SHA-1 includes this header without a separate implementation file, the function being small enough that duplicating it costs little.