Skip to content

Commit b3ba31d

Browse files
lucasloispcmccandless
authored andcommitted
Adds hints to cryptography/randomness exercises (#967)
Adds HINTS file to "rail-fence-cipher" Adds HINTS file to "simple-cipher" Adds HINTS file to "rotational-cipher" Adds HINTS file to "robot-name"
1 parent 0d0d453 commit b3ba31d

File tree

4 files changed

+64
-2
lines changed

4 files changed

+64
-2
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Should I use random or secrets?
2+
3+
Python, as of version 3.6, includes two different random modules.
4+
5+
The module called `random` is pseudo-random, meaning it does not generate
6+
true randomness, but follows an algorithm that simulates randomness.
7+
Since random numbers are generated through a known algorithm, they are not truly random.
8+
9+
The `random` module is not correctly suited for cryptography and should not be used,
10+
precisely because it is pseudo-random.
11+
12+
For this reason, in version 3.6, Python introduced the `secrets` module, which generates
13+
cryptographically strong random numbers that provide the greater security required for cryptography.
14+
15+
Since this is only an exercise, `random` is fine to use, but note that **it would be
16+
very insecure if actually used for cryptography.**

exercises/diffie-hellman/README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,22 @@ Bob calculates
3737
The calculations produce the same result! Alice and Bob now share
3838
secret s.
3939

40-
## Notes
40+
## Should I use random or secrets?
4141

42-
Python, as of version 3.6, includes two different random modules. The module called `random` is pseudo-random, meaning it does not generate true randomness, but follows and algorithm that simulates randomness. Since random numbers are generated through a known algorithm, they are not truly random. The `random` module is not correctly suited for cryptography and should not be used, because it is pseudo-random. In version 3.6, Python introduced the `secrets` module, which generates cryptographically strong random numbers that provide the greater security required for cryptography. Since this is only an exercise, `random` is fine to use, but note that it would be very insecure if actually used for cryptography.
42+
Python, as of version 3.6, includes two different random modules.
43+
44+
The module called `random` is pseudo-random, meaning it does not generate
45+
true randomness, but follows an algorithm that simulates randomness.
46+
Since random numbers are generated through a known algorithm, they are not truly random.
47+
48+
The `random` module is not correctly suited for cryptography and should not be used,
49+
precisely because it is pseudo-random.
50+
51+
For this reason, in version 3.6, Python introduced the `secrets` module, which generates
52+
cryptographically strong random numbers that provide the greater security required for cryptography.
53+
54+
Since this is only an exercise, `random` is fine to use, but note that **it would be
55+
very insecure if actually used for cryptography.**
4356

4457
### Submitting Exercises
4558

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Should I use random or secrets?
2+
3+
Python, as of version 3.6, includes two different random modules.
4+
5+
The module called `random` is pseudo-random, meaning it does not generate
6+
true randomness, but follows an algorithm that simulates randomness.
7+
Since random numbers are generated through a known algorithm, they are not truly random.
8+
9+
The `random` module is not correctly suited for cryptography and should not be used,
10+
precisely because it is pseudo-random.
11+
12+
For this reason, in version 3.6, Python introduced the `secrets` module, which generates
13+
cryptographically strong random numbers that provide the greater security required for cryptography.
14+
15+
Since this is only an exercise, `random` is fine to use, but note that **it would be
16+
very insecure if actually used for cryptography.**

exercises/simple-cipher/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,23 @@ on Wikipedia][dh] for one of the first implementations of this scheme.
8383
[1]: https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Caesar_cipher_left_shift_of_3.svg/320px-Caesar_cipher_left_shift_of_3.svg.png
8484
[dh]: http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange
8585

86+
## Should I use random or secrets?
87+
88+
Python, as of version 3.6, includes two different random modules.
89+
90+
The module called `random` is pseudo-random, meaning it does not generate
91+
true randomness, but follows an algorithm that simulates randomness.
92+
Since random numbers are generated through a known algorithm, they are not truly random.
93+
94+
The `random` module is not correctly suited for cryptography and should not be used,
95+
precisely because it is pseudo-random.
96+
97+
For this reason, in version 3.6, Python introduced the `secrets` module, which generates
98+
cryptographically strong random numbers that provide the greater security required for cryptography.
99+
100+
Since this is only an exercise, `random` is fine to use, but note that **it would be
101+
very insecure if actually used for cryptography.**
102+
86103
### Submitting Exercises
87104

88105
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.

0 commit comments

Comments
 (0)