22 releases (13 breaking)

0.24.0 Oct 31, 2024
0.22.0 Sep 3, 2024
0.20.0 Jun 27, 2024
0.6.1 Mar 4, 2024
0.1.2 Mar 31, 2023

#411 in Cryptography

Download history 1586/week @ 2024-07-30 1159/week @ 2024-08-06 931/week @ 2024-08-13 1560/week @ 2024-08-20 1341/week @ 2024-08-27 1994/week @ 2024-09-03 1170/week @ 2024-09-10 1183/week @ 2024-09-17 1727/week @ 2024-09-24 1367/week @ 2024-10-01 793/week @ 2024-10-08 938/week @ 2024-10-15 1259/week @ 2024-10-22 1829/week @ 2024-10-29 1442/week @ 2024-11-05 1617/week @ 2024-11-12

6,384 downloads per month
Used in 44 crates (11 directly)

MIT/Apache and maybe LGPL-3.0-only

595KB
9K SLoC

tor-hscrypto

tor-hscrypto: Basic cryptography used by onion services

Overview

This crate is part of Arti, a project to implement Tor in Rust.

Onion services and the clients that connect to them need a few cryptographic operations not used by the rest of Tor. These include:

  • A set of key-blinding operations to derive short-term public keys from long-term public keys.
  • An ad-hoc SHA3-based message authentication code.
  • Operations to encode and decode public keys as .onion addresses.
  • A set of operations to divide time into different "periods". These periods are used as inputs to the DHT-style hash ring, and to the key-blinding operations.
  • Proof of work schemes for resisting denial of service attacks

This crate implements those operations, along with a set of wrapper types to keep us from getting confused about the numerous keys and nonces used for the onion services.

Compile-time features

  • memquota-memcost -- implement tor_memquota::HasMemoryCost for many types. (Does not actually force compiling in memory quota tracking; that's memquota in tor-memquota and higher-level crates.)

  • ope -- support for Order Preserving Encryption

  • full -- Enable all features above.

Experimental and unstable features

Note that the APIs enabled by these features are NOT covered by semantic versioning[^1] guarantees: we might break them or remove them between patch versions.

  • pow-v1 -- Tor Hidden Services Proof of Work (v1 scheme only)

  • pow-full -- Tor Hidden Services Proof of Work (metafeature, enables all non-experimental schemes: currently, implies only pow-v1).

  • experimental: Enable all the above experimental features.

[^1]: Remember, semantic versioning is what makes various cargo features work reliably. To be explicit: if you want cargo update to only make safe changes, then you cannot enable these features.

License

MIT OR Apache-2.0

When the pow feature is used, we link with LGPL licensed dependencies.

Dependencies

~11–22MB
~311K SLoC