Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-blobdigest
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-blobdigest
Commits
c9b0da17
Commit
c9b0da17
authored
Dec 10, 2017
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ICRC32
parent
235534b9
Pipeline
#409
skipped
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
19 deletions
+31
-19
README.rst
README.rst
+6
-4
tbl_algorithm.h
src/tbl_algorithm.h
+1
-0
icrc32.vtc
src/tests/icrc32.vtc
+7
-11
vmod_blobdigest.c
src/vmod_blobdigest.c
+7
-0
vmod_blobdigest.h
src/vmod_blobdigest.h
+4
-0
vmod_blobdigest.vcc
src/vmod_blobdigest.vcc
+6
-4
No files found.
README.rst
View file @
c9b0da17
...
...
@@ -188,6 +188,8 @@ The ``hash`` enum in the following can have one of the following
values:
* ``CRC32`` (not for HMACs)
* ``ICRC32`` (not for HMACs): CRC32 variant with inverted initialization
and result
* ``MD5``
* ``RS`` (not for HMACs)
* ``SHA1``
...
...
@@ -203,8 +205,8 @@ values:
CONTENTS
========
* digest(ENUM {CRC32,
RS,MD5
,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512}, BLOB, ENUM {TASK,TOP})
* BLOB hash(ENUM {CRC32,MD5,RS,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512}, BLOB)
* digest(ENUM {CRC32,
ICRC32,MD5,RS
,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512}, BLOB, ENUM {TASK,TOP})
* BLOB hash(ENUM {CRC32,
ICRC32,
MD5,RS,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512}, BLOB)
* hmac(ENUM {MD5,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512}, BLOB)
* BLOB hmacf(ENUM {MD5,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512}, BLOB, BLOB)
* STRING version()
...
...
@@ -217,7 +219,7 @@ digest
::
new OBJ = digest(ENUM {CRC32,
RS,MD5
,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512} hash, BLOB init=0, ENUM {TASK,TOP} scope=TASK)
new OBJ = digest(ENUM {CRC32,
ICRC32,MD5,RS
,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512} hash, BLOB init=0, ENUM {TASK,TOP} scope=TASK)
Initialize a message digest context for the algorithm ``hash``, and
optionally update it with ``init``. If ``init`` is left out, then an
...
...
@@ -404,7 +406,7 @@ hash
::
BLOB hash(ENUM {CRC32,MD5,RS,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512} hash, BLOB msg)
BLOB hash(ENUM {CRC32,
ICRC32,
MD5,RS,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512} hash, BLOB msg)
Returns the message digest for ``msg`` as specified by ``hash``.
...
...
src/tbl_algorithm.h
View file @
c9b0da17
VMODENUM
(
CRC32
)
VMODENUM
(
ICRC32
)
VMODENUM
(
MD5
)
VMODENUM
(
RS
)
VMODENUM
(
SHA1
)
...
...
src/tests/icrc32.vtc
View file @
c9b0da17
...
...
@@ -191,31 +191,27 @@ client c1 {
rxresp
expect resp.status == 200
# from librhash
expect resp.http.empty == "00000000"
expect resp.http.emptyf == resp.http.empty
expect resp.http.a == "
00000061
"
expect resp.http.a == "
3AB551CE
"
expect resp.http.as == resp.http.a
expect resp.http.af == resp.http.a
expect resp.http.abc == "
B1012AAC
"
expect resp.http.abc == "
CA6598D0
"
expect resp.http.abcs == resp.http.abc
expect resp.http.abcf == resp.http.abc
expect resp.http.msgdigest == "
B4ACD743
"
expect resp.http.msgdigest == "
F1AEE4B8
"
expect resp.http.msgdigests == resp.http.msgdigest
expect resp.http.msgdigestf == resp.http.msgdigest
expect resp.http.alphalc == "
C19D0661
"
expect resp.http.alphalc == "
E3CBEE8F
"
expect resp.http.alphalcs == resp.http.alphalc
expect resp.http.alphalcf == resp.http.alphalc
expect resp.http.alphanum == "
4389DF19
"
expect resp.http.alphanum == "
02A641B3
"
expect resp.http.alphanums == resp.http.alphanum
expect resp.http.alphanumf == resp.http.alphanum
expect resp.http.digits == "
9DA5ECA0
"
expect resp.http.digits == "
F28A5294
"
expect resp.http.digitss == resp.http.digits
expect resp.http.digitsf == resp.http.digits
expect resp.http.pangram == "
29A4500B
"
expect resp.http.pangram == "
B9C60808
"
expect resp.http.pangrams == resp.http.pangram
expect resp.http.pangramf == resp.http.pangram
expect resp.http.allbytes == "D65ECA00"
expect resp.http.allbytesf == resp.http.allbytes
} -run
src/vmod_blobdigest.c
View file @
c9b0da17
...
...
@@ -119,6 +119,9 @@ static void
init
(
const
enum
algorithm
hash
,
hash_ctx
*
const
hctx
)
{
switch
(
hash
)
{
case
ICRC32
:
hctx
->
uint32
[
0
]
=
~
0U
;
break
;
case
CRC32
:
hctx
->
uint32
[
0
]
=
0
;
break
;
...
...
@@ -166,6 +169,7 @@ update(const enum algorithm hash, hash_ctx *restrict const hctx,
const
uint8_t
*
restrict
const
msg
,
const
size_t
len
)
{
switch
(
hash
)
{
case
ICRC32
:
case
CRC32
:
hctx
->
uint32
[
0
]
=
rhash_get_crc32
(
hctx
->
uint32
[
0
],
msg
,
len
);
break
;
...
...
@@ -204,6 +208,9 @@ final(const enum algorithm hash, hash_ctx *restrict const hctx,
uint8_t
*
restrict
result
)
{
switch
(
hash
)
{
case
ICRC32
:
hctx
->
uint32
[
0
]
^=
~
0U
;
/* FALLTHROUGH */
case
CRC32
:
case
RS
:
be32_copy
(
result
,
0
,
&
hctx
->
uint32
[
0
],
sizeof
(
uint32_t
));
...
...
src/vmod_blobdigest.h
View file @
c9b0da17
...
...
@@ -69,6 +69,10 @@ static const struct hashspec {
sizeof
(
uint32_t
),
sizeof
(
uint32_t
),
},
[
ICRC32
]
=
{
sizeof
(
uint32_t
),
sizeof
(
uint32_t
),
},
[
MD5
]
=
{
md5_hash_size
,
md5_block_size
,
...
...
src/vmod_blobdigest.vcc
View file @
c9b0da17
...
...
@@ -173,6 +173,8 @@ The ``hash`` enum in the following can have one of the following
values:
* ``CRC32`` (not for HMACs)
* ``ICRC32`` (not for HMACs): CRC32 variant with inverted initialization
and result
* ``MD5``
* ``RS`` (not for HMACs)
* ``SHA1``
...
...
@@ -185,8 +187,8 @@ values:
* ``SHA3_384``
* ``SHA3_512``
$Object digest(ENUM {CRC32,
RS, MD5, SHA1, SHA224, SHA256, SHA384, SHA512
,
SHA3_224, SHA3_256, SHA3_384, SHA3_512} hash,
$Object digest(ENUM {CRC32,
ICRC32, MD5, RS, SHA1, SHA224, SHA256, SHA384
,
SHA
512, SHA
3_224, SHA3_256, SHA3_384, SHA3_512} hash,
BLOB init=0, ENUM {TASK, TOP} scope=TASK)
Initialize a message digest context for the algorithm ``hash``, and
...
...
@@ -353,8 +355,8 @@ Example::
# Baz-Hash-Base64: base64-encoded SHA3_256 hash of "baz"
# Baz-Hash-Hex: hex-encoded SHA3_256 hash of "bar"
$Function BLOB hash(ENUM {CRC32,
MD5, RS, SHA1, SHA224, SHA256, SHA384, SHA512
,
SHA3_224, SHA3_256, SHA3_384, SHA3_512} hash,
$Function BLOB hash(ENUM {CRC32,
ICRC32, MD5, RS, SHA1, SHA224, SHA256, SHA384
,
SHA
512, SHA
3_224, SHA3_256, SHA3_384, SHA3_512} hash,
BLOB msg)
Returns the message digest for ``msg`` as specified by ``hash``.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment