github/statsd-ruby — pull request #9 by jssjr (2014-01-28 18:37:15+00:00)
Title: Signed messages

This implements support for HMAC signed messages. Signing the message prevents tampering with the metrics, replay attacks, and impersonation.

The payload is formatted as:

| timestamp | nonce | plaintext message |
|---------------|----------|--------------------------|
| 8 bytes, epoch representation, unsigned long long | 4 bytes | some statsd message text... |

The payload is then digested using HMAC-SHA256 and the resulting 20 byte signature is prepended to the payload and emitted to the statsd server.

| signature | payload |
|--------------|------------|
| 20 bytes | see above |

This behavior can be enabled by simply initializing the statsd client with a key.