Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Commit

Permalink
Changed to select inputs for numbers, fixed typos and wrong input max…
Browse files Browse the repository at this point in the history
…-length, added new test
  • Loading branch information
arne-at-daten-und-bass committed Feb 22, 2018
1 parent dd938c3 commit 1913aa7
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 20 deletions.
2 changes: 1 addition & 1 deletion api/swagger/swagger.yaml
@@ -1,6 +1,6 @@
swagger: "2.0"
info:
version: "0.3.2"
version: "0.4.0"
title: cypherMe
host: cypherme.daten-und-bass.io
basePath: /
Expand Down
6 changes: 6 additions & 0 deletions config/locales/locales_strings_app.js
Expand Up @@ -82,6 +82,12 @@ var localesStringsApp = {
'es': {'ES': '[ 8 - 32 caracteres ]'},
'fr': {'FR': '[ 8 - 32 caractères ]'},
},
'8 - 160 characters': {
'de': {'DE': '[ 8 - 160 Zeichen ]'},
'en': {'EN': '[ 8 - 160 characters ]'},
'es': {'ES': '[ 8 - 160 caracteres ]'},
'fr': {'FR': '[ 8 - 160 caractères ]'},
},
'1 number between 1 - 26': {
'de': {'DE': '[ 1 Zahl zwischen 1 - 26 ]'},
'en': {'EN': '[ 1 number between 1 - 26 ]'},
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "cypherMe",
"version": "0.3.2",
"version": "0.4.0",
"private": true,
"description": "A NodeJS app for client-side created two-factor paper passwords",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion public/cypherMeApp.js
Expand Up @@ -258,7 +258,7 @@ var cypherMeApp = (function () {
keyword: 'keywordToDecrypt',
repeater: 'repeaterToDecrypt',
passwordCheckMessage: 'passwordCheckMessageToDecrypt',
passwordCheckString: cypherMeState.localesStrings['8 - 32 characters'],
passwordCheckString: cypherMeState.localesStrings['8 - 160 characters'],
shiftCheckMessage: 'shiftCheckMessageToDecrypt',
shiftCheckString: cypherMeState.localesStrings['1 number between 1 - 26'],
keywordCheckMessage: 'keywordCheckMessageToDecrypt',
Expand Down
19 changes: 15 additions & 4 deletions test/api/client/{locale}-test.js
Expand Up @@ -189,7 +189,8 @@ describe('Cyphers:', function () {
['elMoQQÜ+123ÖÄU??', 'evQmMYÜ+123ÖÄN??', 'A KEY with Spaces', 'evQmMYÜ+123ÖÄN??evQmMYÜ+123ÖÄN??'],
['el MoQQÜ + 123ÖÄ U??', 'iw YcGGÜ + 123ÖÄ O??', 'el MoQQÜ + 123ÖÄ U??', 'iw YcGGÜ + 123ÖÄ O??iw YcGGÜ + 123ÖÄ O??'],
['el MoQQÜ + 123ÖÄ U??', 'eg QfOBÜ + 123ÖÄ I??', 'AveryLONGwordAveryLONGwordAveryLONGwordAveryLONGwordAveryLONGword', 'eg QfOBÜ + 123ÖÄ I??eg QfOBÜ + 123ÖÄ I??'],
['el MoQQÜ + 123ÖÄ U??', 'ev QmMYÜ + 123ÖÄ N??', 'A KEY with Spaces', 'ev QmMYÜ + 123ÖÄ N??ev QmMYÜ + 123ÖÄ N??']
['el MoQQÜ + 123ÖÄ U??', 'ev QmMYÜ + 123ÖÄ N??', 'A KEY with Spaces', 'ev QmMYÜ + 123ÖÄ N??ev QmMYÜ + 123ÖÄ N??'],
['345MySecretPw567', '345EgLiprqxHe567', 'sitename', '345EgLiprqxHe567345EgLiprqxHe567', '345EgLiprqxHe567345EgLiprqxHe567345EgLiprqxHe567']
];
valuesToTest.forEach(function (currentArray) {
it('should encrypt ' + currentArray[0] + ' to ' + currentArray[1] + ' (Key: ' + currentArray[2], function (done) {
Expand All @@ -208,14 +209,24 @@ describe('Cyphers:', function () {
assert(clientApp.cypherMeViginereDecrypt(clientApp.dividePassword(currentArray[1], 1), currentArray[2]) === currentArray[0]);
done();
});
it('should encrypt ' + currentArray[0] + ' to ' + currentArray[1] + ' (Key: ' + currentArray[2] + ' Repetions: 2)', function (done) {
it('should encrypt ' + currentArray[0] + ' to ' + currentArray[3] + ' (Key: ' + currentArray[2] + ' Repetions: 2)', function (done) {
assert(clientApp.repeatPassword(clientApp.cypherMeViginereEncrypt(currentArray[0], currentArray[2]), 2) === currentArray[3]);
done();
});
it('should decrypt ' + currentArray[1] + ' to ' + currentArray[0] + ' (Key: ' + currentArray[2] + ' Repetions: 2)', function (done) {
it('should decrypt ' + currentArray[3] + ' to ' + currentArray[0] + ' (Key: ' + currentArray[2] + ' Repetions: 2)', function (done) {
assert(clientApp.cypherMeViginereDecrypt(clientApp.dividePassword(currentArray[3], 2), currentArray[2]) === currentArray[0]);
done();
});
});
if (currentArray.length >= 5 ) {
it('should encrypt ' + currentArray[0] + ' to ' + currentArray[4] + ' (Key: ' + currentArray[2] + ' Repetions: 3)', function (done) {
assert(clientApp.repeatPassword(clientApp.cypherMeViginereEncrypt(currentArray[0], currentArray[2]), 3) === currentArray[4]);
done();
});
it('should decrypt ' + currentArray[4] + ' to ' + currentArray[0] + ' (Key: ' + currentArray[2] + ' Repetions: 3)', function (done) {
assert(clientApp.cypherMeViginereDecrypt(clientApp.dividePassword(currentArray[4], 3), currentArray[2]) === currentArray[0]);
done();
});
}
});
});
});
Expand Down
77 changes: 71 additions & 6 deletions views/index.handlebars
Expand Up @@ -20,7 +20,34 @@
</div>
<div class="form-input">
<label id="shiftLabel" for="shift">{{localesStrings.[Shift]}}:</label><br>
<input id="shift" type="number" min="1" max="26" pattern="^([1-9]|1[0-9]|2[0-6])$" value="1" required="true" onchange="cypherMeApp.check(true); return false;">
<select id="shift" required="true" onchange="cypherMeApp.check(true); return false;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
</select>
<div id="shiftCheckMessage" style="display: none;"></div>
</div>
<div class="form-input">
Expand All @@ -30,7 +57,13 @@
</div><br>
<div class="form-input">
<label id="repeaterLabel" for="repeater">{{localesStrings.[Repetitions]}}:</label><br>
<input id="repeater" type="number" min="1" max="5" pattern="^([1-5])$" value="1" required="true" onchange="cypherMeApp.check(true); return false;">
<select id="repeater" required="true" onchange="cypherMeApp.check(true); return false;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<div id="repeaterCheckMessage" style="display: none;"></div><br><br>
</div><br>
<input id="encryptButton" type="button" value="{{localesCommands.[Encrypt]}}" disabled="true" onclick="return cypherMeApp.cypherMe();"><br>
Expand All @@ -41,7 +74,7 @@
<legend>:eM rehpyC</legend>
<div class="form-input">
<label for="passwordToDecrypt">{{localesStrings.[The (encrypted) password]}}:</label><br>
<input id="passwordToDecrypt" type="text" size="25" pattern='^.{8,32}$' maxlength="32" required="true" onchange="cypherMeApp.check(false); return false;">
<input id="passwordToDecrypt" type="text" size="25" pattern='^.{8,160}$' maxlength="160" required="true" onchange="cypherMeApp.check(false); return false;">
<div id="passwordCheckMessageToDecrypt" style="display: none;"></div>
</div><br>
<div class="form-input">
Expand All @@ -55,7 +88,34 @@
</div>
<div class="form-input">
<label id="shiftLabelToDecrypt" for="shiftToDecrypt">{{localesStrings.[Shift]}}:</label><br>
<input id="shiftToDecrypt" type="number" min="1" max="26" pattern="^([1-9]|1[0-9]|2[0-6])$" value="1" required="true" onchange="cypherMeApp.check(false); return false;">
<select id="shiftToDecrypt" required="true" onchange="cypherMeApp.check(false); return false;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
</select>
<div id="shiftCheckMessageToDecrypt" style="display: none;"></div>
</div>
<div class="form-input">
Expand All @@ -65,7 +125,13 @@
</div><br>
<div class="form-input">
<label id="repeaterToDecryptLabel" for="repeaterToDecrypt">{{localesStrings.[Repetitions]}}:</label><br>
<input id="repeaterToDecrypt" type="number" min="1" max="5" pattern="^([1-5])$" value="1" required="true" onchange="cypherMeApp.check(false); return false;">
<select id="repeaterToDecrypt" required="true" onchange="cypherMeApp.check(false); return false;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<div id="repeaterCheckMessageToDecrypt" style="display: none;"></div><br><br>
</div><br>
<input id="decryptButton" type="button" value="{{localesCommands.[Decrypt]}}" disabled="true" onclick="return cypherMeApp.deCypherMe();"><br>
Expand Down Expand Up @@ -104,6 +170,5 @@
window.onload = function () {
cypherMeApp.toggleView();
cypherMeApp.toggleViewToDecrypt();
// console.log(JSON.parse('{{{toJSON localesStrings}}}'))
};
</script>
14 changes: 7 additions & 7 deletions views/service_pages/about.handlebars
Expand Up @@ -2,7 +2,7 @@
<div class="accordion">Is this really serious???</div>
<div class="panel">
<p>No .. and yes ... and it depends.</p>
<p>Of cousrse ... <strong>please consider a password manager first</strong>. No question!</p>
<p>Of course ... <strong>please consider a password manager first</strong>. No question!</p>
<p>In any case: Make sure <strong>not to use the same account name and password combination for each website.</strong></p>
<br>
<p style="text-align: center;">However, people tend to write down their passwords (or even worse: all in one "place") ... <br> ...what if that "place" gets stolen?</p>
Expand Down Expand Up @@ -40,7 +40,7 @@
<ul>
<li>Password to encrypt: 345MySecretPw567</li>
<li>Cypher: Reverse word and case</li>
<li>Repitions: 2</li>
<li>Repetions: 2</li>
<li>The (encrypted) password: 765WpTERCEsYm543765WpTERCEsYm543</li>
</ul>
<p>This is only a short and probably not very good example (especially as it is lacking special characters) ... So do better ... please. But now you could safely write down the initial password and remember (keep secret) the transformation.</p>
Expand Down Expand Up @@ -75,28 +75,28 @@
<ul>
<li>Password to encrypt: 345MySecretPw567</li>
<li>Cypher: Caesar with Shift: 1</li>
<li>Repitions: 1</li>
<li>Repetions: 1</li>
<li>The (encrypted) password: 345NzTfdsfuQx567</li>
</ul>
<p><strong>Example 2:</strong></p>
<ul>
<li>Password to encrypt: 345MySecretPw567</li>
<li>Cypher: Reverse word</li>
<li>Repitions: 1</li>
<li>Repetions: 1</li>
<li>The (encrypted) password: 765wPterceSyM543</li>
</ul>
<p><strong>Example 3:</strong></p>
<ul>
<li>Password to encrypt: 345MySecretPw567</li>
<li>Cypher: Reverse word and case</li>
<li>Repitions: 2</li>
<li>Repetions: 2</li>
<li>The (encrypted) password: 765WpTERCEsYm543765WpTERCEsYm543</li>
</ul>
<p><strong>Example 4a:</strong></p>
<ul>
<li>Password to encrypt: 345MySecretPw567</li>
<li>Cypher: Vigenère with Key: sitename</li>
<li>Repitions: 3</li>
<li>Repetions: 3</li>
<li>The (encrypted) password: 345EgLiprqxHe567345EgLiprqxHe567345EgLiprqxHe567</li>
</ul>
<p>So e.g. you might want to consider using one (fixed) password and as (changing) keys something related to each website.</p>
Expand All @@ -105,7 +105,7 @@
<ul>
<li>Password to encrypt: 345MySecretPw567</li>
<li>Cypher: Vigenère with Key: anothersitename</li>
<li>Repitions: 3</li>
<li>Repetions: 3</li>
<li>The (encrypted) password: 345MlGxjvvlXp567345MlGxjvvlXp567345MlGxjvvlXp567</li>
</ul>

Expand Down

0 comments on commit 1913aa7

Please sign in to comment.