Skip to content

Commit 4cdec0e

Browse files
authored
docs: update yacl docs (#516)
1 parent 7f01c60 commit 4cdec0e

File tree

5 files changed

+65
-1
lines changed

5 files changed

+65
-1
lines changed

STANDARDS.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Supported Cryptographic Standards
2+
3+
This library provides full implementation of the following NIST-standardized cryptography specifications:
4+
5+
## **Core Algorithms**
6+
- **AES** (FIPS 197)
7+
8+
- **SM3** (GM/T 0004-2012)
9+
10+
- **SM4** (GM/T 0002-2012)
11+
12+
- **SHA2/SHA3 Family** (FIPS 180-4, FIPS 202)
13+
14+
- **HMAC** (FIPS 198-1)
15+
16+
- **KMAC** (SP 800-56B)
17+
18+
## **Post-Quantum Cryptography**
19+
- **ML-KEM** (FIPS 203)
20+
21+
- **ML-DSA** (FIPS 204)
22+
23+
## **Digital Signatures**
24+
- **DSA** (FIPS 186)
25+
26+
## Public Key Cryptography
27+
- **RSA** (SP 800-185)
28+
29+
## **Elliptic Curve Cryptography**
30+
- **ECC** (GM/T 0003-2012, FIPS 186-4, RFC 7748, RFC 8032)
31+
- **Hash-to-Curve** (RFC 9380)
32+
33+
## **Secure Randomness**
34+
- **Hash-DRBG** (SP 800-90A)
35+
36+
- **CTR-DRBG** (SP 800-90A)
37+
38+
- **Entropy Sources** (SP 800-90B)
39+
40+
## **Authenticated Encryption**
41+
- **AES-GCM** (SP 800-38D)
42+
43+
- **AEAD** (RFC 5116)
44+
45+
---

docs/imgs/yacl_arch.png

185 KB
Loading

docs/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ YACL (Yet Another Common Cryptography Library) is a sub-project of `SecretFlow <
77
- **About Network ("link") Modules:** The network ("link") module in Yacl uses `BRPC <https://brpc.apache.org/>`_ to handle network. And we also provide a "mocked" in-memory link.
88
- **About IO Modules:** Yacl also provides many io modules for kv storage, file io, `bristol circuits <https://nigelsmart.github.io/MPC-Circuits/>`_, and so on.
99

10+
.. image:: ./imgs/yacl_arch.png
11+
:width: 800
12+
:alt: Alternative text
13+
1014
The following parts describes the top-level folders of Yacl repository.
1115

1216
- `yacl/base/ <https://github.com/secretflow/yacl/tree/main/yacl/base>`_: some basic types and utils in yacl.

docs/src/develop/index.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Develop
33

44
**For Traditioanl PKI:** Since there are so many existing time-proof, efficient, and standardized implementation of PKI algorithms, Yacl **does not re-implement** those algorithms. Instead, Yacl only provides a light-weighted and "easy-to-use" wrapper for the most popular industrial libraries (e.g. `OpenSSL <https://openssl.org/>`_, `TongSuo <https://github.com/Tongsuo-Project>`_, `LibSodium <https://doc.libsodium.org/>`_, etc.)
55

6-
**For ECC (Elliptic-Curve Cryptography):** Yacl integrates many curve implementation from OpenSSL, you may use the code in the following to use any curve as you like. For more information about all supported curve names, see: `yacl/crypto/ecc/curve_meta.cc <https://github.com/secretflow/yacl/blob/main/yacl/crypto/ecc/curve_meta.cc>`_
6+
**For ECC (Elliptic-Curve Cryptography):** Yacl integrates many curve implementation from OpenSSL, MCL, LibSodium and other libraries, you may use the code in the following to use any curve as you like. For more information about all supported curve names, see: `yacl/crypto/ecc/curve_meta.cc <https://github.com/secretflow/yacl/blob/main/yacl/crypto/ecc/curve_meta.cc>`_
77

88
.. code-block:: cpp
99
@@ -21,6 +21,19 @@ Develop
2121
// ec->Mul(/* first point */, /* second scalar */);
2222
// ... for more see: yacl/crypto/ecc/ecc_spi.h
2323
24+
**For Hashing:** Yacl provides various hash functions, such as SHA256, SM3, Blake3, Shake256 and so on. You can use the code in the following to hash your data. For more information about all supported hash functions, see: `yacl/crypto/hash/hash_utils.cc <https://github.com/secretflow/yacl/blob/main/yacl/crypto/hash/hash_utils.cc>`_
25+
26+
.. code-block:: cpp
27+
28+
#include "yacl/crypto/hash/hash_utils.h"
29+
30+
auto sha256_hash = yacl::crypto::Sha256(/* your data */);
31+
auto sm3_hash = yacl::crypto::Sm3(/* your data */);
32+
33+
// You can also use the following to hash your data
34+
// auto sha256_hash = yacl::crypto::SslHash(HashAlgorithm::SHA256).Update(/* your data */).CumulativeHash();
35+
// ... for more see: yacl/crypto/hash/hash_utils.h and yacl/crypto/hash/ssl_hash.h
36+
2437
**For Randomness** Yacl has also provide some easy-to-use randomness generation functions. Random functions usually start with **Secure** or **Fast**, secure random implementation uses the standardized ctr-drbg, and fast uses hash-drbg. It is always recommended to use **Secure**-Random functions.
2538

2639
.. code-block:: cpp

docs/src/standards.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.. include:: ../../STANDARDS.md
2+
:parser: myst_parser.sphinx_

0 commit comments

Comments
 (0)