mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-17 02:48:34 +03:00
use secrets.SystemRandom as secure random nr source
secrets.SystemRandom is defined as the most secure random source available on the given operating system. Change-Id: I8049cd1292674b3ced82b0926569128535af6efe
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import random
|
import secrets
|
||||||
import re
|
import re
|
||||||
from osmocom.utils import b2h
|
from osmocom.utils import b2h
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ class DecimalRangeSource(InputExpandingParamSource):
|
|||||||
return cls(num_digits=len(first_str), first_value=first_value, last_value=last_value)
|
return cls(num_digits=len(first_str), first_value=first_value, last_value=last_value)
|
||||||
|
|
||||||
class RandomSourceMixin:
|
class RandomSourceMixin:
|
||||||
random_impl = random.SystemRandom()
|
random_impl = secrets.SystemRandom()
|
||||||
|
|
||||||
class RandomDigitSource(DecimalRangeSource, RandomSourceMixin):
|
class RandomDigitSource(DecimalRangeSource, RandomSourceMixin):
|
||||||
"""return a different sequence of random decimal digits each"""
|
"""return a different sequence of random decimal digits each"""
|
||||||
|
|||||||
Reference in New Issue
Block a user