From bd6992da0adfdbb3660141c4bcb54e4e1d177502 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 20 Dec 2016 11:13:15 +0100 Subject: [PATCH] create a random hash --- www/common/cryptpad-common.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 6cafa47c4..8ce10d64a 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -299,6 +299,14 @@ define([ return id; }; + var createRandomHash = common.createRandomHash = function () { + // 16 byte channel Id + var channelId = hexToBase64(createChannelId()); + // 18 byte encryption key + var key = Crypto.b64RemoveSlashes(Crypto.rand64(18)); + return '/1/edit/' + [channelId, key].join('/'); + }; + var replaceHash = common.replaceHash = function (hash) { if (window.history && window.history.replaceState) { if (!/^#/.test(hash)) { hash = '#' + hash; }