Full Control Over a Randomly Generated Password

N 56°04'39.16"
E 12°55'05.25"

• Very good!

One problem though.  Your code to limit the password length does not work if I pass negative numbers.  When the specs are negative then they can't be more negative ten the number of items in the list.  You can't call for more than 26 non-duplicated upper case letters as there are only 26 of them.

ATBCharles Kincaid

• Hi,

I always think that when ever i find some time spare than i will write this one.But u did and did in a nice way

• Nice solution.

I've been using spc_random_password of Written by Narayana Vyas Kondreddi http://vyaskn.tripod.com  (Stored procedure to generate a simple or complex random password&nbspfrom almost when it was published (2001).

Johan

Learn to play, play to learn !

Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:

- How to post Performance Problems

press F1 for solution, press shift+F1 for urgent solution 😀

Who am I ? Sometimes this is me but most of the time this is me

• Well, its a nice solution and working prefect.

• A thought for generating passwords non-randomly: use your birthday in the Jewish (or Muslim or Persian or whatever) calendar. Therefore, if you forget it for whatever reason, you can regenerate it from a web site.

• This is a great idea, I am going to use it in my application. I have re-written it as a function though  (for consistency with standards of my system) by creating a view for the NEWID() function:

CREATE VIEW v_NewID AS SELECT NEWID() AS 'New_ID'

and modifying the code to use the view rather than NEWID()

eg:

-- Get the Number Items

SET @i = ABS(@NumberItems)

WHILE @i > 0 AND LEN(@Numbers) > 0

SELECT @v-2 = ABS(CAST(CAST(New_ID AS BINARY(16)) AS BIGINT)) % LEN(@Numbers) + 1

,    @C = SUBSTRING(@Numbers, @v-2, 1)

,    @Numbers = CASE

WHEN @NumberItems < 0

THEN STUFF(@Numbers, @v-2, 1, '')

ELSE @Numbers

END

,    @Temp = @Temp + @C

,    @i = @i - 1

FROM v_NewID

David

If it ain't broke, don't fix it...

• Nice job, I’ll use it for sure.

I was using, since always, Left 4 of a new guid + Left 4 of a new guid (uppercase)

Kind of…

Thanks

Best Regards,

• This link below has my own procedure for generating a somewhat mnemonic password, as well as several others for generating random or semi-random passwords:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=78859

It is an interesting problem, because of the conflicting requirements of security where long, random passwords are better, and the ability of a human to read, remember, and type the password.  A password like B4zI1=5UhW4K6KM'3 is probably almost impossible to crack, but how many people can remember it and type it correctly?

My mnemonic password procedure is an attempt at a compromise solution to generate passwords that are both secure and something that a human can remember and use.  It could be done better, but it was the best solution I could think of at the time to meet my requirements.

• It doesn't matter.

When you want non-duplicated characters from a group, the while loop exits when there are no more characters to choose from.

Even if you set 50 non-duplicated characters, the while loop exits after 26.

N 56°04'39.16"
E 12°55'05.25"

Viewing 10 posts - 1 through 9 (of 9 total)