You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2020-08-20-torchcsprng-release-blog.md
+18-8
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ author: Team PyTorch
6
6
7
7
[torchcsprng](https://github.com/pytorch/csprng) is a PyTorch [C++/CUDA extension](https://pytorch.org/tutorials/advanced/cpp_extension.html) that provides [cryptographically secure pseudorandom number generators](https://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator) for PyTorch.
8
8
9
-
One of the key components of modern cryptography is the pseudorandom number generator. The use of badly designed or inappropriate random number generators can often leave a good cryptosystem vulnerable to attack. Particular care must be taken to use a random number generator that is designed for cryptographic use, rather than a "general-purpose" random number generator which may be fine for some applications but not ones that are required to be cryptographically secure. Additionally, most pseudorandom number generators scale poorly to massively parallel high-performance computation because of their sequential nature. Others don’t satisfy cryptographically secure properties.
9
+
One of the key components of modern cryptography is the pseudorandom number generator. Katz and Lindell stated, "The use of badly designed or inappropriate random number generators can often leave a good cryptosystem vulnerable to attack. Particular care must be taken to use a random number generator that is designed for cryptographic use, rather than a 'general-purpose' random number generator which may be fine for some applications but not ones that are required to be cryptographically secure."[1] Additionally, most pseudorandom number generators scale poorly to massively parallel high-performance computation because of their sequential nature. Others don’t satisfy cryptographically secure properties.
10
10
11
11
## torchcsprng overview
12
12
@@ -28,11 +28,15 @@ The torchcsprng API is very simple to use and is fully compatible with the PyTor
28
28
29
29
Anaconda:
30
30
31
-
`conda install torchcsprng -c pytorch`
31
+
```python
32
+
conda install torchcsprng -c pytorch
33
+
```
32
34
33
35
pip:
34
36
35
-
`pip install torchcsprng`
37
+
```python
38
+
pip install torchcsprng
39
+
```
36
40
37
41
**Step 2: import packages as usual but add csprng**
38
42
@@ -43,17 +47,23 @@ import torchcsprng as csprng
43
47
44
48
**Step 3: Create a cryptographically secure pseudorandom number generator from /dev/urandom:**
Another advantage of torchcsprng generators is that they are parallel on CPU unlike the default PyTorch CPU generator.
59
69
@@ -65,7 +75,7 @@ Cheers,
65
75
66
76
The PyTorch Team
67
77
68
-
78
+
[1][Introduction to Modern Cryptography: Principles and Protocols (Chapman & Hall/CRC Cryptography and Network Security Series)](https://www.amazon.com/Introduction-Modern-Cryptography-Principles-Protocols/dp/1584885513) by Jonathan Katz and Yehuda Lindell
0 commit comments