Skip to content
  • Hjem
  • Seneste
  • Etiketter
  • Populære
  • Verden
  • Bruger
  • Grupper
Temaer
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Kollaps
FARVEL BIG TECH
  1. Forside
  2. Ikke-kategoriseret
  3. For my birthday, my brother-in-law gave me a 4992-digit hex number that, when used as a seed for Python’s random number generator, makes it so that printing a sequence of “random” ASCII characters actually prints a birthday greeting.

For my birthday, my brother-in-law gave me a 4992-digit hex number that, when used as a seed for Python’s random number generator, makes it so that printing a sequence of “random” ASCII characters actually prints a birthday greeting.

Planlagt Fastgjort Låst Flyttet Ikke-kategoriseret
25 Indlæg 21 Posters 0 Visninger
  • Ældste til nyeste
  • Nyeste til ældste
  • Most Votes
Svar
  • Svar som emne
Login for at svare
Denne tråd er blevet slettet. Kun brugere med emne behandlings privilegier kan se den.
  • robinhouston@mathstodon.xyzR robinhouston@mathstodon.xyz

    For my birthday, my brother-in-law gave me a 4992-digit hex number that, when used as a seed for Python’s random number generator, makes it so that printing a sequence of “random” ASCII characters actually prints a birthday greeting.

    I find it rather amazing that this is possible!

    This is the program he sent with the seed:

    with open("seed.txt", encoding="ascii") as handle:
    seed = int(handle.read().strip(), 0)
    r = random.Random(seed)
    pending = ""
    while True:
    character = chr(r.randrange(128))
    if pending + character == "\x1e\x1f":
    break
    print(pending, end="")
    pending = character
    print()

    robjlow@mathstodon.xyzR This user is from outside of this forum
    robjlow@mathstodon.xyzR This user is from outside of this forum
    robjlow@mathstodon.xyz
    wrote sidst redigeret af
    #2

    @robinhouston I half expect that somehow to open up a youtube video of Rick Astley...

    ben@bluetoot.hardill.me.ukB 1 Reply Last reply
    0
    • robinhouston@mathstodon.xyzR robinhouston@mathstodon.xyz

      For my birthday, my brother-in-law gave me a 4992-digit hex number that, when used as a seed for Python’s random number generator, makes it so that printing a sequence of “random” ASCII characters actually prints a birthday greeting.

      I find it rather amazing that this is possible!

      This is the program he sent with the seed:

      with open("seed.txt", encoding="ascii") as handle:
      seed = int(handle.read().strip(), 0)
      r = random.Random(seed)
      pending = ""
      while True:
      character = chr(r.randrange(128))
      if pending + character == "\x1e\x1f":
      break
      print(pending, end="")
      pending = character
      print()

      robinhouston@mathstodon.xyzR This user is from outside of this forum
      robinhouston@mathstodon.xyzR This user is from outside of this forum
      robinhouston@mathstodon.xyz
      wrote sidst redigeret af
      #3

      He's just confessed how he did it!

      https://github.com/frazerpearce/TimeLord

      drmakimber@mathstodon.xyzD maxpool@mathstodon.xyzM thomastc@mastodon.gamedev.placeT N mags@post.lurk.orgM 6 Replies Last reply
      0
      • robjlow@mathstodon.xyzR robjlow@mathstodon.xyz

        @robinhouston I half expect that somehow to open up a youtube video of Rick Astley...

        ben@bluetoot.hardill.me.ukB This user is from outside of this forum
        ben@bluetoot.hardill.me.ukB This user is from outside of this forum
        ben@bluetoot.hardill.me.uk
        wrote sidst redigeret af
        #4

        @RobJLow @robinhouston It should be possible, just needs somebody to work out the seed. (infinite monkeys + typewriter -> Shakespeare)

        I'd be really interested in reading how the seed was generated.

        1 Reply Last reply
        0
        • robinhouston@mathstodon.xyzR robinhouston@mathstodon.xyz

          He's just confessed how he did it!

          https://github.com/frazerpearce/TimeLord

          drmakimber@mathstodon.xyzD This user is from outside of this forum
          drmakimber@mathstodon.xyzD This user is from outside of this forum
          drmakimber@mathstodon.xyz
          wrote sidst redigeret af
          #5

          @robinhouston this is an absolute joy! What a gift.

          1 Reply Last reply
          0
          • robinhouston@mathstodon.xyzR robinhouston@mathstodon.xyz

            He's just confessed how he did it!

            https://github.com/frazerpearce/TimeLord

            maxpool@mathstodon.xyzM This user is from outside of this forum
            maxpool@mathstodon.xyzM This user is from outside of this forum
            maxpool@mathstodon.xyz
            wrote sidst redigeret af
            #6

            @robinhouston

            "The generation of random numbers is too important to be left to chance." – Coveyou, R.R. (1969)

            https://en.wikipedia.org/wiki/Robert_Coveyou

            1 Reply Last reply
            0
            • robinhouston@mathstodon.xyzR robinhouston@mathstodon.xyz

              For my birthday, my brother-in-law gave me a 4992-digit hex number that, when used as a seed for Python’s random number generator, makes it so that printing a sequence of “random” ASCII characters actually prints a birthday greeting.

              I find it rather amazing that this is possible!

              This is the program he sent with the seed:

              with open("seed.txt", encoding="ascii") as handle:
              seed = int(handle.read().strip(), 0)
              r = random.Random(seed)
              pending = ""
              while True:
              character = chr(r.randrange(128))
              if pending + character == "\x1e\x1f":
              break
              print(pending, end="")
              pending = character
              print()

              ionica@mathstodon.xyzI This user is from outside of this forum
              ionica@mathstodon.xyzI This user is from outside of this forum
              ionica@mathstodon.xyz
              wrote sidst redigeret af
              #7

              @robinhouston What an amazing gift!

              1 Reply Last reply
              0
              • robinhouston@mathstodon.xyzR robinhouston@mathstodon.xyz

                For my birthday, my brother-in-law gave me a 4992-digit hex number that, when used as a seed for Python’s random number generator, makes it so that printing a sequence of “random” ASCII characters actually prints a birthday greeting.

                I find it rather amazing that this is possible!

                This is the program he sent with the seed:

                with open("seed.txt", encoding="ascii") as handle:
                seed = int(handle.read().strip(), 0)
                r = random.Random(seed)
                pending = ""
                while True:
                character = chr(r.randrange(128))
                if pending + character == "\x1e\x1f":
                break
                print(pending, end="")
                pending = character
                print()

                joost_rekveld@assemblag.esJ This user is from outside of this forum
                joost_rekveld@assemblag.esJ This user is from outside of this forum
                joost_rekveld@assemblag.es
                wrote sidst redigeret af
                #8

                @robinhouston woah ! (and happy birthday !)

                1 Reply Last reply
                0
                • robinhouston@mathstodon.xyzR robinhouston@mathstodon.xyz

                  For my birthday, my brother-in-law gave me a 4992-digit hex number that, when used as a seed for Python’s random number generator, makes it so that printing a sequence of “random” ASCII characters actually prints a birthday greeting.

                  I find it rather amazing that this is possible!

                  This is the program he sent with the seed:

                  with open("seed.txt", encoding="ascii") as handle:
                  seed = int(handle.read().strip(), 0)
                  r = random.Random(seed)
                  pending = ""
                  while True:
                  character = chr(r.randrange(128))
                  if pending + character == "\x1e\x1f":
                  break
                  print(pending, end="")
                  pending = character
                  print()

                  ahltorp@mastodon.nuA This user is from outside of this forum
                  ahltorp@mastodon.nuA This user is from outside of this forum
                  ahltorp@mastodon.nu
                  wrote sidst redigeret af
                  #9

                  @robinhouston This is a direct consequence of what the note at the top of Python's "random" module warns about:

                  "Warning: The pseudo-random generators of this module should not be used for security purposes. For security or cryptographic uses, see the secrets module."

                  robinhouston@mathstodon.xyzR mattiebee@queer.gardenM 2 Replies Last reply
                  0
                  • ahltorp@mastodon.nuA ahltorp@mastodon.nu

                    @robinhouston This is a direct consequence of what the note at the top of Python's "random" module warns about:

                    "Warning: The pseudo-random generators of this module should not be used for security purposes. For security or cryptographic uses, see the secrets module."

                    robinhouston@mathstodon.xyzR This user is from outside of this forum
                    robinhouston@mathstodon.xyzR This user is from outside of this forum
                    robinhouston@mathstodon.xyz
                    wrote sidst redigeret af
                    #10

                    @ahltorp Well, I certainly wouldn't expect the output to be unpredictable given a known seed! But it's cool that it's possible to derive a seed that forces a specific sequence of outputs like that.

                    ahltorp@mastodon.nuA 1 Reply Last reply
                    0
                    • robinhouston@mathstodon.xyzR robinhouston@mathstodon.xyz

                      @ahltorp Well, I certainly wouldn't expect the output to be unpredictable given a known seed! But it's cool that it's possible to derive a seed that forces a specific sequence of outputs like that.

                      ahltorp@mastodon.nuA This user is from outside of this forum
                      ahltorp@mastodon.nuA This user is from outside of this forum
                      ahltorp@mastodon.nu
                      wrote sidst redigeret af
                      #11

                      @robinhouston Yes, any pseudo-number function must produce the same results each time you run it, that is what "function" means in mathematics. But that is not what is normally meant by "predictable".

                      What the warning is about is that the results of the "random" module are predictable in a very different way. The function is analysable, which means that you can predict it backwards and forwards, skip over steps, etc.

                      Cryptographically strong functions are not analysable.

                      1 Reply Last reply
                      0
                      • robinhouston@mathstodon.xyzR robinhouston@mathstodon.xyz

                        He's just confessed how he did it!

                        https://github.com/frazerpearce/TimeLord

                        thomastc@mastodon.gamedev.placeT This user is from outside of this forum
                        thomastc@mastodon.gamedev.placeT This user is from outside of this forum
                        thomastc@mastodon.gamedev.place
                        wrote sidst redigeret af
                        #12

                        @robinhouston Super cool! I guess this is only possible because the Mersenne Twister has such a huge state space (2 kB), making it likely that a valid seed exists. I think e.g. the PCG64 generator has only 128 bits of state, so any requested output of that length or longer would not likely be reproducible.

                        colinvparker@mathstodon.xyzC 1 Reply Last reply
                        0
                        • ahltorp@mastodon.nuA ahltorp@mastodon.nu

                          @robinhouston This is a direct consequence of what the note at the top of Python's "random" module warns about:

                          "Warning: The pseudo-random generators of this module should not be used for security purposes. For security or cryptographic uses, see the secrets module."

                          mattiebee@queer.gardenM This user is from outside of this forum
                          mattiebee@queer.gardenM This user is from outside of this forum
                          mattiebee@queer.garden
                          wrote sidst redigeret af
                          #13

                          @ahltorp @robinhouston yes, that’s indeed how it works, but this is still tremendously cool and delightful

                          ahltorp@mastodon.nuA 1 Reply Last reply
                          0
                          • mattiebee@queer.gardenM mattiebee@queer.garden

                            @ahltorp @robinhouston yes, that’s indeed how it works, but this is still tremendously cool and delightful

                            ahltorp@mastodon.nuA This user is from outside of this forum
                            ahltorp@mastodon.nuA This user is from outside of this forum
                            ahltorp@mastodon.nu
                            wrote sidst redigeret af
                            #14

                            @mattiebee @robinhouston The reason the demonstration is cool and delightful is because it plays on our expectations that it should not be possible, or at least very hard.

                            And in this case it turns out not to be hard, since cryptographically it's just a normal preimage attack on a system designed with no preimage resistance.

                            Be amazed, and then learn why your expectations were not correct.

                            1 Reply Last reply
                            0
                            • thomastc@mastodon.gamedev.placeT thomastc@mastodon.gamedev.place

                              @robinhouston Super cool! I guess this is only possible because the Mersenne Twister has such a huge state space (2 kB), making it likely that a valid seed exists. I think e.g. the PCG64 generator has only 128 bits of state, so any requested output of that length or longer would not likely be reproducible.

                              colinvparker@mathstodon.xyzC This user is from outside of this forum
                              colinvparker@mathstodon.xyzC This user is from outside of this forum
                              colinvparker@mathstodon.xyz
                              wrote sidst redigeret af
                              #15

                              @thomastc @robinhouston It’s only likely that a valid seed exists when using a large internal state, but it’s a little surprising that the process is reversible, because brute force search across seeds would be infeasible.

                              gsuberland@chaos.socialG 1 Reply Last reply
                              0
                              • robinhouston@mathstodon.xyzR robinhouston@mathstodon.xyz

                                For my birthday, my brother-in-law gave me a 4992-digit hex number that, when used as a seed for Python’s random number generator, makes it so that printing a sequence of “random” ASCII characters actually prints a birthday greeting.

                                I find it rather amazing that this is possible!

                                This is the program he sent with the seed:

                                with open("seed.txt", encoding="ascii") as handle:
                                seed = int(handle.read().strip(), 0)
                                r = random.Random(seed)
                                pending = ""
                                while True:
                                character = chr(r.randrange(128))
                                if pending + character == "\x1e\x1f":
                                break
                                print(pending, end="")
                                pending = character
                                print()

                                evoscale@c.imE This user is from outside of this forum
                                evoscale@c.imE This user is from outside of this forum
                                evoscale@c.im
                                wrote sidst redigeret af
                                #16

                                @robinhouston If I stare at it long enough, will my birthdays reverse?.. cuz I'm feelin' pretty freakin' old...

                                1 Reply Last reply
                                0
                                • colinvparker@mathstodon.xyzC colinvparker@mathstodon.xyz

                                  @thomastc @robinhouston It’s only likely that a valid seed exists when using a large internal state, but it’s a little surprising that the process is reversible, because brute force search across seeds would be infeasible.

                                  gsuberland@chaos.socialG This user is from outside of this forum
                                  gsuberland@chaos.socialG This user is from outside of this forum
                                  gsuberland@chaos.social
                                  wrote sidst redigeret af
                                  #17

                                  @Colinvparker @thomastc @robinhouston the trick is that, if only a few bits of the output are constrained, then you only have to solve for a state sequence that produces the right constrained bits, and the other bits are free to change. that reduces the complexity of the maths a lot.

                                  1 Reply Last reply
                                  0
                                  • robinhouston@mathstodon.xyzR robinhouston@mathstodon.xyz

                                    For my birthday, my brother-in-law gave me a 4992-digit hex number that, when used as a seed for Python’s random number generator, makes it so that printing a sequence of “random” ASCII characters actually prints a birthday greeting.

                                    I find it rather amazing that this is possible!

                                    This is the program he sent with the seed:

                                    with open("seed.txt", encoding="ascii") as handle:
                                    seed = int(handle.read().strip(), 0)
                                    r = random.Random(seed)
                                    pending = ""
                                    while True:
                                    character = chr(r.randrange(128))
                                    if pending + character == "\x1e\x1f":
                                    break
                                    print(pending, end="")
                                    pending = character
                                    print()

                                    agitatra@berlin.socialA This user is from outside of this forum
                                    agitatra@berlin.socialA This user is from outside of this forum
                                    agitatra@berlin.social
                                    wrote sidst redigeret af
                                    #18

                                    @robinhouston This sounds like a bigger problem.

                                    1 Reply Last reply
                                    0
                                    • robinhouston@mathstodon.xyzR robinhouston@mathstodon.xyz

                                      He's just confessed how he did it!

                                      https://github.com/frazerpearce/TimeLord

                                      N This user is from outside of this forum
                                      N This user is from outside of this forum
                                      napili@hachyderm.io
                                      wrote sidst redigeret af
                                      #19

                                      @robinhouston someone needs to make a quine out of this!

                                      1 Reply Last reply
                                      0
                                      • robinhouston@mathstodon.xyzR robinhouston@mathstodon.xyz

                                        He's just confessed how he did it!

                                        https://github.com/frazerpearce/TimeLord

                                        mags@post.lurk.orgM This user is from outside of this forum
                                        mags@post.lurk.orgM This user is from outside of this forum
                                        mags@post.lurk.org
                                        wrote sidst redigeret af
                                        #20

                                        @robinhouston oh hey, he supervised one of my projects last year!

                                        1 Reply Last reply
                                        0
                                        • robinhouston@mathstodon.xyzR robinhouston@mathstodon.xyz

                                          For my birthday, my brother-in-law gave me a 4992-digit hex number that, when used as a seed for Python’s random number generator, makes it so that printing a sequence of “random” ASCII characters actually prints a birthday greeting.

                                          I find it rather amazing that this is possible!

                                          This is the program he sent with the seed:

                                          with open("seed.txt", encoding="ascii") as handle:
                                          seed = int(handle.read().strip(), 0)
                                          r = random.Random(seed)
                                          pending = ""
                                          while True:
                                          character = chr(r.randrange(128))
                                          if pending + character == "\x1e\x1f":
                                          break
                                          print(pending, end="")
                                          pending = character
                                          print()

                                          realcainmosni@mastodon.me.ukR This user is from outside of this forum
                                          realcainmosni@mastodon.me.ukR This user is from outside of this forum
                                          realcainmosni@mastodon.me.uk
                                          wrote sidst redigeret af
                                          #21

                                          @robinhouston Ably demonstrating that machine "randomisation", isn't.

                                          1 Reply Last reply
                                          0
                                          Svar
                                          • Svar som emne
                                          Login for at svare
                                          • Ældste til nyeste
                                          • Nyeste til ældste
                                          • Most Votes


                                          • Log ind

                                          • Login or register to search.
                                          Powered by NodeBB Contributors
                                          Graciously hosted by data.coop
                                          • First post
                                            Last post
                                          0
                                          • Hjem
                                          • Seneste
                                          • Etiketter
                                          • Populære
                                          • Verden
                                          • Bruger
                                          • Grupper