Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Random string generator

I had a quick scan through the utilities and didn't see one but thought I'd throw it out there in case I've missed it.
In your little bag of tricks do you have a function that can create a random string of a given length and ideally with some input over which characters can be used?

I could write one, but I've done that sort of thing before, only to stumble over your better version later.

Comments

  • No, we haven't done anything like this. Nothing to stumble upon here. Would this be for a password generator or something?
  • Code verifier for Xero API's

    Generating a code verifier and code challenge
    The first thing your app must do before starting an authorization request is generate a “code verifier”. A code verifier is a random string between 43 and 128 characters long that consists of the characters A-Z, a-z, 0-9, and the punctuation -._~ (hyphen, period, underscore, and tilde).

    The “code challenge” is created by performing a SHA256 hash on the code verifier and then Base64url encoding the hash


    I know you've got the hash and the encoding; I just need to generate the string to hash and encode.
  • Hhhmmmm, I forgot that I've already got something that probably fits the bill with a couple of tweaks.
    Don't mind me. Nothing to see here.
Sign In or Register to comment.