Thread: String generator help

  1. #16
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    keep mind that this method is prone to latency, as you're making system calls to get the random numbers
    O_o

    The preferred method would be reading several samples with a single call where you barely see a cost if the pool has sufficient entropy.

    That said, unless you are doing something very specific, most related to cryptography, you don't need true randomness.

    Using "/dev/random" for a seed is a good idea, but some PRNG have unreasonably long seeds. It would be more reasonable to read a set of samples from "/dev/random", stretch the entropy over a seed with a computationally complex PRNG, and feed the resulting seed into a cryptographically secure PRNG.

    Of course, that would be kind of a waste of your time as a programmer; if you are already using "/dev/random", you can probably use "/dev/urandom" which, on a lot of systems, will occasionally read samples from "/dev/random" and stretch the available entropy over a few thousands of samples according to some schedule. Sure, you only get fractions of a bit of entropy for each sample, but that's more than sufficient for anything not intended for long term cryptographic use. (So, you wouldn't use "/dev/urandom" to build an issuing security certificate.)

    Soma

  2. #17
    Registered User ChrisCodes's Avatar
    Join Date
    Jun 2013
    Location
    Melbourne, Australia
    Posts
    2
    Quote Originally Posted by Trey Brumley View Post

    a random string of k characters (k being 1-7, each to be done 10 times). This random string consists only of all 26 capital letters.

    I have no idea how to write a brute force script. Someone told me to look at it as writing a Base-26 counting machine, but that doesn't help me any. Can someone help me out with this?

    2. How do I write a string generator that goes "A, if not A then B, if not B then C, if not C then D..." and will even increment the ten position so to speak if AZ doesn't match when I get to 2 digits, and so on.
    Hi Trey,

    I run Generate Random Codes (dot) com. If your company is up for it, I can consult you on this, and get you through all the hurdles. Generating codes with complex requirements has been ongoing and a passion of mine for a few years now.

    Help you with:
    - large codes 26 chars (custom character set and pattern)
    - increment to set requirement
    - loop brute force; show how to generate one code at a time

    PS: Just in case - I have morals, so it must be legal and morally correct on my scale to qualify for my consulting service.

    Cheers, Chris.
    - live with passion

  3. #18
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    Can't tell if advertisement or helpful post.

    Our of curiosity, what is your source of entropy?

    Soma
    Last edited by phantomotap; 06-28-2013 at 12:39 AM. Reason: *derp*

  4. #19
    Registered User ChrisCodes's Avatar
    Join Date
    Jun 2013
    Location
    Melbourne, Australia
    Posts
    2
    Quote Originally Posted by phantomotap View Post
    O_o

    Can't tell if advertisement or helpful post.

    Our of curiosity, what is your source of entropy?

    Soma
    Hey phantom, I had to look that up

    Entropy is a measure of the number of specific ways in which a system may be arranged, often taken to be a measure of disorder. The entropy of an isolated system never decreases, because isolated systems spontaneously evolve towards thermodynamic equilibrium, which is the state of maximum entropy.

    Mersenne Twister, so I believe it's using server time + other complicated stuff.

    After working with clients to fix issues and adapt to what they really need for competition codes, I may have avoided what you are referring to. Instead of focussing on trying to randomize to nth degree, there are better ways for what I'm working to achieve for the client and their purpose for the codes. I believe our method could help the poster of this thread.

    Cheers, Chris.
    Australia

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. String Generator
    By Tonto in forum C++ Programming
    Replies: 1
    Last Post: 06-03-2005, 12:45 AM
  2. Doc generator
    By blanc-de-poulet in forum C Programming
    Replies: 2
    Last Post: 05-13-2005, 02:35 PM
  3. .SFV Generator
    By Zewu in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 07-15-2004, 12:00 PM
  4. Name Generator
    By drdroid in forum C++ Programming
    Replies: 2
    Last Post: 09-16-2002, 12:42 PM
  5. My Random Position Color String Generator[in C and C++!!]
    By Golden Bunny in forum A Brief History of Cprogramming.com
    Replies: 20
    Last Post: 05-27-2002, 05:19 PM