Commit 2036307d authored by Geoff Simmons's avatar Geoff Simmons

fix docs to accomadate automatic generation by the Varnish 5.0 vmodtool

parent 4c7d69b6
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
vmod_blobdigest vmod_blobdigest
=============== ===============
--------------------------------------------------- --------------------------------------------------
digests , checksums and hmacs for the VCL blob type digests, checksums and hmacs for the VCL blob type
--------------------------------------------------- --------------------------------------------------
:Manual section: 3 :Manual section: 3
...@@ -203,22 +203,19 @@ values: ...@@ -203,22 +203,19 @@ values:
CONTENTS CONTENTS
======== ========
* Object digest * digest(ENUM {CRC32,MD5,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512}, BLOB)
* BLOB digest.final() * BLOB hash(ENUM {CRC32,MD5,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512}, BLOB)
* BOOL digest.update(BLOB) * hmac(ENUM {MD5,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512}, BLOB)
* BLOB hash(ENUM, BLOB)
* Object hmac
* BLOB hmac.hmac(BLOB)
* STRING version() * STRING version()
.. _obj_digest: .. _obj_digest:
Object digest digest
============= ------
::
Prototype new OBJ = digest(ENUM {CRC32,MD5,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512} hash, BLOB init=0)
new OBJ = blobdigest.digest(ENUM hash[, BLOB init])
Initialize a message digest context for the algorithm ``hash``, and Initialize a message digest context for the algorithm ``hash``, and
optionally update it with ``init``. If ``init`` is left out, then an optionally update it with ``init``. If ``init`` is left out, then an
...@@ -245,10 +242,11 @@ Example:: ...@@ -245,10 +242,11 @@ Example::
.. _func_digest.update: .. _func_digest.update:
BOOL digest.update(BLOB) digest.update
------------------------ -------------
::
Prototype
BOOL digest.update(BLOB) BOOL digest.update(BLOB)
Incrementally add the BLOB to the digest context of this object. Incrementally add the BLOB to the digest context of this object.
...@@ -304,10 +302,11 @@ Example:: ...@@ -304,10 +302,11 @@ Example::
.. _func_digest.final: .. _func_digest.final:
BLOB digest.final() digest.final
------------------- ------------
::
Prototype
BLOB digest.final() BLOB digest.final()
Finalize the message digest and return the result. Finalize the message digest and return the result.
...@@ -392,11 +391,12 @@ Example:: ...@@ -392,11 +391,12 @@ Example::
.. _func_hash: .. _func_hash:
BLOB hash(ENUM, BLOB) hash
--------------------- ----
::
Prototype BLOB hash(ENUM {CRC32,MD5,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512} hash, BLOB msg)
BLOB hash(ENUM hash, BLOB msg)
Returns the message digest for ``msg`` as specified by ``hash``. Returns the message digest for ``msg`` as specified by ``hash``.
...@@ -414,12 +414,12 @@ Example:: ...@@ -414,12 +414,12 @@ Example::
.. _obj_hmac: .. _obj_hmac:
Object hmac hmac
=========== ----
::
Prototype new OBJ = hmac(ENUM {MD5,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512} hash, BLOB key)
new OBJ = blobdigest.hmac(ENUM hash, BLOB key)
Creates an object that generates HMACs based on the digest algorithm Creates an object that generates HMACs based on the digest algorithm
``hash`` and the given ``key``. ``hash`` and the given ``key``.
...@@ -438,10 +438,11 @@ Example:: ...@@ -438,10 +438,11 @@ Example::
.. _func_hmac.hmac: .. _func_hmac.hmac:
BLOB hmac.hmac(BLOB) hmac.hmac
-------------------- ---------
::
Prototype
BLOB hmac.hmac(BLOB msg) BLOB hmac.hmac(BLOB msg)
Returns the HMAC for ``msg`` based on the key and hash algorithm Returns the HMAC for ``msg`` based on the key and hash algorithm
...@@ -463,10 +464,11 @@ Example:: ...@@ -463,10 +464,11 @@ Example::
.. _func_version: .. _func_version:
STRING version() version
---------------- -------
::
Prototype
STRING version() STRING version()
Returns the version string for this VMOD. Returns the version string for this VMOD.
...@@ -536,7 +538,13 @@ SEE ALSO ...@@ -536,7 +538,13 @@ SEE ALSO
COPYRIGHT COPYRIGHT
========= =========
This document is licensed under the same conditions as the ::
libvmod-blobcode project. See `LICENSE <LICENSE>`_ for details.
Copyright (c) 2016 UPLEX Nils Goroll Systemoptimierung
All rights reserved
Author: Geoffrey Simmons <geoffrey.simmons@uplex.de>
See LICENSE
* Copyright (c) 2016 UPLEX Nils Goroll Systemoptimierung
...@@ -83,7 +83,7 @@ Here are some examples:: ...@@ -83,7 +83,7 @@ Here are some examples::
import blobdigest; import blobdigest;
import blobcode; import blobcode;
import blob; import blob;
sub vcl_init { sub vcl_init {
# Create a BLOB consisting of the string "foo" # Create a BLOB consisting of the string "foo"
new foo = blobcode.blob(IDENTITY, "foo"); new foo = blobcode.blob(IDENTITY, "foo");
...@@ -138,7 +138,7 @@ and returns the result. It is functionally equivalent to using a ...@@ -138,7 +138,7 @@ and returns the result. It is functionally equivalent to using a
import blobdigest; import blobdigest;
import blobcode; import blobcode;
sub vcl_init { sub vcl_init {
# Create a SHA256 context # Create a SHA256 context
new sha256 = blobdigest.digest(SHA256); new sha256 = blobdigest.digest(SHA256);
...@@ -188,9 +188,6 @@ values: ...@@ -188,9 +188,6 @@ values:
$Object digest(ENUM {CRC32, MD5, SHA1, SHA224, SHA256, SHA384, SHA512, SHA3_224, $Object digest(ENUM {CRC32, MD5, SHA1, SHA224, SHA256, SHA384, SHA512, SHA3_224,
SHA3_256, SHA3_384, SHA3_512} hash, BLOB init=0) SHA3_256, SHA3_384, SHA3_512} hash, BLOB init=0)
Prototype
new OBJ = blobdigest.digest(ENUM hash[, BLOB init])
Initialize a message digest context for the algorithm ``hash``, and Initialize a message digest context for the algorithm ``hash``, and
optionally update it with ``init``. If ``init`` is left out, then an optionally update it with ``init``. If ``init`` is left out, then an
empty initial context is created. empty initial context is created.
...@@ -207,7 +204,7 @@ Example:: ...@@ -207,7 +204,7 @@ Example::
sub vcl_init { sub vcl_init {
# Create an empty digest context for SHA3_256 # Create an empty digest context for SHA3_256
new sha3_256 = blobdigest.digest(SHA3_256); new sha3_256 = blobdigest.digest(SHA3_256);
# Create a digest context for SHA512, and add "foo" # Create a digest context for SHA512, and add "foo"
# as a "prefix" for all other messages to be hashed. # as a "prefix" for all other messages to be hashed.
new foo = blobcode.blob(IDENTITY, "foo") new foo = blobcode.blob(IDENTITY, "foo")
...@@ -305,7 +302,7 @@ Example:: ...@@ -305,7 +302,7 @@ Example::
# Retrieve the hash for "foo" computed in vcl_init # Retrieve the hash for "foo" computed in vcl_init
set req.http.Foo-Hash set req.http.Foo-Hash
= blobcode.encode(BASE64, foohash.final()); = blobcode.encode(BASE64, foohash.final());
# Compute the base64-encoded SHA3_256 hash for "bar" # Compute the base64-encoded SHA3_256 hash for "bar"
if (!sha3_256.update(blobcode.decode(IDENTITY, "bar"))) { if (!sha3_256.update(blobcode.decode(IDENTITY, "bar"))) {
call do_client_error; call do_client_error;
...@@ -370,9 +367,6 @@ Example:: ...@@ -370,9 +367,6 @@ Example::
$Object hmac(ENUM {MD5, SHA1, SHA224, SHA256, SHA384, SHA512, SHA3_224, $Object hmac(ENUM {MD5, SHA1, SHA224, SHA256, SHA384, SHA512, SHA3_224,
SHA3_256, SHA3_384, SHA3_512} hash, BLOB key) SHA3_256, SHA3_384, SHA3_512} hash, BLOB key)
Prototype
new OBJ = blobdigest.hmac(ENUM hash, BLOB key)
Creates an object that generates HMACs based on the digest algorithm Creates an object that generates HMACs based on the digest algorithm
``hash`` and the given ``key``. ``hash`` and the given ``key``.
...@@ -472,11 +466,3 @@ SEE ALSO ...@@ -472,11 +466,3 @@ SEE ALSO
* https://github.com/rhash/RHash * https://github.com/rhash/RHash
* http://rhash.anz.ru/ * http://rhash.anz.ru/
COPYRIGHT
=========
This document is licensed under the same conditions as the
libvmod-blobcode project. See `LICENSE <LICENSE>`_ for details.
* Copyright (c) 2016 UPLEX Nils Goroll Systemoptimierung
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment