Giter Club home page Giter Club logo

rngeesus's Introduction

नमस्ते

GIF

  • GIF I’m currently working on my laptop?
  • GIF I’m currently learning the art of finding words to conquer life
  • GIF I’m looking to collaborate on weird ideas that would be least helpful
  • GIF I’m looking for help with looking serious in README
  • GIF Ask me about why having wheels on laptop is a bad idea
  • GIF Pronouns: recursion
  • GIF Fun fact: you had a good bad time
Jokes apart, I love participating in CTF contests (click to expand!)
Here are few profiles you may be interested to stalk
  • I play primarily under the team Project Sekai and zh3r0 when I feel lonely
  • If you love cryptography, then try finding me on cryptohack ❤️
  • I write challenge writeups sometimes
  • I am currently working on a ctf tutorial
  • I have been learning recently on TryHackMe and its fun!
  • Check out my Hacker Rank on WeChall and other linked profiles there 😉

If you love fractals, do check out my python library namely pyfractal
Moreover, collaborators needed for my skid trolling campaign

mail     mail     LinkedIn     LinkedIn     Twitter     ctftime     site    

rngeesus's People

Contributors

deut-erium avatar jsahil730 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rngeesus's Issues

Generic python seed recovery fails if previous random calls have been made

The function get_seeds_python_fast() seems to fail if a list of collected integers is provided that isn't directly made after initialization of the seed.

For example, this works:

import random
from mersenne import BreakerPy
random.seed(31337)
arr = []
for _ in range(0, 624):
    arr.append(random.getrandbits(32))
breaker = BreakerPy()
breaker.get_seeds_python_fast(arr)

While this fails (remove the + in front of random.getrandbits(32)):

import random
from mersenne import BreakerPy
random.seed(31337)
+ random.getrandbits(32) # could also be [random.getrandbits(32) for _ in range(0, 624)], or basically any range
arr = []
for _ in range(0, 624):
    arr.append(random.getrandbits(32))
breaker = BreakerPy()
breaker.get_seeds_python_fast(arr)

The error happens in seed_arr_len() function:

time taken : 8.973925113677979
Traceback (most recent call last):
  File "C:\Users\user\Downloads\RNGeesus\src\code_mersenne\solver.py", line 9, in <module>
    breaker.get_seeds_python_fast(arr)
  File "C:\Users\user\Downloads\RNGeesus\src\code_mersenne\mersenne.py", line 517, in get_seeds_python_fast
    slen = seed_arr_len(recovered)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\Downloads\RNGeesus\src\code_mersenne\mersenne.py", line 18, in seed_arr_len
    mode([j-i for i,j in zip(x,x[1:])])
  File "W:\scoop\apps\python\current\Lib\statistics.py", line 713, in mode
    raise StatisticsError('no mode for empty data') from None
statistics.StatisticsError: no mode for empty data
>>>

Code predicting seed 'None' when tested towards random.random?

Hi! Been trying to run towards random.random, but the predictor is just returning None.

Note, mersenne.py has been saved as rngeesus.py

Any tips would be appreciated!

from rngeesus import Breaker
from random import Random
from secrets import randbits


def sample():
    print("Sampling...")

    correct = 0
    iterations = 10000
    for _ in range(iterations):
        seed = randbits(32)

        rng = Random(seed)

        # Empty the RNG that is filled from /dev/urandom
        # I think this is necessary to get a predictable RNG
        for _ in range(624):
            rng.getrandbits(32)

        b = Breaker()
        # Two values in the format (index, value)
        vals = [
            (0, rng.getrandbits(32)),
            (1, rng.getrandbits(32)),
            (2, rng.getrandbits(32)),
        ]

        print(vals)
        print("Predicting...")

        # This line always returns None for some reason?
        recovered_seed = b.get_seed_mt(vals)

        # Get the next value from the RNG
        # We will use this to check if the predictor is correct
        print(f"Actual seed: {seed}")
        print(f"Predicted seed: {recovered_seed}")

        if recovered_seed == seed:
            print("Correct!")
            correct += 1

        print(f"Current status: {correct}/{iterations}")

    print(f"Correct: {correct}/{iterations}")


if __name__ == "__main__":
    sample()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.