• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Excel as a simple password generator

haljbr

New Member
I know there is a better way to solve this.
But it would be nice to have this also in excel:

let me explain: I want to have excel as a password generator based on the text that I give as input.

vowels rules: First vowel will always be a number, next an special character, next number and so on...
vowel​
number​
character​
a​
4​
@​
e​
3​
&​
i​
1​
!​
o​
0​
*​
u​
#​
(u will be always #)

Consonants rules: First always upper case and next one lower case, next upper case...

General rules: No spaces allowed, result should be backwards

Example text:
hard to break
H4rDt*Br3@K

result below:
K@3rB*tDr4H
 
.
I don't have an answer for your specific request. However, here is another project that might interest you :

Code:
Public Sub PasswordGenerator()
           Dim cell As Range
           Dim i As Integer, currentcol As Integer, currentpos As Integer
           Dim currentpassword As String, currentchar As String
          
           For Each cell In Range("I3:I5")
               currentpassword = Space(15)
               currentcol = 1
               For i = 1 To 15
                   currentchar = Range("D3").Offset(Application.WorksheetFunction.RandBetween(1, Range("D1").Offset(0, currentcol - 1).Value - 1), currentcol - 1)
                   currentpos = Application.WorksheetFunction.Hex2Dec(Mid(cell.Value, i, 1))
                   currentpassword = Application.WorksheetFunction.Replace(currentpassword, currentpos, 1, currentchar)
                   currentcol = currentcol + 1
                   If currentcol > 4 Then currentcol = 1
               Next
               cell.Offset(0, 1).Value = currentpassword
           Next
End Sub
 

Attachments

  • Password Generator.xlsm
    25.2 KB · Views: 4
This uses the LET function from Excel 365 Beta channel.
Code:
= LET(
  n,          LEN(givenText),
  k,          SEQUENCE(n),
  chr,        MID(givenText,k,1),
  vowelIdx,   XMATCH(chr, vowel),
  isVowel?,   SIGN(ISNUMBER(vowelIdx)),
  accumulate, SIGN(k>=TRANSPOSE(k)),
  vowelSeq,   MMULT(accumulate, isVowel?),
  constSeq,   MMULT(accumulate, 1-isVowel?),
  column,     1+MOD(vowelSeq, 3),
  UCase?,     ISODD(constSeq),
  encrypted,  IF(
                 isVowel?,
                 INDEX(table, vowelIdx, column),
                 IF(UCase?, UPPER(chr), LOWER(chr))
              ),
  reversed,   INDEX(encrypted, n+1-k),
  CONCAT(reversed) )
The formula returns
K4erB*tDr4H
which is getting pretty close to the answer!
Is it worth doing? ...
 
Going the other way is far easier
Code:
= LET(
  n,       LEN(password),
  k,       SEQUENCE(n,1,n,-1),
  chr,     MID(password,k,1),
  decrypt, XLOOKUP(chr,nonAlpha,letter),
  output,  IFERROR(decrypt,chr),
  PROPER(CONCAT(output)))
The formula returns
Hardtobreak
 
Back
Top