Skip to content

Commit

Permalink
Merge pull request #41 from rustyconover/fix_improve_crypto_docs
Browse files Browse the repository at this point in the history
fix: improve crypto docs
  • Loading branch information
carlopi authored Jul 9, 2024
2 parents 89a04e3 + 0723bb8 commit c7f441d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 6 deletions.
47 changes: 43 additions & 4 deletions extensions/crypto/description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ extension:
version: 1.0.0
language: C++
build: cmake
license: Apache-2.0
license: MIT
excluded_platforms: "windows_amd64_rtools;windows_amd64"
maintainers:
- rustyconover
Expand All @@ -15,7 +15,46 @@ repo:

docs:
hello_world: |
SELECT * from read_csv('seq 1 100 | grep 2 |');
-- Calculate the MD5 hash value of 'abcdef'
SELECT crypto_hash('md5', 'abcdef');
┌──────────────────────────────────┐
│ crypto_hash('md5', 'abcdef') │
│ varchar │
├──────────────────────────────────┤
│ e80b5017098950fc58aad83c8c14978e │
└──────────────────────────────────┘
-- Calculate a HMAC
SELECT crypto_hmac('sha2-256', 'secret key', 'secret message');
┌──────────────────────────────────────────────────────────────────┐
│ crypto_hmac('sha2-256', 'secret key', 'secret message') │
│ varchar │
├──────────────────────────────────────────────────────────────────┤
│ 2df792e08cefdc0ea9900c67c93cbe66b98231b829a5dccd3857a03baac35963 │
└──────────────────────────────────────────────────────────────────┘
extended_description: |
This extension, `crypto`, adds cryptographic hash functions and
the ability to calculate a HMAC to DuckDB's SQL engine.
`crypto` provides two functions:
- `crypto_hash` applies cryptographically secure hash functions
and returns the result as a hex encoded value.
- `crypto_hmac` calculates the HMAC using a secret key and a
specific hash function.
The supported hash functions are:
- `blake2b-512`
- `keccak224`
- `keccak256`
- `keccak384`
- `keccak512`
- `md4`
- `md5`
- `sha1`
- `sha2-224`
- `sha2-256`
- `sha2-384`
- `sha2-512`
- `sha3-224`
- `sha3-256`
- `sha3-384`
- `sha3-512`
4 changes: 2 additions & 2 deletions extensions/crypto/docs/function_descriptions.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
function,description,comment,example
crypto_hash,"Calculate the value of a hash function","","select crypto_hash('md5', 'test');"
crypto_hmac,"Calculate a HMAC value","","select crypto_hmac('sha2-256', 'secret key', 'secret message');"
"crypto_hash","Apply a cryptographic hash function specified as the first argument to the data supplied as the second argument.","","SELECT crypto_hash('md5', 'test');"
"crypto_hmac","Calculate a HMAC value","","SELECT crypto_hmac('sha2-256', 'secret key', 'secret message');"

0 comments on commit c7f441d

Please sign in to comment.