mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
Share randomString
method.
This simply shares a common implementation and makes no judgements on the validity of its use. The string created is not a secure random number, so some uses of it may not be applicable.
This commit is contained in:
parent
34edba3adf
commit
363e168561
12 changed files with 37 additions and 61 deletions
|
@ -6,6 +6,7 @@ var CommonCode = require('../utils/common_code');
|
|||
var ERR = require("async-stacktrace");
|
||||
var Changeset = CommonCode.require("/Changeset");
|
||||
var AttributePoolFactory = CommonCode.require("/AttributePoolFactory");
|
||||
var randomString = CommonCode.require('/pad_utils').randomString;
|
||||
var db = require("./DB").db;
|
||||
var async = require("async");
|
||||
var settings = require('../utils/Settings');
|
||||
|
@ -478,15 +479,7 @@ function hash(password, salt)
|
|||
|
||||
function generateSalt()
|
||||
{
|
||||
var len = 86;
|
||||
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./";
|
||||
var randomstring = '';
|
||||
for (var i = 0; i < len; i++)
|
||||
{
|
||||
var rnum = Math.floor(Math.random() * chars.length);
|
||||
randomstring += chars.substring(rnum, rnum + 1);
|
||||
}
|
||||
return randomstring;
|
||||
return randomstring(86);
|
||||
}
|
||||
|
||||
function compare(hashStr, password)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue