Dalarna University's logo and link to the university's website

du.sePublications
Change search
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • chicago-author-date
  • chicago-note-bibliography
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
Vikten av pseudoslumptalsgeneratorer (PRNG) inom kryptografi och deras säkerhetskonsekvenser: Säkerhetsbrister inom pseudoslumptalsgeneratorer
Dalarna University, School of Information and Engineering.
Dalarna University, School of Information and Engineering.
Dalarna University, School of Information and Engineering.
2025 (Swedish)Independent thesis Basic level (professional degree), 10 credits / 15 HE creditsStudent thesisAlternative title
The Importance of Pseudorandom Number Generator (PRNGs) in Cryptography and Their Security Implications : Security Vulnerabilities in Pseudorandom Number Generators (English)
Abstract [en]

Pseudo-random number generators (PRNGs) are fundamental components in cryptographic systems, where secure and unpredictable randomness is essentialfor tasks such as key generation and authentication. However, developers often use PRNGs without a full understanding of their limitations and potential security vulnerabilities, which can result in critical weaknesses. This study aims to explore how developers can ensure the use of secure PRNGs, and to identify best practices and existing guidelines for avoiding weak implementations. To address this objective, the study combines a literature review with practical experiments. A selection of PRNG libraries available in Python was evaluated in terms of entropy and statistical randomness. All tests were carried out in controlled virtual environments with uniform system configurations. Two primary methods were employed: NIST SP 800-90B to assess entropy, and Dieharder to evaluate statistical properties. Generators like secrets, ssl_rand_bytes, and os.urandomyielded entropy values close to the theoretical maximum, while simpler libraries such as random and numpy.random produced results closer to the lower acceptable limit. Nonetheless, none of the tested generators passed the full battery of Dieharder tests.

The findings indicate that high entropy alone is not sufficient to ensure security. Even cryptographically secure PRNGs (CSPRNGs) may fail under comprehensive statistical testing, particularly under prolonged or intensive use. This underscores the importance of selecting the right PRNG based on the specific application and highlights the need for correct seed management and periodic entropy reseeding. To ensure robustness, developers should adhere to established standards like NIST SP 800-90A/B and comply with regulatory frameworks such as the NIS2 directive and recommendations from the Swedish Civil Contingencies Agency(MSB).

In conclusion, the most reliable approach involves combining a vetted CSPRNG with a validated entropy source. Generic PRNGs should be strictly avoided insecurity-sensitive scenarios. 

Abstract [sv]

Pseudo-slumptalsgeneratorer (PRNG) utgör en grundläggande komponent i kryptografiska system, där behovet av säkra och förutsägbara tal är avgörande, till exempel vid nyckelgenerering och autentisering. Trots detta tenderar många utvecklare att använda PRNG utan tillräcklig förståelse för dess begränsningar och potentiella säkerhetsrisker, vilket kan leda till allvarliga sårbarheter. Denna studie syftar till att undersöka hur utvecklare kan försäkra sig om att använda säkra PRNG- lösningar, samt att identifiera etablerade riktlinjer och rekomendationer för att undvika svaga implementationer. För att bevara frågeställningen kombineras en litteraturstudie med praktiska experiment där olika PRNG- bibliotek i Python analyseras utifrån entropi och statisk slumpmässighet. Samtliga tester har utförts i kontrollerande virtuella miljöer med identiska systeminställningar.

Två analysmetoder användes: NIST SP 800-90B för att mäta entropinivåer, samt Dieharder-tester för att granska de statiska egenskaperna hos slumptalssekvenser. Resultatet visade att bibliotek som secrets, ssl_rand_bytes och os.urandom uppnådde entropivärden nära det teoretiska maximumet, medan enklare bibliotek som random och numpy.random låg närmare den nedre godkända gränsen. Dock misslyckades samtliga testade bibliotek att fullt ut uppfylla kraven i Diehardertestet. Studien visar att hög entropi i sig inte är en garanti för säkerhet. Även kryptografiskt säkra generatorer (CSPRNG) kan underprestera i avancerade tester, särskilt vid långvarig eller olämplig användning. Det är därför avgörande att välja PRNG utifrån det specifika säkerhetskravet, samt att hantera seedning och entropikällor korrekt.

För att uppnå robust säkerhet rekommenderas att följa riktlinjer från bland annat NIST SP 800-90A/B, NIS2-direktivet och MSB:s vägledningar. Slutsatsen är att det bästa skyddet uppnås genom att kombinera en godkänd CSPRNG med en tillförlitlig och validerad entropikälla. Generiska PRNG bör undvikas i säkerhetskritiska sammanhang. 

Place, publisher, year, edition, pages
2025.
Keywords [en]
PRNG;Cryptography;Vulnerability;Attack;Secure
National Category
Computer Sciences
Identifiers
URN: urn:nbn:se:du-50753OAI: oai:DiVA.org:du-50753DiVA, id: diva2:1974462
Subject / course
Microdata Analysis
Available from: 2025-06-23 Created: 2025-06-23 Last updated: 2025-10-09

Open Access in DiVA

fulltext(1323 kB)55 downloads
File information
File name FULLTEXT01.pdfFile size 1323 kBChecksum SHA-512
5bb60956b0622dacdbc85e2694959fdae629e01c11aeade8a8da77cbd2bf6db945ec1b4da34a86a22916fb388537500b3868e70f5e4f45c31c15d2837c1c5e29
Type fulltextMimetype application/pdf

By organisation
School of Information and Engineering
Computer Sciences

Search outside of DiVA

GoogleGoogle Scholar
Total: 55 downloads
The number of downloads is the sum of all downloads of full texts. It may include eg previous versions that are now no longer available

urn-nbn

Altmetric score

urn-nbn
Total: 123 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • chicago-author-date
  • chicago-note-bibliography
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf