Releases: pytorch/csprng
PyTorch/CSPRNG 0.2.1 now supports float16 and bfloat16 for all ops
PyTorch/CSPRNG 0.2.0 released w/ CUDA 11, New APIs for encryption/decryption, Windows CUDA support and more
PyTorch/CSPRNG 0.2.0 Release Notes
New API: encrypt/decrypt (#83)
torchcsprng 0.2.0 exposes new API for tensor encryption/decryption. Tensor encryption/decryption API is dtype agnostic, so a tensor of any dtype can be encrypted and the result can be stored to a tensor of any dtype. An encryption key also can be a tensor of any dtype. Currently torchcsprng supports AES cipher with 128-bit key in two modes: ECB and CTR.
torchcsprng.encrypt(input: Tensor, output: Tensor, key: Tensor, cipher: string, mode: string)
input
tensor can be any CPU or CUDA tensor of any dtype and size in bytes(zero-padding is used to make its size in bytes divisible by block size in bytes)output
tensor can have any dtype and the same device asinput
tensor and the size in bytes rounded up to the block size in bytes(16 bytes for AES 128)key
tensor can have any dtype and the same device asinput
tensor and size in bytes equal to 16 for AES 128cipher
currently can be only one supported value"aes128"
mode
currently can be either"ecb"
or"ctr"
torchcsprng.decrypt(input: Tensor, output: Tensor, key: Tensor, cipher: string, mode: string)
input
tensor can be any CPU or CUDA tensor of any dtype with size in bytes divisible by the block size in bytes(16 bytes for AES 128)output
tensor can have any dtype but the same device asinput
tensor and the same size in bytes asinput
tensorkey
tensor can have any dtype and the same device asinput
tensor and size in bytes equal to 16 for AES 128cipher
currently can be only one supported value"aes128"
mode
currently can be either"ecb"
or"ctr"
CUDA 11 support (#82)
CUDA 11 is now officially supported with binaries available via pip and conda
End of support CUDA 9.2
since PyTorch stopped support of CUDA 9.2, torchcsprng also stopped supporting CUDA 9.2
Windows CUDA support (#40)
Compilation issues with CUDA on Windows resolved and binaries with CUDA 10.1, 10.2, 11.1 support are available via pip and conda
Python 3.9 support
torchcsprng is available for Python 3.9 on Linux and Windows via conda and on Linux and Windows and macOS via pip
Updating PyTorch dependency to v1.7.1
PyTorch/CSPRNG 0.1.4 Release Notes
Fixes
- Updates dependency on pytorch to
v1.7.1
Updating PyTorch dependency to v1.7.0
PyTorch/CSPRNG now supports torch.randperm
PyTorch/CSPRNG 0.1.2 Release Notes
Features
The following list of methods are now supported:
Kernel | CUDA | CPU |
---|---|---|
randperm(n) | yes* | yes |
- the calculations are done on CPU and the result is copied to CUDA
Bug Fixes
Strict-aliasing violation in csprng.h fixed (#68)
The first release that provides methods to create cryptographically secure pseudorandom number generators
PyTorch/CSPRNG 0.1.1 Release Notes
Features
torchcsprng exposes two methods to create crypto-secure and non-crypto-secure PRNGs:
Method to create PRNG | Is crypto-secure? | Has seed? | Underlying implementation |
---|---|---|---|
create_random_device_generator(token: string=None) | yes | no | See std::random_device and its constructor. The implementation in libstdc++ expects token to name the source of random bytes. Possible token values include "default", "rand_s", "rdseed", "rdrand", "rdrnd", "/dev/urandom", "/dev/random", "mt19937", and integer string specifying the seed of the mt19937 engine. (Token values other than "default" are only valid for certain targets.) If token=None then constructs a new std::random_device object with an implementation-defined token. |
create_mt19937_generator(seed: int=None) | no | yes | See std::mt19937 and its constructor. Constructs a mersenne_twister_engine object, and initializes its internal state sequence to pseudo-random values. If seed=None then seeds the engine with default_seed. |
The following list of methods supports all forementioned PRNGs:
Kernel | CUDA | CPU |
---|---|---|
random_() | yes | yes |
random_(to) | yes | yes |
random_(from, to) | yes | yes |
uniform_(from, to) | yes | yes |
normal_(mean, std) | yes | yes |
cauchy_(median, sigma) | yes | yes |
log_normal_(mean, std) | yes | yes |
geometric_(p) | yes | yes |
exponential_(lambda) | yes | yes |