Skip to content

Commit 6ea287c

Browse files
Merge pull request #600 from rebane2001/patch-1
Use urandom for SECRET_SALT
2 parents cc432bf + e4b924a commit 6ea287c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/markdown2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
from random import randint, random
123123
from typing import Any, Callable, Collection, Dict, List, Literal, Optional, Tuple, Type, TypedDict, Union
124124
from enum import IntEnum, auto
125+
from os import urandom
125126

126127
if sys.version_info[1] < 9:
127128
from typing import Iterable
@@ -142,7 +143,7 @@
142143
DEFAULT_TAB_WIDTH = 4
143144

144145

145-
SECRET_SALT = bytes(randint(0, 1000000))
146+
SECRET_SALT = urandom(16)
146147
# MD5 function was previously used for this; the "md5" prefix was kept for
147148
# backwards compatibility.
148149
def _hash_text(s: str) -> str:

0 commit comments

Comments
 (0)