Little useless-useful R functions – Wacky Password generator

Generating password is a hustle and I don’t want to go into the philosophy of passwords. Strong password, lengthy password, automatically generated password, etc. For me, they are all hard to remember, even harder to type (due to typos, different language setups, OS, software, etc.). In return, let’s have another useless R function, that will generate useless, – hard-to-use and impossible to remember – password, that will comply to all the standard rules (8 characters or more, one upper case, a kidney, a number, a special character, section from war & Peace, etc).

Typical “strong” password that human brain struggles to comprehend.

To make this password generation rather wacky, let me play with following characters:

There is less diversity in characters but nonetheless, the correct length and small caps, number, special characters and kidney – all comply with the regular quality assurance.

Wacky R function generates a set of ill generated password that would be even harder to type, and stupid to remember.

# Running on Linux/MacOS
WackyPassword <- function(WP_length){
  #charblock1 = c(176:178, 185: 188, 200:206)
  charblock1 <- c("\u2591","\u2592","\u2593")
  charblock2 = c(73,105,108,124,49,33)
  numberblock3 <- sample(0:9, length(5),replace = TRUE)
  
  pass = ""
  Encoding(pass) <- "UTF-8"
  ran2 <- floor(sample(1:WP_length/2))
  ran1 <- floor(sample(1:WP_length/2))
      while (nchar(pass) <= WP_length) {
        res2 <- sample(charblock2, 100,replace = TRUE)
        res2 <- rawToChar(as.raw(res2))
        Encoding(res2) <- "UTF-8"
        start2 <- sample(1:90,1)
        pass <- paste0(pass,substr(res2,start2,start2+ran2),collapse="", sep= "")
        
        
        res1 <- sample(charblock1, 100,replace = TRUE)
        Encoding(res1) <- "UTF-8"
        start1 <- sample(20:70,1)
        res <- paste0(res1, sep = "", collapse = "")
        pass <- paste0(pass,substr(res,start1,start1+ran1), sep="", collapse = "")
          }     

  cat(eval(substr(pass,1,WP_length)))
}

Running the function is as simple as:

WackyPassword(18)

but the results can be as useless and wacky as you can imagine 🙂

!il1|I▓▒▓▓▓░!I|lIi

Good luck typing this and I buy a beer to every community member brave enough to use one 🙂

As always, useless code is available at Github.

Happy R-coding! And stay healthy my friends!

Tagged with: , , , , ,
Posted in Uncategorized
3 comments on “Little useless-useful R functions – Wacky Password generator
  1. […] by data_admin [This article was first published on R – TomazTsql, and kindly contributed to R-bloggers]. (You can report issue about the content on this page […]

    Like

  2. […] article was first published on R – TomazTsql, and kindly contributed to R-bloggers]. (You can report issue about the content on this page […]

    Like

  3. […] article was first published on R – TomazTsql, and kindly contributed to R-bloggers]. (You can report issue about the content on this page […]

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Follow TomazTsql on WordPress.com
Programs I Use: SQL Search
Programs I Use: R Studio
Programs I Use: Plan Explorer
Rdeči Noski – Charity

Rdeči noski

100% of donations made here go to charity, no deductions, no fees. For CLOWNDOCTORS - encouraging more joy and happiness to children staying in hospitals (http://www.rednoses.eu/red-noses-organisations/slovenia/)

€2.00

Top SQL Server Bloggers 2018
TomazTsql

Tomaz doing BI and DEV with SQL Server and R, Python, Power BI, Azure and beyond

Discover WordPress

A daily selection of the best content published on WordPress, collected for you by humans who love to read.

Revolutions

Tomaz doing BI and DEV with SQL Server and R, Python, Power BI, Azure and beyond

tenbulls.co.uk

tenbulls.co.uk - attaining enlightenment with the Microsoft Data and Cloud Platforms with a sprinkling of Open Source and supporting technologies!

SQL DBA with A Beard

He's a SQL DBA and he has a beard

Reeves Smith's SQL & BI Blog

A blog about SQL Server and the Microsoft Business Intelligence stack with some random Non-Microsoft tools thrown in for good measure.

SQL Server

for Application Developers

Business Analytics 3.0

Data Driven Business Models

SQL Database Engine Blog

Tomaz doing BI and DEV with SQL Server and R, Python, Power BI, Azure and beyond

Search Msdn

Tomaz doing BI and DEV with SQL Server and R, Python, Power BI, Azure and beyond

R-bloggers

Tomaz doing BI and DEV with SQL Server and R, Python, Power BI, Azure and beyond

MsSQLGirl

Bringing value to data & insights through experiences users love

R-bloggers

R news and tutorials contributed by hundreds of R bloggers

Data Until I Die!

Data for Life :)

Paul Turley's SQL Server BI Blog

sharing my experiences with the Microsoft data platform, SQL Server BI, Data Modeling, SSAS Design, Power Pivot, Power BI, SSRS Advanced Design, Power BI, Dashboards & Visualization since 2009

Grant Fritchey

Intimidating Databases and Code

Madhivanan's SQL blog

A modern business theme

Alessandro Alpi's Blog

DevOps could be the disease you die with, but don’t die of.

Paul te Braak

Business Intelligence Blog

Sql Server Insane Asylum (A Blog by Pat Wright)

Information about SQL Server from the Asylum.

Gareth's Blog

A blog about Life, SQL & Everything ...

%d bloggers like this: