Skip to content

Commit

Permalink
change to xof
Browse files Browse the repository at this point in the history
  • Loading branch information
GiacomoPope committed Jul 28, 2024
1 parent b9a566e commit f2d59c3
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "xof_py"
name = "xof"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "xof_py"
name = "xof"
crate-type = ["cdylib"]

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ maturin develop --release
You should now be able to use the package:

```py
>>> from xof_py import pyo3_shake_128
>>> from xof import pyo3_shake_128
>>> pyo3_shake_128(b"cryptohack", 100).hex()
'8d043455562ebedd1b3fcf5b0e0a058091752d161e7eef40364a565aacb3b5d3bbefa804de6087e77c4c211ef57ab83869e3e18627f8421540ae9a8b61da847d0da513c56c5feba397ab2b4a1a2ef67c6f17162c8dfdb41901ad70bca8195fd35bcea259'
```
Expand Down
2 changes: 1 addition & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ API Documentation
.. autosummary::
:toctree: generated/

xof_py
xof
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.. xof_py documentation master file, created by
.. xof documentation master file, created by
sphinx-quickstart on Sat Jul 27 23:21:22 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to xof_py's documentation!
Welcome to xof's documentation!
==================================

.. toctree::
Expand Down
2 changes: 1 addition & 1 deletion docs/xof_py.rst → docs/xof.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ xof\_py package
Module contents
---------------

.. automodule:: xof_py
.. automodule:: xof
:members:
:undoc-members:
:show-inheritance:
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["maturin>=1.7,<2.0"]
build-backend = "maturin"

[project]
name = "xof_py"
name = "xof"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Rust",
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ use sha3::{
macro_rules! impl_sponge_shaker_classes {
// hasher is tt so we can pick the right kind of methods to generate
($hasher:tt, $xof_reader:ident, $shaker_name:ident, $sponge_name:ident) => {
#[pyclass(module="xof_py")]
#[pyclass(module="xof")]
#[doc=concat!(stringify!($shaker_name), " implements absorption and finalization for the ", stringify!($hasher), " XOF")]
struct $shaker_name {
hasher: $hasher,
}

impl_sponge_shaker_classes!(@shaker_methods $hasher, $shaker_name, $sponge_name);

#[pyclass(module="xof_py")]
#[pyclass(module="xof")]
#[doc=concat!(stringify!($sponge_name), " implements sponge expansion for the ", stringify!($hasher), " XOF")]
struct $sponge_name {
xof: XofReaderCoreWrapper<$xof_reader>,
Expand Down Expand Up @@ -157,7 +157,7 @@ impl_sponge_shaker_classes!(

/// A Python module implemented in Rust.
#[pymodule]
fn xof_py(m: &Bound<'_, PyModule>) -> PyResult<()> {
fn xof(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_class::<Sponge128>()?;
m.add_class::<Shaker128>()?;
m.add_class::<Sponge256>()?;
Expand Down
6 changes: 6 additions & 0 deletions xof_py.pyi → xof.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,11 @@ class TurboShaker256:
...

class TurboSponge256:
"""
Can you do doc strings here?
"""
def read(self, n: int) -> bytes:
"""
Or here?
"""
...

0 comments on commit f2d59c3

Please sign in to comment.