Skip to content

Instantly share code, notes, and snippets.

@mkolb
Created May 21, 2012 16:11
Show Gist options
  • Save mkolb/2763067 to your computer and use it in GitHub Desktop.
Save mkolb/2763067 to your computer and use it in GitHub Desktop.
A function for generating a password salt in moodle, useful for first-time creation of config.php
(defun insert-password-salt ()
"Insert a string of length 31 suitable for a new password salt in moodle."
(interactive)
(let ((mycharset "1234567890abcdefghijklmnopqrstyvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()"))
(dotimes (i 31)
(insert (elt mycharset (random (length mycharset)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment