# HG changeset patch # User Michael Schloh von Bennewitz # Date 1375292880 -7200 # Node ID d1b294812560dd1e723b9387e4822f8f324bf775 # Parent deac632e477c5305d40b7101f8734334c3bde21c Introduce port to the Tizen OS. diff -r deac632e477c -r d1b294812560 .hgignore --- a/.hgignore Tue Jul 30 20:23:00 2013 +0200 +++ b/.hgignore Wed Jul 31 19:48:00 2013 +0200 @@ -14,3 +14,8 @@ src/firefoxos/test/qunit-*.js src/firefoxos/jquery.core src/firefoxos/jquery.mobile + +src/tizen/test/qunit-*.css +src/tizen/test/qunit-*.js +src/tizen/jquery.core +src/tizen/jquery.mobile diff -r deac632e477c -r d1b294812560 src/firefoxos/img/otpwcalc-ico.svg --- a/src/firefoxos/img/otpwcalc-ico.svg Tue Jul 30 20:23:00 2013 +0200 +++ b/src/firefoxos/img/otpwcalc-ico.svg Wed Jul 31 19:48:00 2013 +0200 @@ -7,10 +7,39 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" - width="114.23945" - height="89.92881" - id="svg5004"> + width="264.23944" + height="150" + id="svg5004" + inkscape:version="0.48.3.1 r9886" + sodipodi:docname="otpwcalc-ico.svg"> + @@ -24,36 +53,152 @@ - - - - - - + + + + + + + + + + + + + + + + + + OTP + sodipodi:linespacing="125%">OTP + + + + + + + + + + + OTP + + diff -r deac632e477c -r d1b294812560 src/tizen/.project --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/.project Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,57 @@ + + + OTPWCalc + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + json.validation.builder + + + + + org.tizen.web.jslint.nature.JSLintBuilder + + + + + org.tizen.web.css.nature.CSSBuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.tizen.web.project.builder.WebBuilder + + + usedLibraryType + jQueryMobile + + + + + + json.validation.nature + org.tizen.web.jslint.nature.JSLintNature + org.tizen.web.css.nature.CSSNature + org.eclipse.wst.jsdt.core.jsNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.tizen.web.project.builder.WebNature + + diff -r deac632e477c -r d1b294812560 src/tizen/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/Makefile Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,46 @@ +## +## OTPWCalc - One time password challenge response calculator client +## Copyright © 2013 Michael Schloh von Bennewitz +## +## OTPWCalc is free software: you can redistribute it and/or modify +## it under the terms of the European Union Public Licence, either +## version 1.1 of the license, or (at your option) any later version. +## +## OTPWCalc is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty +## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +## the European Union Public License for more details. +## +## You should have received a copy of the European Union Public +## Licence along with OTPWCalc. If not, please refer to +## . +## +## This file is part of project OTWPCalc, a one time password challenge +## response calculator client and is found at http://otpwcalc.europalab.com/ +## +## Makefile: Autoconf Makefile configuration +## + +# Paths +distdir = ../../dist + +# Files +WIDGET = otpwcalc-tizen-$(VERSION).wgt + +# Vars +VERSION = 0.7.5 + +# Progs +PROGWGT = unknown +PROGECHO = echo + +# Logic +all: + @$(PROGECHO) 'Nothing to do... To roll a zipball please make the dist target.' + +dist: Makefile + @if [ -e $(distdir)/$(WIDGET) ]; \ + then $(PROGECHO) '$(distdir)/$(WIDGET) already exists, aborting.'; \ + else \ + $(PROGWGT) -r9 $(distdir)/$(WIDGET) . -x Makefile -x test/\* -x otpwcalc.appcache -x jquery.plugins/\* -x img/\*.svg -x img/\*.xcf; \ + fi diff -r deac632e477c -r d1b294812560 src/tizen/about.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/about.html Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,65 @@ + + + + + + + + OTPWCalc + + + + + + + +
+ + +
+

About

+
+
+

OTPWCalc

+ Computer keyboard +

One Time Password Calculator 0.7.5

+ Datacenter host computer +

Visit the OTPWCalc Homepage

+

Copyright © 2012 – 2013
Michael Schloh von Bennewitz

+

This software is distributed under the terms of the European Union Public Licence (EUPL) version 1.1

+
+
+ + diff -r deac632e477c -r d1b294812560 src/tizen/config.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/config.xml Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,7 @@ + + + + + + OTPWCalc + diff -r deac632e477c -r d1b294812560 src/tizen/eupl-1.1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/eupl-1.1.txt Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,295 @@ + European Union Public Licence + V. 1.1 + EUPL © the European Community 2007 + +This Europe an Union Public Licence (the “EUPL”) applies to the Work +or Software (as defined below) which is provided under the terms of +this Licence. Any use of the Work, other than as authorised under this +Licence is prohibited (to the extent such use is covered by a right of +the copyright holder of the Work). + +The Original Work is provided under the terms of this Licence when the +Licensor (as defined below) has placed the following notice immediately +following the copyright notice for the Original Work: + + Licensed under the EUPL V.1.1 + +or has expressed by any other mean his willingness to license under the EUPL. + +1. Definitions + +In this Licence, the following terms have the following meaning: + +- The Licence: this Licence. + +- The Original Work or the Software: the software distributed and/or +communicated by the Licensor under this Licence, available as Source +Code and also as Executable Code as the case may be. + +- Derivative Works: the works or software that could be created by the +Licensee, based upon the Original Work or modifications thereof. This +Licence does not define the extent of modification or dependence on the +Original Work required in order to classify a work as a Derivative Work; +this extent is determined by copyright law applicable in the country +mentioned in Article 15. + +- The Work: the Original Work and/or its Derivative Works. + +- The Source Code: the human-readable form of the Work which + is the most convenient for people to study and modify. + +- The Executable Code: any code which has generally been compiled + and which is meant to be interpreted by a computer as a program. + +- The Licensor: the natural or legal person that distributes + and/or communicates the Work under the Licence. + +- Contributor(s): any natural or legal person who modifies the Work under + the Licence, or otherwise contributes to the creation of a Derivative Work. + +- The Licensee or “You”: any natural or legal person who makes + any usage of the Software under the terms of the Licence. + +- Distribution and/or Communication: any act of selling, giving, + lending, renting, distributing, communicating, transmitting, or + otherwise making available, on-line or off-line, copies of the + Work or providing access to its essential functionalities at + the disposal of any other natural or legal person. + +2. Scope of the rights granted by the Licence + +The Licensor hereby grants You a world-wide, royalty-free, non-exclusive, +sublicensable licence to do the following, for the duration of copyright +vested in the Original Work: + +- use the Work in any circumstance and for all usage, +- reproduce the Work, +- modify the Original Work, and make Derivative Works based upon the Work, +- communicate to the public, including the right to make available or + display the Work or copies thereof to the public and perform publicly, + as the case may be, the Work, +- distribute the Work or copies thereof, +- lend and rent the Work or copies thereof, +- sub-license rights in the Work or copies thereof. + +Those rights can be exercised on any media, supports and formats, whether +now known or later invented, as far as the applicable law permits so. + +In the countries where moral rights apply, the Licensor waives his right +to exercise his moral right to the extent allowed by law in order to +make effective the licence of the economic rights here above listed. + +The Licensor grants to the Licensee royalty-free, non exclusive usage +rights to any patents held by the Licensor, to the extent necessary to +make use of the rights granted on the Work under this Licence. + +3. Communication of the Source Code + +The Licensor may provide the Work either in its Source Code form, or +as Executable Code. If the Work is provided as Executable Code, the +Licensor provides in addition a machine-readable copy of the Source +Code of the Work along with each copy of the Work that the Licensor +distributes or indicates, in a notice following the copyright notice +attached to the Work, a repository where the Source Code is easily and +freely accessible for as long as the Licensor continues to distribute +and/or communicate the Work. + +4. Limitations on copyright + +Nothing in this Licence is intended to deprive the Licensee of the +benefits from any exception or limitation to the exclusive rights of the +rights owners in the Original Work or Software, of the exhaustion of +those rights or of other applicable limitations thereto. + +5. Obligations of the Licensee + +The grant of the rights mentioned above is subject to some restrictions +and obligations imposed on the Licensee. Those obligations are the +following: + +Attribution right: the Licensee shall keep intact all +copyright, patent or trademarks notices and all notices that refer to +the Licence and to the disclaimer of warranties. + +The Licensee must include a copy of such notices and a copy of +the Licence with every copy of the Work he/she distributes and/or +communicates. The Licensee must cause any Derivative Work to carry +prominent notices stating that the Work has been modified and the date +of modification. + +Copyleft clause: If the Licensee distributes and/or communicates copies +of the Original Works or Derivative Works based upon the Original +Work, this Distribution and/or Communication will be done under the +terms of this Licence or of a later version of this Licence unless the +Original Work is expressly distributed only under this version of the +Licence. The Licensee (becoming Licensor) cannot offer or impose any +additional terms or conditions on the Work or Derivative Work that alter +or restrict the terms of the Licence. + +Compatibility clause: If the Licensee Distributes and/or Communicates +Derivative Works or copies thereof based upon both the Original Work +and another work licensed under a Compatible Licence, this Distribution +and/or Communication can be done under the terms of this Compatible +Licence. For the sake of this clause, “Compatible Licence” refers +to the licences listed in the appendix attached to this Licence. Should +the Licensee’s obligations under the Compatible Licence conflict +with his/her obligations under this Licence, the obligations of the +Compatible Licence shall prevail. + +Provision of Source Code: When distributing and/or communicating copies +of the Work, the Licensee will provide a machine-readable copy of the +Source Code or indicate a repository where this Source will be easily +and freely available for as long as the Licensee continues to distribute +and/or communicate the Work. + +Legal Protection: This Licence does not grant permission to use the +trade names, trademarks, service marks, or names of the Licensor, except +as required for reasonable and customary use in describing the origin of +the Work and reproducing the content of the copyright notice. + +6. Chain of Authorship + +The original Licensor warrants that the copyright in the Original Work +granted hereunder is owned by him/her or licensed to him/her and that +he/she has the power and authority to grant the Licence. + +Each Contributor warrants that the copyright in the modifications he/she +brings to the Work are owned by him/her or licensed to him/her and that +he/she has the power and authority to grant the Licence. + +Each time You accept the Licence, the original Licensor and subsequent +Contributors grant You a licence to their contributions to the Work, +under the terms of this Licence. + +7. Disclaimer of Warranty + +The Work is a work in progress, which is continuously improved by +numerous contributors. It is not a finished work and may therefore +contain defects or “bugs” inherent to this type of software +development. + +For the above reason, the Work is provided under the Licence on an +“as is” basis and without warranties of any kind concerning the Work, +including without limitation merchantability, fitness for a particular +purpose, absence of defects or errors, accuracy, non-infringement of +intellectual property rights other than copyright as stated in Article +6 of this Licence. + +This disclaimer of warranty is an essential part of the Licence +and a condition for the grant of any rights to the Work. + +8. Disclaimer of Liability + +Except in the cases of wilful misconduct or damages directly caused to +natural persons, the Licensor will in no event be liable for any direct +or indirect, material or moral, damages of any kind, arising out of the +Licence or of the use of the Work, including without limitation, damages +for loss of goodwill, work stoppage, computer failure or malfunction, +loss of data or any commercial damage, even if the Licensor has been +advised of the possibility of such damage. However, the Licensor will be +liable under statutory product liability laws as far such laws apply to +the Work. + +9. Additional agreements + +While distributing the Original Work or Derivative Works, You may +choose to conclude an additional agreement to offer, and charge a fee +for, acceptance of support, warranty, indemnity, or other liability +obligations and/or services consistent with this Licence. However, in +accepting such obligations, You may act only on your own behalf and on +your sole responsibility, not on behalf of the original Licensor or +any other Contributor, and only if You agree to indemnify, defend, and +hold each Contributor harmless for any liability incurred by, or claims +asserted against such Contributor by the fact You have accepted any such +warranty or additional liability. + +10. Acceptance of the Licence + +The provisions of this Licence can be accepted by clicking on an icon +“I agree” placed under the bottom of a window displaying the text +of this Licence or by affirming consent in any other similar way, in +accordance with the rules of applicable law. Clicking on that icon +indicates your clear and irrevocable acceptance of this Licence and all +of its terms and conditions. + +Similarly, you irrevocably accept this Licence and all of its terms +and conditions by exercising any rights granted to You by Article 2 of +this Licence, such as the use of the Work, the creation by You of a +Derivative Work or the Distribution and/or Communication by You of the +Work or copies thereof. + +11. Information to the public + +In case of any Distribution and/or Communication of the Work by means of +electronic communication by You (for example, by offering to download +the Work from a remote location) the distribution channel or media (for +example, a website) must at least provide to the public the information +requested by the applicable law regarding the Licensor, the Licence and +the way it may be accessible, concluded, stored and reproduced by the +Licensee. + +12. Termination of the Licence + +The Licence and the rights granted hereunder will terminate +automatically upon any breach by the Licensee of the terms of the +Licence. Such a termination will not terminate the licences of any +person who has received the Work from the Licensee under the Licence, +provided such persons remain in full compliance with the Licence. + +13. Miscellaneous + +Without prejudice of Article 9 above, the Licence represents the +complete agreement between the Parties as to the Work licensed +hereunder. + +If any provision of the Licence is invalid or unenforceable under +applicable law, this will not affect the validity or enforceability +of the Licence as a whole. Such provision will be construed and/or +reformed so as necessary to make it valid and enforceable. The European +Commission may publish other linguistic versions and/or new versions of +this Licence, so far this is required and reasonable, without reducing +the scope of the rights granted by the Licence. New versions of the +Licence will be published with a unique version number. + +All linguistic versions of this Licence, approved by the European +Commission, have identical value. Parties can take advantage of the +linguistic version of their choice. + +14. Jurisdiction + +Any litigation resulting from the interpretation of this License, +arising between the European Commission, as a Licensor, and any +Licensee, will be subject to the jurisdiction of the Court of Justice +of the European Communities, as laid down in article 238 of the Treaty +establishing the European Community. + +Any litigation arising between Parties, other than the European +Commission, and resulting from the interpretation of this License, will +be subject to the exclusive jurisdiction of the competent court where +the Licensor resides or conducts its primary business. + +15. Applicable Law + +This Licence shall be governed by the law of the European Union +country where the Licensor resides or has his registered office. + +This licence shall be governed by the Belgian law if: + +- a litigation arises between the European + Commission, as a Licensor, and any Licensee; +- the Licensor, other than the European Commission, has no + residence or registered office inside a European Union country. + + + === + + + Appendix + + “Compatible Licences” according to article 5 EUPL are: + + - GNU General Public License (GNU GPL) v. 2 + - Open Software License (OSL) v. 2.1, v. 3.0 + - Common Public License v. 1.0 + - Eclipse Public License v. 1.0 + - Cecill v. 2.0 diff -r deac632e477c -r d1b294812560 src/tizen/hashes/md4.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/hashes/md4.js Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,236 @@ +/* + * A JavaScript implementation of the RSA Data Security, Inc. MD4 Message + * Digest Algorithm, as defined in RFC 1320. + * Version 2.1 Copyright (C) Jerrad Pierce, Paul Johnston 1999 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for more info. + */ + +/* + * Configurable variables. You may need to tweak these to be compatible with + * the server-side, but the defaults work in most cases. + */ +var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ +var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ +var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ + +/* + * These are the functions you'll usually want to call + */ +function hexmd4(s){ return binl2hex(coremd4(str2binl(s), s.length * chrsz));} +function b64md4(s){ return binl2b64(coremd4(str2binl(s), s.length * chrsz));} +function strmd4(s){ return binl2str(coremd4(str2binl(s), s.length * chrsz));} +function hexhmacmd4(key, data) { return binl2hex(corehmacmd4(key, data)); } +function b64hmacmd4(key, data) { return binl2b64(corehmacmd4(key, data)); } +function strhmacmd4(key, data) { return binl2str(corehmacmd4(key, data)); } + +/* + * Perform a simple self-test to see if the VM is working + */ +function md4vmtest() +{ + return hexmd4("abc") == "a448017aaf21d8525fc10ae87aa6729d"; +} + +/* + * Calculate the MD4 of an array of little-endian words, and a bit length + */ +function coremd4(x, len) +{ + /* append padding */ + x[len >> 5] |= 0x80 << (len % 32); + x[(((len + 64) >>> 9) << 4) + 14] = len; + + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + + for(var i = 0; i < x.length; i += 16) + { + var olda = a; + var oldb = b; + var oldc = c; + var oldd = d; + + a = md4ff(a, b, c, d, x[i+ 0], 3 ); + d = md4ff(d, a, b, c, x[i+ 1], 7 ); + c = md4ff(c, d, a, b, x[i+ 2], 11); + b = md4ff(b, c, d, a, x[i+ 3], 19); + a = md4ff(a, b, c, d, x[i+ 4], 3 ); + d = md4ff(d, a, b, c, x[i+ 5], 7 ); + c = md4ff(c, d, a, b, x[i+ 6], 11); + b = md4ff(b, c, d, a, x[i+ 7], 19); + a = md4ff(a, b, c, d, x[i+ 8], 3 ); + d = md4ff(d, a, b, c, x[i+ 9], 7 ); + c = md4ff(c, d, a, b, x[i+10], 11); + b = md4ff(b, c, d, a, x[i+11], 19); + a = md4ff(a, b, c, d, x[i+12], 3 ); + d = md4ff(d, a, b, c, x[i+13], 7 ); + c = md4ff(c, d, a, b, x[i+14], 11); + b = md4ff(b, c, d, a, x[i+15], 19); + + a = md4gg(a, b, c, d, x[i+ 0], 3 ); + d = md4gg(d, a, b, c, x[i+ 4], 5 ); + c = md4gg(c, d, a, b, x[i+ 8], 9 ); + b = md4gg(b, c, d, a, x[i+12], 13); + a = md4gg(a, b, c, d, x[i+ 1], 3 ); + d = md4gg(d, a, b, c, x[i+ 5], 5 ); + c = md4gg(c, d, a, b, x[i+ 9], 9 ); + b = md4gg(b, c, d, a, x[i+13], 13); + a = md4gg(a, b, c, d, x[i+ 2], 3 ); + d = md4gg(d, a, b, c, x[i+ 6], 5 ); + c = md4gg(c, d, a, b, x[i+10], 9 ); + b = md4gg(b, c, d, a, x[i+14], 13); + a = md4gg(a, b, c, d, x[i+ 3], 3 ); + d = md4gg(d, a, b, c, x[i+ 7], 5 ); + c = md4gg(c, d, a, b, x[i+11], 9 ); + b = md4gg(b, c, d, a, x[i+15], 13); + + a = md4hh(a, b, c, d, x[i+ 0], 3 ); + d = md4hh(d, a, b, c, x[i+ 8], 9 ); + c = md4hh(c, d, a, b, x[i+ 4], 11); + b = md4hh(b, c, d, a, x[i+12], 15); + a = md4hh(a, b, c, d, x[i+ 2], 3 ); + d = md4hh(d, a, b, c, x[i+10], 9 ); + c = md4hh(c, d, a, b, x[i+ 6], 11); + b = md4hh(b, c, d, a, x[i+14], 15); + a = md4hh(a, b, c, d, x[i+ 1], 3 ); + d = md4hh(d, a, b, c, x[i+ 9], 9 ); + c = md4hh(c, d, a, b, x[i+ 5], 11); + b = md4hh(b, c, d, a, x[i+13], 15); + a = md4hh(a, b, c, d, x[i+ 3], 3 ); + d = md4hh(d, a, b, c, x[i+11], 9 ); + c = md4hh(c, d, a, b, x[i+ 7], 11); + b = md4hh(b, c, d, a, x[i+15], 15); + + a = safeadd(a, olda); + b = safeadd(b, oldb); + c = safeadd(c, oldc); + d = safeadd(d, oldd); + + } + return Array(a, b, c, d); + +} + +/* + * These functions implement the basic operation for each round of the + * algorithm. + */ +function md4cmn(q, a, b, x, s, t) +{ + return safeadd(rol(safeadd(safeadd(a, q), safeadd(x, t)), s), b); +} +function md4ff(a, b, c, d, x, s) +{ + return md4cmn((b & c) | ((~b) & d), a, 0, x, s, 0); +} +function md4gg(a, b, c, d, x, s) +{ + return md4cmn((b & c) | (b & d) | (c & d), a, 0, x, s, 1518500249); +} +function md4hh(a, b, c, d, x, s) +{ + return md4cmn(b ^ c ^ d, a, 0, x, s, 1859775393); +} + +/* + * Calculate the HMAC-MD4, of a key and some data + */ +function corehmacmd4(key, data) +{ + var bkey = str2binl(key); + if(bkey.length > 16) bkey = coremd4(bkey, key.length * chrsz); + + var ipad = Array(16), opad = Array(16); + for(var i = 0; i < 16; i++) + { + ipad[i] = bkey[i] ^ 0x36363636; + opad[i] = bkey[i] ^ 0x5C5C5C5C; + } + + var hash = coremd4(ipad.concat(str2binl(data)), 512 + data.length * chrsz); + return coremd4(opad.concat(hash), 512 + 128); +} + +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ +function safeadd(x, y) +{ + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function rol(num, cnt) +{ + return (num << cnt) | (num >>> (32 - cnt)); +} + +/* + * Convert a string to an array of little-endian words + * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. + */ +function str2binl(str) +{ + var bin = Array(); + var mask = (1 << chrsz) - 1; + for(var i = 0; i < str.length * chrsz; i += chrsz) + bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); + return bin; +} + +/* + * Convert an array of little-endian words to a string + */ +function binl2str(bin) +{ + var str = ""; + var mask = (1 << chrsz) - 1; + for(var i = 0; i < bin.length * 32; i += chrsz) + str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); + return str; +} + +/* + * Convert an array of little-endian words to a hex string. + */ +function binl2hex(binarray) +{ + var hextab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i++) + { + str += hextab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + + hextab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); + } + return str; +} + +/* + * Convert an array of little-endian words to a base-64 string + */ +function binl2b64(binarray) +{ + var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i += 3) + { + var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) + | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) + | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); + for(var j = 0; j < 4; j++) + { + if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; + else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); + } + } + return str; +} diff -r deac632e477c -r d1b294812560 src/tizen/hashes/md5.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/hashes/md5.js Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,256 @@ +/* + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message + * Digest Algorithm, as defined in RFC 1321. + * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for more info. + */ + +/* + * Configurable variables. You may need to tweak these to be compatible with + * the server-side, but the defaults work in most cases. + */ +var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ +var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ +var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ + +/* + * These are the functions you'll usually want to call + * They take string arguments and return either hex or base-64 encoded strings + */ +function hexmd5(s){ return binl2hex(coremd5(str2binl(s), s.length * chrsz));} +function b64md5(s){ return binl2b64(coremd5(str2binl(s), s.length * chrsz));} +function strmd5(s){ return binl2str(coremd5(str2binl(s), s.length * chrsz));} +function hexhmacmd5(key, data) { return binl2hex(corehmacmd5(key, data)); } +function b64hmacmd5(key, data) { return binl2b64(corehmacmd5(key, data)); } +function strhmacmd5(key, data) { return binl2str(corehmacmd5(key, data)); } + +/* + * Perform a simple self-test to see if the VM is working + */ +function md5vmtest() +{ + return hexmd5("abc") == "900150983cd24fb0d6963f7d28e17f72"; +} + +/* + * Calculate the MD5 of an array of little-endian words, and a bit length + */ +function coremd5(x, len) +{ + /* append padding */ + x[len >> 5] |= 0x80 << ((len) % 32); + x[(((len + 64) >>> 9) << 4) + 14] = len; + + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + + for(var i = 0; i < x.length; i += 16) + { + var olda = a; + var oldb = b; + var oldc = c; + var oldd = d; + + a = md5ff(a, b, c, d, x[i+ 0], 7 , -680876936); + d = md5ff(d, a, b, c, x[i+ 1], 12, -389564586); + c = md5ff(c, d, a, b, x[i+ 2], 17, 606105819); + b = md5ff(b, c, d, a, x[i+ 3], 22, -1044525330); + a = md5ff(a, b, c, d, x[i+ 4], 7 , -176418897); + d = md5ff(d, a, b, c, x[i+ 5], 12, 1200080426); + c = md5ff(c, d, a, b, x[i+ 6], 17, -1473231341); + b = md5ff(b, c, d, a, x[i+ 7], 22, -45705983); + a = md5ff(a, b, c, d, x[i+ 8], 7 , 1770035416); + d = md5ff(d, a, b, c, x[i+ 9], 12, -1958414417); + c = md5ff(c, d, a, b, x[i+10], 17, -42063); + b = md5ff(b, c, d, a, x[i+11], 22, -1990404162); + a = md5ff(a, b, c, d, x[i+12], 7 , 1804603682); + d = md5ff(d, a, b, c, x[i+13], 12, -40341101); + c = md5ff(c, d, a, b, x[i+14], 17, -1502002290); + b = md5ff(b, c, d, a, x[i+15], 22, 1236535329); + + a = md5gg(a, b, c, d, x[i+ 1], 5 , -165796510); + d = md5gg(d, a, b, c, x[i+ 6], 9 , -1069501632); + c = md5gg(c, d, a, b, x[i+11], 14, 643717713); + b = md5gg(b, c, d, a, x[i+ 0], 20, -373897302); + a = md5gg(a, b, c, d, x[i+ 5], 5 , -701558691); + d = md5gg(d, a, b, c, x[i+10], 9 , 38016083); + c = md5gg(c, d, a, b, x[i+15], 14, -660478335); + b = md5gg(b, c, d, a, x[i+ 4], 20, -405537848); + a = md5gg(a, b, c, d, x[i+ 9], 5 , 568446438); + d = md5gg(d, a, b, c, x[i+14], 9 , -1019803690); + c = md5gg(c, d, a, b, x[i+ 3], 14, -187363961); + b = md5gg(b, c, d, a, x[i+ 8], 20, 1163531501); + a = md5gg(a, b, c, d, x[i+13], 5 , -1444681467); + d = md5gg(d, a, b, c, x[i+ 2], 9 , -51403784); + c = md5gg(c, d, a, b, x[i+ 7], 14, 1735328473); + b = md5gg(b, c, d, a, x[i+12], 20, -1926607734); + + a = md5hh(a, b, c, d, x[i+ 5], 4 , -378558); + d = md5hh(d, a, b, c, x[i+ 8], 11, -2022574463); + c = md5hh(c, d, a, b, x[i+11], 16, 1839030562); + b = md5hh(b, c, d, a, x[i+14], 23, -35309556); + a = md5hh(a, b, c, d, x[i+ 1], 4 , -1530992060); + d = md5hh(d, a, b, c, x[i+ 4], 11, 1272893353); + c = md5hh(c, d, a, b, x[i+ 7], 16, -155497632); + b = md5hh(b, c, d, a, x[i+10], 23, -1094730640); + a = md5hh(a, b, c, d, x[i+13], 4 , 681279174); + d = md5hh(d, a, b, c, x[i+ 0], 11, -358537222); + c = md5hh(c, d, a, b, x[i+ 3], 16, -722521979); + b = md5hh(b, c, d, a, x[i+ 6], 23, 76029189); + a = md5hh(a, b, c, d, x[i+ 9], 4 , -640364487); + d = md5hh(d, a, b, c, x[i+12], 11, -421815835); + c = md5hh(c, d, a, b, x[i+15], 16, 530742520); + b = md5hh(b, c, d, a, x[i+ 2], 23, -995338651); + + a = md5ii(a, b, c, d, x[i+ 0], 6 , -198630844); + d = md5ii(d, a, b, c, x[i+ 7], 10, 1126891415); + c = md5ii(c, d, a, b, x[i+14], 15, -1416354905); + b = md5ii(b, c, d, a, x[i+ 5], 21, -57434055); + a = md5ii(a, b, c, d, x[i+12], 6 , 1700485571); + d = md5ii(d, a, b, c, x[i+ 3], 10, -1894986606); + c = md5ii(c, d, a, b, x[i+10], 15, -1051523); + b = md5ii(b, c, d, a, x[i+ 1], 21, -2054922799); + a = md5ii(a, b, c, d, x[i+ 8], 6 , 1873313359); + d = md5ii(d, a, b, c, x[i+15], 10, -30611744); + c = md5ii(c, d, a, b, x[i+ 6], 15, -1560198380); + b = md5ii(b, c, d, a, x[i+13], 21, 1309151649); + a = md5ii(a, b, c, d, x[i+ 4], 6 , -145523070); + d = md5ii(d, a, b, c, x[i+11], 10, -1120210379); + c = md5ii(c, d, a, b, x[i+ 2], 15, 718787259); + b = md5ii(b, c, d, a, x[i+ 9], 21, -343485551); + + a = safeadd(a, olda); + b = safeadd(b, oldb); + c = safeadd(c, oldc); + d = safeadd(d, oldd); + } + return Array(a, b, c, d); + +} + +/* + * These functions implement the four basic operations the algorithm uses. + */ +function md5cmn(q, a, b, x, s, t) +{ + return safeadd(bitrol(safeadd(safeadd(a, q), safeadd(x, t)), s),b); +} +function md5ff(a, b, c, d, x, s, t) +{ + return md5cmn((b & c) | ((~b) & d), a, b, x, s, t); +} +function md5gg(a, b, c, d, x, s, t) +{ + return md5cmn((b & d) | (c & (~d)), a, b, x, s, t); +} +function md5hh(a, b, c, d, x, s, t) +{ + return md5cmn(b ^ c ^ d, a, b, x, s, t); +} +function md5ii(a, b, c, d, x, s, t) +{ + return md5cmn(c ^ (b | (~d)), a, b, x, s, t); +} + +/* + * Calculate the HMAC-MD5, of a key and some data + */ +function corehmacmd5(key, data) +{ + var bkey = str2binl(key); + if(bkey.length > 16) bkey = coremd5(bkey, key.length * chrsz); + + var ipad = Array(16), opad = Array(16); + for(var i = 0; i < 16; i++) + { + ipad[i] = bkey[i] ^ 0x36363636; + opad[i] = bkey[i] ^ 0x5C5C5C5C; + } + + var hash = coremd5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); + return coremd5(opad.concat(hash), 512 + 128); +} + +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ +function safeadd(x, y) +{ + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function bitrol(num, cnt) +{ + return (num << cnt) | (num >>> (32 - cnt)); +} + +/* + * Convert a string to an array of little-endian words + * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. + */ +function str2binl(str) +{ + var bin = Array(); + var mask = (1 << chrsz) - 1; + for(var i = 0; i < str.length * chrsz; i += chrsz) + bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); + return bin; +} + +/* + * Convert an array of little-endian words to a string + */ +function binl2str(bin) +{ + var str = ""; + var mask = (1 << chrsz) - 1; + for(var i = 0; i < bin.length * 32; i += chrsz) + str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); + return str; +} + +/* + * Convert an array of little-endian words to a hex string. + */ +function binl2hex(binarray) +{ + var hextab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i++) + { + str += hextab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + + hextab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); + } + return str; +} + +/* + * Convert an array of little-endian words to a base-64 string + */ +function binl2b64(binarray) +{ + var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i += 3) + { + var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) + | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) + | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); + for(var j = 0; j < 4; j++) + { + if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; + else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); + } + } + return str; +} diff -r deac632e477c -r d1b294812560 src/tizen/hashes/rmd160.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/hashes/rmd160.js Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,249 @@ +/* A JavaScript implementation of RIPEMD-160, as specified at + * + * http://www.esat.kuleuven.ac.be/~cosicart/pdf/AB-9601/ + * + * This is pretty much a straight translation of the pseudocode, which is + * shorter than the reference version which has loops unrolled, but is + * also somewhat slower. + * + * More information about RIPEMD-160 can be found at + * + * http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html + * + * Copyright (c) 2004, Jeremy Lin. Written 2004/02/29. + * + * You may use this code under the terms of the BSD-style jsotp license: + * + * http://www.ocf.berkeley.edu/~jjlin/jsotp/license.html + * + * The utility functions and general framework are borrowed from Paul Johnston's + * MD4/MD5/SHA-1 JavaScript implementations (http://pajhome.org.uk/crypt/md5), so + * + * Portions copyright (c) 1999-2002, Paul Johnston. + */ + +/* + * Configurable variables. You may need to tweak these to be compatible with + * the server-side, but the defaults work in most cases. + */ +var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ +var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ +var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ + +/* + * These are the functions you'll usually want to call + * They take string arguments and return either hex or base-64 encoded strings + */ +function hexrmd160(s){return binl2hex(corermd160(str2binl(s),s.length * chrsz));} +function b64rmd160(s){return binl2b64(corermd160(str2binl(s),s.length * chrsz));} +function strrmd160(s){return binl2str(corermd160(str2binl(s),s.length * chrsz));} +function hexhmacrmd160(key, data){ return binl2hex(corehmacrmd160(key, data));} +function b64hmacrmd160(key, data){ return binl2b64(corehmacrmd160(key, data));} +function strhmacrmd160(key, data){ return binl2str(corehmacrmd160(key, data));} + +/* + * Perform a simple self-test to see if the VM is working + */ +function rmd160vmtest() +{ + return hexrmd160("abc") == "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc"; +} + +/* + * Calculate the RMD-160 of an array of big-endian words, and a bit length + */ +function corermd160(x, len) +{ + /* append padding */ + x[len >> 5] |= 0x80 << (len % 32); + x[(((len + 64) >>> 9) << 4) + 14] = len; + + var h0 = 0x67452301; + var h1 = 0xefcdab89; + var h2 = 0x98badcfe; + var h3 = 0x10325476; + var h4 = 0xc3d2e1f0; + + for (var i = 0; i < x.length; i += 16) { + var T; + var A1 = h0, B1 = h1, C1 = h2, D1 = h3, E1 = h4; + var A2 = h0, B2 = h1, C2 = h2, D2 = h3, E2 = h4; + for (var j = 0; j <= 79; ++j) { + T = safeadd(A1, rmd160f(j, B1, C1, D1)); + T = safeadd(T, x[i + rmd160r1[j]]); + T = safeadd(T, rmd160K1(j)); + T = safeadd(rol(T, rmd160s1[j]), E1); + A1 = E1; E1 = D1; D1 = rol(C1, 10); C1 = B1; B1 = T; + T = safeadd(A2, rmd160f(79-j, B2, C2, D2)); + T = safeadd(T, x[i + rmd160r2[j]]); + T = safeadd(T, rmd160K2(j)); + T = safeadd(rol(T, rmd160s2[j]), E2); + A2 = E2; E2 = D2; D2 = rol(C2, 10); C2 = B2; B2 = T; + } + T = safeadd(h1, safeadd(C1, D2)); + h1 = safeadd(h2, safeadd(D1, E2)); + h2 = safeadd(h3, safeadd(E1, A2)); + h3 = safeadd(h4, safeadd(A1, B2)); + h4 = safeadd(h0, safeadd(B1, C2)); + h0 = T; + } + return [h0, h1, h2, h3, h4]; +} + +function rmd160f(j, x, y, z) +{ + return ( 0 <= j && j <= 15) ? (x ^ y ^ z) : + (16 <= j && j <= 31) ? (x & y) | (~x & z) : + (32 <= j && j <= 47) ? (x | ~y) ^ z : + (48 <= j && j <= 63) ? (x & z) | (y & ~z) : + (64 <= j && j <= 79) ? x ^ (y | ~z) : + "rmd160f: j out of range"; +} + +function rmd160K1(j) +{ + return ( 0 <= j && j <= 15) ? 0x00000000 : + (16 <= j && j <= 31) ? 0x5a827999 : + (32 <= j && j <= 47) ? 0x6ed9eba1 : + (48 <= j && j <= 63) ? 0x8f1bbcdc : + (64 <= j && j <= 79) ? 0xa953fd4e : + "rmd160K1: j out of range"; +} + +function rmd160K2(j) +{ + return ( 0 <= j && j <= 15) ? 0x50a28be6 : + (16 <= j && j <= 31) ? 0x5c4dd124 : + (32 <= j && j <= 47) ? 0x6d703ef3 : + (48 <= j && j <= 63) ? 0x7a6d76e9 : + (64 <= j && j <= 79) ? 0x00000000 : + "rmd160K2: j out of range"; +} + +var rmd160r1 = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 +]; +var rmd160r2 = [ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 +]; +var rmd160s1 = [ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 +]; +var rmd160s2 = [ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 +]; + +/* + * Calculate the HMAC-RMD160 of a key and some data + */ +function corehmacrmd160(key, data) +{ + var bkey = str2binl(key); + if(bkey.length > 16) bkey = corermd160(bkey, key.length * chrsz); + + var ipad = Array(16), opad = Array(16); + for(var i = 0; i < 16; i++) + { + ipad[i] = bkey[i] ^ 0x36363636; + opad[i] = bkey[i] ^ 0x5C5C5C5C; + } + + var hash = corermd160(ipad.concat(str2binl(data)), 512 + data.length * chrsz); + return corermd160(opad.concat(hash), 512 + 160); +} + +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ +function safeadd(x, y) +{ + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function rol(num, cnt) +{ + return (num << cnt) | (num >>> (32 - cnt)); +} + +/* + * Convert a string to an array of little-endian words + * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. + */ +function str2binl(str) +{ + var bin = Array(); + var mask = (1 << chrsz) - 1; + for(var i = 0; i < str.length * chrsz; i += chrsz) + bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); + return bin; +} + +/* + * Convert an array of little-endian words to a string + */ +function binl2str(bin) +{ + var str = ""; + var mask = (1 << chrsz) - 1; + for(var i = 0; i < bin.length * 32; i += chrsz) + str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); + return str; +} + +/* + * Convert an array of little-endian words to a hex string. + */ +function binl2hex(binarray) +{ + var hextab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i++) + { + str += hextab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + + hextab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); + } + return str; +} + +/* + * Convert an array of little-endian words to a base-64 string + */ +function binl2b64(binarray) +{ + var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i += 3) + { + var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) + | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) + | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); + for(var j = 0; j < 4; j++) + { + if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; + else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); + } + } + return str; +} diff -r deac632e477c -r d1b294812560 src/tizen/hashes/sha1.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/hashes/sha1.js Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,202 @@ +/* + * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined + * in FIPS PUB 180-1 + * Version 2.1 Copyright Paul Johnston 2000 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for details. + */ + +/* + * Configurable variables. You may need to tweak these to be compatible with + * the server-side, but the defaults work in most cases. + */ +var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ +var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ +var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ + +/* + * These are the functions you'll usually want to call + * They take string arguments and return either hex or base-64 encoded strings + */ +function hexsha1(s){return binb2hex(coresha1(str2binb(s),s.length * chrsz));} +function b64sha1(s){return binb2b64(coresha1(str2binb(s),s.length * chrsz));} +function strsha1(s){return binb2str(coresha1(str2binb(s),s.length * chrsz));} +function hexhmacsha1(key, data){ return binb2hex(corehmacsha1(key, data));} +function b64hmacsha1(key, data){ return binb2b64(corehmacsha1(key, data));} +function strhmacsha1(key, data){ return binb2str(corehmacsha1(key, data));} + +/* + * Perform a simple self-test to see if the VM is working + */ +function sha1vmtest() +{ + return hexsha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d"; +} + +/* + * Calculate the SHA-1 of an array of big-endian words, and a bit length + */ +function coresha1(x, len) +{ + /* append padding */ + x[len >> 5] |= 0x80 << (24 - len % 32); + x[((len + 64 >> 9) << 4) + 15] = len; + + var w = Array(80); + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + var e = -1009589776; + + for(var i = 0; i < x.length; i += 16) + { + var olda = a; + var oldb = b; + var oldc = c; + var oldd = d; + var olde = e; + + for(var j = 0; j < 80; j++) + { + if(j < 16) w[j] = x[i + j]; + else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1); + var t = safeadd(safeadd(rol(a, 5), sha1ft(j, b, c, d)), + safeadd(safeadd(e, w[j]), sha1kt(j))); + e = d; + d = c; + c = rol(b, 30); + b = a; + a = t; + } + + a = safeadd(a, olda); + b = safeadd(b, oldb); + c = safeadd(c, oldc); + d = safeadd(d, oldd); + e = safeadd(e, olde); + } + return Array(a, b, c, d, e); + +} + +/* + * Perform the appropriate triplet combination function for the current + * iteration + */ +function sha1ft(t, b, c, d) +{ + if(t < 20) return (b & c) | ((~b) & d); + if(t < 40) return b ^ c ^ d; + if(t < 60) return (b & c) | (b & d) | (c & d); + return b ^ c ^ d; +} + +/* + * Determine the appropriate additive constant for the current iteration + */ +function sha1kt(t) +{ + return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : + (t < 60) ? -1894007588 : -899497514; +} + +/* + * Calculate the HMAC-SHA1 of a key and some data + */ +function corehmacsha1(key, data) +{ + var bkey = str2binb(key); + if(bkey.length > 16) bkey = coresha1(bkey, key.length * chrsz); + + var ipad = Array(16), opad = Array(16); + for(var i = 0; i < 16; i++) + { + ipad[i] = bkey[i] ^ 0x36363636; + opad[i] = bkey[i] ^ 0x5C5C5C5C; + } + + var hash = coresha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz); + return coresha1(opad.concat(hash), 512 + 160); +} + +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ +function safeadd(x, y) +{ + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function rol(num, cnt) +{ + return (num << cnt) | (num >>> (32 - cnt)); +} + +/* + * Convert an 8-bit or 16-bit string to an array of big-endian words + * In 8-bit function, characters >255 have their hi-byte silently ignored. + */ +function str2binb(str) +{ + var bin = Array(); + var mask = (1 << chrsz) - 1; + for(var i = 0; i < str.length * chrsz; i += chrsz) + bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i%32); + return bin; +} + +/* + * Convert an array of big-endian words to a string + */ +function binb2str(bin) +{ + var str = ""; + var mask = (1 << chrsz) - 1; + for(var i = 0; i < bin.length * 32; i += chrsz) + str += String.fromCharCode((bin[i>>5] >>> (24 - i%32)) & mask); + return str; +} + +/* + * Convert an array of big-endian words to a hex string. + */ +function binb2hex(binarray) +{ + var hextab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i++) + { + str += hextab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) + + hextab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF); + } + return str; +} + +/* + * Convert an array of big-endian words to a base-64 string + */ +function binb2b64(binarray) +{ + var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i += 3) + { + var triplet = (((binarray[i >> 2] >> 8 * (3 - i %4)) & 0xFF) << 16) + | (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 ) + | ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF); + for(var j = 0; j < 4; j++) + { + if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; + else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); + } + } + return str; +} diff -r deac632e477c -r d1b294812560 src/tizen/help/help.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/help/help.html Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,60 @@ + + + + + + + + OTPWCalc + + + + + + + + + +
+ + +
+

OTPWCalc

+
+ +
+ + diff -r deac632e477c -r d1b294812560 src/tizen/help/help.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/help/help.js Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,75 @@ +/* + * OTPWCalc - One time password challenge response calculator client + * Copyright © 2013 Michael Schloh von Bennewitz + * + * OTPWCalc is free software: you can redistribute it and/or modify + * it under the terms of the European Union Public Licence, either + * version 1.1 of the license, or (at your option) any later version. + * + * OTPWCalc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + * the European Union Public License for more details. + * + * You should have received a copy of the European Union Public + * Licence along with OTPWCalc. If not, please refer to + * . + * + * This file is part of project OTWPCalc, a one time password challenge + * response calculator client and is found at http://otpwcalc.europalab.com/ + * + * help.js: ECMA JavaScript implementation + */ + +// + + + + + + + OTPWCalc + + + + + + + + + +
+
+

OTPWCalc

+
+
+
+

What is a One Time Password?

+

A One Time Password (OTP) is a password valid only for a single use and, once used, cannot be used again for authentication. OTPs avoid a number of shortcomings that are associated with traditional (static) passwords.

+
+
+

What can I do with this app?

+

This application serves one purpose only. It calculates and prints a OTP.

+
+
+

What can I do with OTPs?

+

Most people use OTPs to log in to their website administration, CMS, or remote console.

+
+
+

Can I log into my Google account?

+

No. Google uses OTPs, but in a slightly nonstandard way. OTPWCalc cannot calculate OTPs useful for Google authentication yet.

+
+
+

Can I log in to Win/OSX/Oracle?

+

Yes, but some work is needed on the Windows/OSX/Oracle computer to configure the authentication subsystem.

+
+
+

Can I log in to Unix/Linux?

+

Yes, by using PAM and it's quite easy.

+
+
+

What else can I do with it?

+
    +
  1. Impress your friends
  2. +
  3. VPN authentication
  4. +
  5. Single sign on
  6. +
  7. Remote access
  8. +
  9. Computer login
  10. +
  11. Disk encryption
  12. +
  13. Internet services
  14. +
  15. Systems integration
  16. +
  17. CMS authentication
  18. +
  19. Password management
  20. +
  21. Email and money transfer
  22. +
  23. Bank transaction validation
  24. +
+
+
+

Can I install OTPWCalc on …?

+
    +
  • FirefoxOS: Yes
  • +
  • Sailfish: No
  • +
  • Android: No
  • +
  • Tizen: Yes
  • +
  • MeeGo: No
  • +
  • Bada: No
  • +
  • iOS: No
  • +
  • Unix: No
  • +
  • Linux: No
  • +
  • Mac OSX: No
  • +
  • BlackBerry QNX: No
  • +
  • Windows Phone: Yes
  • +
  • Windows Store: Yes
  • +
+
+
+

Why isn't OTPWCalc compatible?

+

OTPWCalc might not be compatible with your platform of choice, usually because the necessary hardware isn't available to the author for development.

+
+
+

What happens to my password?

+

Take a look at the entry point in + main.js:

+ + var secr = $('#paswrd').val();
+ var resp = hash(secr, user, iter); +
+

In other words, the password you enter is neither stored nor transmitted. In fact, OTPWCalc doesn't store or transmit any data input at all (see James Bond question later.) It's a calculator in the true sense, just like a pocket calculator that adds numbers.

+
+
+

Is OTPWCalc safe and secure?

+

The algorithms of OTP have proven worthy of high security applications. OTPWCalc has been carefully designed and is tested thoroughly. It's both secure and safe to use.

+
+
+

Is it useful in a corporate setting?

+

Yes. Custom built enterprise versions are available accompanied with commercial support. Visit the OTPWCalc homepage for information.

+
+
+

Does James Bond use OTPWCalc?

+

Maybe, but spies probably just look over shoulders or use cameras to steal the static passwords used in OTP systems.

+
+
+

Same as Yubikey or RSA SecurID?

+

Yubikey, RSA SecurID, and OTPWCalc use similar technologies for similar applications, but OTPWCalc is strictly software and doesn't depend on the time or date.

+
+
+

How can I upgrade my OTPWCalc?

+

This varies according to the operating system used so there's no single answer.

+
+
+

Who owns OTPWCalc?

+

OTPWCalc is the property of the copyright holder, Michael Schloh von Bennewitz.

+
+
+

Is OTPWCalc licensed?

+

OTPWCalc is distributed under the terms of the European Union Public Licence. This liberal license grants you freedom to use the software and much more.

+
+
+

Which programming language?

+

OTPWCalc is built using the HTML, CSS, and JavaScript languages.

+

The jQuery Mobile and Apache Cordova development frameworks provide important additional features.

+
+
+

What are ongoing developments?

+

OTPWCalc is both active and stable, and follows a project management plan.

+
    +
  • It is undergoing i18n and l10n to several european languages.
  • +
  • HMAC-based RFC 4226 (HOTP) is being implemented.
  • +
  • Features like QR and OpenID integration are being explored.
  • +
  • Most of all, OTPWCalc is being ported to new platforms.
  • +
+

To request features or pose questions please write to the mailing list.

+
+
+

How can I report a bogue (bug)?

+

Please write to the mailing list stating the OTPWCalc version and platform. Thanks for every bug report!

+
+
+

My question isn't answered,
or this is just not working!

+

Please turn to the mailing list and ask for help there. Answers appear in a day.

+
+
+
+ + diff -r deac632e477c -r d1b294812560 src/tizen/help/hman.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/help/hman.html Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,158 @@ + + + + + + + + OTPWCalc + + + + + + + + + +
+
+

OTPWCalc

+
+
+
User Commands
+
OTPWCalc(1)
+
+
Name
+
OTPWCalc - Client application for calculating responses to OTP challenges.
+
Synopsis
+
OTPWCalc [-h] [-v] [-V]
+
Description
+
Playing the role of a hardware + token in a client server authentication system as described + in RFC 2289, OTPWCalc calculates responses to incoming + authentication challenges as typed in by the user.
+
Options
+
+ -h Display a brief help message and exit.
+ -v Print verbose text to the calling terminal.
+ -V Print the version number and exit. +
+
Terms
+
Username
+
+ The name that the server knows. For example, 'albertc'. +
+
Secret
+
+ A password, usually selected by the user, that is + needed to gain access to the server. For example, + 'Mysec2-pw'. +
+
Challenge
+
+ Information printed by the server when it tries to + authenticate a user. This information is needed by + OTPWCalc to generate a proper response. For example, + 'otp-md5 820 dinw23612'. +
+
Response
+
+ Information generated from a challenge that is used + by the server to authenticate the user. For example, + 'BIEM ROSE JINX HARD BALL SKY NEW'. +
+
Seed
+
+ Information used in conjunction with the secret and + sequence number to compute the response. It allows + the same secret to be used for multiple sequences + by changing the seed, or for authentication to + multiple servers by using different seeds. +
+
Sequence #
+
+ A counter used to track key iterations. Each time + a successful response is received by the server the + sequence number is decremented. For example, 71. +
+
Hash ID
+
+ Text that identifies the cryptographical algorithm + used. The valid hash identifiers are 'otpmd4' + corresponding to MD4, and 'otp-md5' corresponding + to MD5. +
+
Files
+
+ The application may store a cookie in a file used to + restore the most recent settings. The location of this + file (or arbitrary data structure) varies according to + the operating system. +
+
Bugs
+
This manual.
+
Security
+
+ All of the authentication strategies covered in the + standards implemented by this application are vulnerable + to man in the middle (MITM) attacks. The strategies can + be combined with public key logic to defeat such attacks. +
+
Standards
+
+ The IETF standards RFC 1760 (The S/KEY One-Time Password + System) and RFC 2289 (A One-Time Password System) are + implemented. +
+
See also
+
+ None. This is a self contained, stand alone application with + no alias commands. It is unique in that it leverages open + technologies like Javascript to run unmodified on a variety + of operating systems. +
+
Author
+
+ This application was written by + Michael Schloh von Bennewitz. +
+
Contact
+
+ Please refer to the + OTPWCalc homepage for contact information. +
+
Support
+
+ The + OTPWCalc mailing list provides information and answers to + questions. Commercial support is provided by the + author. +
+
+
+ + diff -r deac632e477c -r d1b294812560 src/tizen/help/hqst.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/help/hqst.html Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,60 @@ + + + + + + + + OTPWCalc + + + + + + + + + +
+
+

OTPWCalc

+
+
+

+ To start using OTPWCalc now… +

+
    +
  1. Install and configure a OTP authentication server on the host computer.
  2. +
  3. Add a username, seed ID, and password to the OTP authentication server.
  4. +
  5. Log in to the host computer providing the recently added username. The host computer will reply with a challange including the appropriate seed ID and a new counter number.
  6. +
  7. Type the seed ID and counter number along with the corresponding password into OTPWCalc. Click Submit.
  8. +
  9. Read the resulting OTP in
    red uppercase characters
    .
  10. +
  11. Type the OTP into the host computer console and…
    Enjoy secure access!
  12. +
+
+
+ + diff -r deac632e477c -r d1b294812560 src/tizen/help/hsec.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/help/hsec.html Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,54 @@ + + + + + + + + OTPWCalc + + + + + + + + + +
+
+

OTPWCalc

+
+
+
+

Security

+

General security concerns should be directed to the mailing list, while those of a private nature should be sent directly to the author. X.509 certificates (for exchanging S/MIME encrypted email) and GnuPG keys (to verify released software signatures) reside on the author's website.

+

Please monitor the mailing list and keep your installation of OTPWCalc up to date!

+
+
+
+ + diff -r deac632e477c -r d1b294812560 src/tizen/help/hsta.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/help/hsta.html Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,58 @@ + + + + + + + + OTPWCalc + + + + + + + + + +
+
+

OTPWCalc

+
+
+
+

Standards

+

This application implements
the following standards:

+ +
+
+
+ + diff -r deac632e477c -r d1b294812560 src/tizen/img/compute-hd.png Binary file src/tizen/img/compute-hd.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/compute-sd.png Binary file src/tizen/img/compute-sd.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/datahost.png Binary file src/tizen/img/datahost.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/document-hd.png Binary file src/tizen/img/document-hd.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/document-sd.png Binary file src/tizen/img/document-sd.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/email-hd.png Binary file src/tizen/img/email-hd.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/email-sd.png Binary file src/tizen/img/email-sd.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/manpage-hd.png Binary file src/tizen/img/manpage-hd.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/manpage-sd.png Binary file src/tizen/img/manpage-sd.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/manpage.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/img/manpage.svg Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,125 @@ + + + + + + + image/svg+xml + + PICOL Icon + 2009-03-15 + Melih Bilgil + Creative Commons BY-SA + PICOL - Pictorial Communication Language + http://blog.picol.org + http://blog.picol.org + en + + + PICOL + icon + icons + sign + GUI + vector + interface + + + This is one icon out of all PICOL icons + + Melih Bilgil (www.lonja.de), Christopher Adjei (www.boffer.net) + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r deac632e477c -r d1b294812560 src/tizen/img/otpwcalc-117px.png Binary file src/tizen/img/otpwcalc-117px.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/otpwcalc-512px.png Binary file src/tizen/img/otpwcalc-512px.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/otpwcalc-ico.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/img/otpwcalc-ico.svg Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,204 @@ + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + OTP + + + + + + + + + + + OTP + + + diff -r deac632e477c -r d1b294812560 src/tizen/img/question-hd.png Binary file src/tizen/img/question-hd.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/question-sd.png Binary file src/tizen/img/question-sd.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/quickstart-hd.png Binary file src/tizen/img/quickstart-hd.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/quickstart-sd.png Binary file src/tizen/img/quickstart-sd.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/security-hd.png Binary file src/tizen/img/security-hd.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/security-sd.png Binary file src/tizen/img/security-sd.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/seeye-hd.png Binary file src/tizen/img/seeye-hd.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/seeye-sd.png Binary file src/tizen/img/seeye-sd.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/img/seeye.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/img/seeye.svg Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,111 @@ + + + + + + + image/svg+xml + + PICOL Icon + 2009-03-15 + Melih Bilgil + Creative Commons BY-SA + PICOL - Pictorial Communication Language + http://blog.picol.org + http://blog.picol.org + en + + + PICOL + icon + icons + sign + GUI + vector + interface + + + This is one icon out of all PICOL icons + + Melih Bilgil (www.lonja.de), Christopher Adjei (www.boffer.net) + + + + + + + + + + + + + + + \ No newline at end of file diff -r deac632e477c -r d1b294812560 src/tizen/img/tastatur.png Binary file src/tizen/img/tastatur.png has changed diff -r deac632e477c -r d1b294812560 src/tizen/main.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/main.css Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,116 @@ +/* + * OTPWCalc - One time password challenge response calculator client + * Copyright © 2013 Michael Schloh von Bennewitz + * + * OTPWCalc is free software: you can redistribute it and/or modify + * it under the terms of the European Union Public Licence, either + * version 1.1 of the license, or (at your option) any later version. + * + * OTPWCalc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + * the European Union Public License for more details. + * + * You should have received a copy of the European Union Public + * Licence along with OTPWCalc. If not, please refer to + * . + * + * This file is part of project OTWPCalc, a one time password challenge + * response calculator client and is found at http://otpwcalc.europalab.com/ + * + * main.css: W3C CSS design + */ + +/* CSS media queries */ + +/* Basic desktop/screen width */ +@media only screen and (min-width : 1224px) { + /* placeholder */ +} +/* Traditional iPhone width */ +@media + only screen and (-webkit-min-device-pixel-ratio : 1.5), + only screen and (min-device-pixel-ratio : 1.5) { + /* placeholder */ + } +/* Diverse orientations */ +@media screen and (orientation:portrait) { + /* placeholder */ +} +@media screen and (orientation:landscape) { + /* placeholder */ +} + +/* Custom icons */ + +.ui-icon-otpwcalc-seepass { + background-image: url("img/seeye-sd.png"); +} +.ui-icon-otpwcalc-email { + background-image: url("img/email-sd.png"); +} +.ui-icon-otpwcalc-question { + background-image: url("img/question-sd.png"); +} +.ui-icon-otpwcalc-document { + background-image: url("img/document-sd.png"); +} +.ui-icon-otpwcalc-security { + background-image: url("img/security-sd.png"); +} +.ui-icon-otpwcalc-manpage { + background-image: url("img/manpage-sd.png"); +} +.ui-icon-otpwcalc-qstart { + background-image: url("img/quickstart-sd.png"); +} +@media only screen and (-webkit-min-device-pixel-ratio: 2) { + .ui-icon-otpwcalc-seepass { + background-image: url("img/seeye-hd.png"); + background-size: 18px 18px; + } + .ui-icon-otpwcalc-email { + background-image: url("img/email-hd.png"); + background-size: 18px 18px; + } + .ui-icon-otpwcalc-question { + background-image: url("img/question-hd.png"); + background-size: 18px 18px; + } + .ui-icon-otpwcalc-document { + background-image: url("img/document-hd.png"); + background-size: 18px 18px; + } + .ui-icon-otpwcalc-security { + background-image: url("img/security-hd.png"); + background-size: 18px 18px; + } + .ui-icon-otpwcalc-manpage { + background-image: url("img/manpage-hd.png"); + background-size: 18px 18px; + } + .ui-icon-otpwcalc-qstart { + background-image: url("img/quickstart-hd.png"); + background-size: 18px 18px; + } +} +/* Trying to stretch buttons (not working) */ +/*.ui-controlgroup-controls +{ + width:100%; +} +.ui-radio { + width:33%; +}*/ +/* HTML5 validation */ +/*input:required:invalid, input:focus:invalid { + background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAeVJREFUeNqkU01oE1EQ/mazSTdRmqSxLVSJVKU9RYoHD8WfHr16kh5EFA8eSy6hXrwUPBSKZ6E9V1CU4tGf0DZWDEQrGkhprRDbCvlpavan3ezu+LLSUnADLZnHwHvzmJlvvpkhZkY7IqFNaTuAfPhhP/8Uo87SGSaDsP27hgYM/lUpy6lHdqsAtM+BPfvqKp3ufYKwcgmWCug6oKmrrG3PoaqngWjdd/922hOBs5C/jJA6x7AiUt8VYVUAVQXXShfIqCYRMZO8/N1N+B8H1sOUwivpSUSVCJ2MAjtVwBAIdv+AQkHQqbOgc+fBvorjyQENDcch16/BtkQdAlC4E6jrYHGgGU18Io3gmhzJuwub6/fQJYNi/YBpCifhbDaAPXFvCBVxXbvfbNGFeN8DkjogWAd8DljV3KRutcEAeHMN/HXZ4p9bhncJHCyhNx52R0Kv/XNuQvYBnM+CP7xddXL5KaJw0TMAF8qjnMvegeK/SLHubhpKDKIrJDlvXoMX3y9xcSMZyBQ+tpyk5hzsa2Ns7LGdfWdbL6fZvHn92d7dgROH/730YBLtiZmEdGPkFnhX4kxmjVe2xgPfCtrRd6GHRtEh9zsL8xVe+pwSzj+OtwvletZZ/wLeKD71L+ZeHHWZ/gowABkp7AwwnEjFAAAAAElFTkSuQmCC'); + background-position: right top; + background-repeat: no-repeat; + -moz-box-shadow: none; +}*/ +/*input:required:valid { + background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAepJREFUeNrEk79PFEEUx9/uDDd7v/AAQQnEQokmJCRGwc7/QeM/YGVxsZJQYI/EhCChICYmUJigNBSGzobQaI5SaYRw6imne0d2D/bYmZ3dGd+YQKEHYiyc5GUyb3Y+77vfeWNpreFfhvXfAWAAJtbKi7dff1rWK9vPHx3mThP2Iaipk5EzTg8Qmru38H7izmkFHAF4WH1R52654PR0Oamzj2dKxYt/Bbg1OPZuY3d9aU82VGem/5LtnJscLxWzfzRxaWNqWJP0XUadIbSzu5DuvUJpzq7sfYBKsP1GJeLB+PWpt8cCXm4+2+zLXx4guKiLXWA2Nc5ChOuacMEPv20FkT+dIawyenVi5VcAbcigWzXLeNiDRCdwId0LFm5IUMBIBgrp8wOEsFlfeCGm23/zoBZWn9a4C314A1nCoM1OAVccuGyCkPs/P+pIdVIOkG9pIh6YlyqCrwhRKD3GygK9PUBImIQQxRi4b2O+JcCLg8+e8NZiLVEygwCrWpYF0jQJziYU/ho2TUuCPTn8hHcQNuZy1/94sAMOzQHDeqaij7Cd8Dt8CatGhX3iWxgtFW/m29pnUjR7TSQcRCIAVW1FSr6KAVYdi+5Pj8yunviYHq7f72po3Y9dbi7CxzDO1+duzCXH9cEPAQYAhJELY/AqBtwAAAAASUVORK5CYII='); + background-position: right top; + background-repeat: no-repeat; +}*/ diff -r deac632e477c -r d1b294812560 src/tizen/main.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/main.html Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,147 @@ + + + + + + + + + OTPWCalc + + + + + + + + + + + + + + + + +
+ + +
+ About +

OTPWCalc

+ Help +
+
+
+ + + + +
+
    + + + + +
  • +
    +

    Input Values

    +
    +
    + +
    +
    + +
    +
    + +
    + + +
    + + + + +
    + + Press to Reveal Secret +
    +
  • + +
  • +
    +

    Output Format

    +
    + + + + + + + +
    + + +
    + +
    + + + + +
    +
    +
  • + +
  • +
    + +
    + +
    +
    +
    +
    +
  • +
+
+
+
+
+ + diff -r deac632e477c -r d1b294812560 src/tizen/main.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/main.js Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,113 @@ +/* + * OTPWCalc - One time password challenge response calculator client + * Copyright © 2013 Michael Schloh von Bennewitz + * + * OTPWCalc is free software: you can redistribute it and/or modify + * it under the terms of the European Union Public Licence, either + * version 1.1 of the license, or (at your option) any later version. + * + * OTPWCalc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + * the European Union Public License for more details. + * + * You should have received a copy of the European Union Public + * Licence along with OTPWCalc. If not, please refer to + * . + * + * This file is part of project OTWPCalc, a one time password challenge + * response calculator client and is found at http://otpwcalc.europalab.com/ + * + * main.js: ECMA JavaScript implementation + */ + +// diff -r deac632e477c -r d1b294812560 src/tizen/otpalg/dict.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/otpalg/dict.js Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,260 @@ +// Words as presented in RFC 2289 (http://www.ietf.org/rfc/rfc2289.txt) +words = [ + "A", "ABE", "ACE", "ACT", "AD", "ADA", "ADD", + "AGO", "AID", "AIM", "AIR", "ALL", "ALP", "AM", "AMY", + "AN", "ANA", "AND", "ANN", "ANT", "ANY", "APE", "APS", + "APT", "ARC", "ARE", "ARK", "ARM", "ART", "AS", "ASH", + "ASK", "AT", "ATE", "AUG", "AUK", "AVE", "AWE", "AWK", + "AWL", "AWN", "AX", "AYE", "BAD", "BAG", "BAH", "BAM", + "BAN", "BAR", "BAT", "BAY", "BE", "BED", "BEE", "BEG", + "BEN", "BET", "BEY", "BIB", "BID", "BIG", "BIN", "BIT", + "BOB", "BOG", "BON", "BOO", "BOP", "BOW", "BOY", "BUB", + "BUD", "BUG", "BUM", "BUN", "BUS", "BUT", "BUY", "BY", + "BYE", "CAB", "CAL", "CAM", "CAN", "CAP", "CAR", "CAT", + "CAW", "COD", "COG", "COL", "CON", "COO", "COP", "COT", + "COW", "COY", "CRY", "CUB", "CUE", "CUP", "CUR", "CUT", + "DAB", "DAD", "DAM", "DAN", "DAR", "DAY", "DEE", "DEL", + "DEN", "DES", "DEW", "DID", "DIE", "DIG", "DIN", "DIP", + "DO", "DOE", "DOG", "DON", "DOT", "DOW", "DRY", "DUB", + "DUD", "DUE", "DUG", "DUN", "EAR", "EAT", "ED", "EEL", + "EGG", "EGO", "ELI", "ELK", "ELM", "ELY", "EM", "END", + "EST", "ETC", "EVA", "EVE", "EWE", "EYE", "FAD", "FAN", + "FAR", "FAT", "FAY", "FED", "FEE", "FEW", "FIB", "FIG", + "FIN", "FIR", "FIT", "FLO", "FLY", "FOE", "FOG", "FOR", + "FRY", "FUM", "FUN", "FUR", "GAB", "GAD", "GAG", "GAL", + "GAM", "GAP", "GAS", "GAY", "GEE", "GEL", "GEM", "GET", + "GIG", "GIL", "GIN", "GO", "GOT", "GUM", "GUN", "GUS", + "GUT", "GUY", "GYM", "GYP", "HA", "HAD", "HAL", "HAM", + "HAN", "HAP", "HAS", "HAT", "HAW", "HAY", "HE", "HEM", + "HEN", "HER", "HEW", "HEY", "HI", "HID", "HIM", "HIP", + "HIS", "HIT", "HO", "HOB", "HOC", "HOE", "HOG", "HOP", + "HOT", "HOW", "HUB", "HUE", "HUG", "HUH", "HUM", "HUT", + "I", "ICY", "IDA", "IF", "IKE", "ILL", "INK", "INN", + "IO", "ION", "IQ", "IRA", "IRE", "IRK", "IS", "IT", + "ITS", "IVY", "JAB", "JAG", "JAM", "JAN", "JAR", "JAW", + "JAY", "JET", "JIG", "JIM", "JO", "JOB", "JOE", "JOG", + "JOT", "JOY", "JUG", "JUT", "KAY", "KEG", "KEN", "KEY", + "KID", "KIM", "KIN", "KIT", "LA", "LAB", "LAC", "LAD", + "LAG", "LAM", "LAP", "LAW", "LAY", "LEA", "LED", "LEE", + "LEG", "LEN", "LEO", "LET", "LEW", "LID", "LIE", "LIN", + "LIP", "LIT", "LO", "LOB", "LOG", "LOP", "LOS", "LOT", + "LOU", "LOW", "LOY", "LUG", "LYE", "MA", "MAC", "MAD", + "MAE", "MAN", "MAO", "MAP", "MAT", "MAW", "MAY", "ME", + "MEG", "MEL", "MEN", "MET", "MEW", "MID", "MIN", "MIT", + "MOB", "MOD", "MOE", "MOO", "MOP", "MOS", "MOT", "MOW", + "MUD", "MUG", "MUM", "MY", "NAB", "NAG", "NAN", "NAP", + "NAT", "NAY", "NE", "NED", "NEE", "NET", "NEW", "NIB", + "NIL", "NIP", "NIT", "NO", "NOB", "NOD", "NON", "NOR", + "NOT", "NOV", "NOW", "NU", "NUN", "NUT", "O", "OAF", + "OAK", "OAR", "OAT", "ODD", "ODE", "OF", "OFF", "OFT", + "OH", "OIL", "OK", "OLD", "ON", "ONE", "OR", "ORB", + "ORE", "ORR", "OS", "OTT", "OUR", "OUT", "OVA", "OW", + "OWE", "OWL", "OWN", "OX", "PA", "PAD", "PAL", "PAM", + "PAN", "PAP", "PAR", "PAT", "PAW", "PAY", "PEA", "PEG", + "PEN", "PEP", "PER", "PET", "PEW", "PHI", "PI", "PIE", + "PIN", "PIT", "PLY", "PO", "POD", "POE", "POP", "POT", + "POW", "PRO", "PRY", "PUB", "PUG", "PUN", "PUP", "PUT", + "QUO", "RAG", "RAM", "RAN", "RAP", "RAT", "RAW", "RAY", + "REB", "RED", "REP", "RET", "RIB", "RID", "RIG", "RIM", + "RIO", "RIP", "ROB", "ROD", "ROE", "RON", "ROT", "ROW", + "ROY", "RUB", "RUE", "RUG", "RUM", "RUN", "RYE", "SAC", + "SAD", "SAG", "SAL", "SAM", "SAN", "SAP", "SAT", "SAW", + "SAY", "SEA", "SEC", "SEE", "SEN", "SET", "SEW", "SHE", + "SHY", "SIN", "SIP", "SIR", "SIS", "SIT", "SKI", "SKY", + "SLY", "SO", "SOB", "SOD", "SON", "SOP", "SOW", "SOY", + "SPA", "SPY", "SUB", "SUD", "SUE", "SUM", "SUN", "SUP", + "TAB", "TAD", "TAG", "TAN", "TAP", "TAR", "TEA", "TED", + "TEE", "TEN", "THE", "THY", "TIC", "TIE", "TIM", "TIN", + "TIP", "TO", "TOE", "TOG", "TOM", "TON", "TOO", "TOP", + "TOW", "TOY", "TRY", "TUB", "TUG", "TUM", "TUN", "TWO", + "UN", "UP", "US", "USE", "VAN", "VAT", "VET", "VIE", + "WAD", "WAG", "WAR", "WAS", "WAY", "WE", "WEB", "WED", + "WEE", "WET", "WHO", "WHY", "WIN", "WIT", "WOK", "WON", + "WOO", "WOW", "WRY", "WU", "YAM", "YAP", "YAW", "YE", + "YEA", "YES", "YET", "YOU", "ABED", "ABEL", "ABET", "ABLE", + "ABUT", "ACHE", "ACID", "ACME", "ACRE", "ACTA", "ACTS", "ADAM", + "ADDS", "ADEN", "AFAR", "AFRO", "AGEE", "AHEM", "AHOY", "AIDA", + "AIDE", "AIDS", "AIRY", "AJAR", "AKIN", "ALAN", "ALEC", "ALGA", + "ALIA", "ALLY", "ALMA", "ALOE", "ALSO", "ALTO", "ALUM", "ALVA", + "AMEN", "AMES", "AMID", "AMMO", "AMOK", "AMOS", "AMRA", "ANDY", + "ANEW", "ANNA", "ANNE", "ANTE", "ANTI", "AQUA", "ARAB", "ARCH", + "AREA", "ARGO", "ARID", "ARMY", "ARTS", "ARTY", "ASIA", "ASKS", + "ATOM", "AUNT", "AURA", "AUTO", "AVER", "AVID", "AVIS", "AVON", + "AVOW", "AWAY", "AWRY", "BABE", "BABY", "BACH", "BACK", "BADE", + "BAIL", "BAIT", "BAKE", "BALD", "BALE", "BALI", "BALK", "BALL", + "BALM", "BAND", "BANE", "BANG", "BANK", "BARB", "BARD", "BARE", + "BARK", "BARN", "BARR", "BASE", "BASH", "BASK", "BASS", "BATE", + "BATH", "BAWD", "BAWL", "BEAD", "BEAK", "BEAM", "BEAN", "BEAR", + "BEAT", "BEAU", "BECK", "BEEF", "BEEN", "BEER", "BEET", "BELA", + "BELL", "BELT", "BEND", "BENT", "BERG", "BERN", "BERT", "BESS", + "BEST", "BETA", "BETH", "BHOY", "BIAS", "BIDE", "BIEN", "BILE", + "BILK", "BILL", "BIND", "BING", "BIRD", "BITE", "BITS", "BLAB", + "BLAT", "BLED", "BLEW", "BLOB", "BLOC", "BLOT", "BLOW", "BLUE", + "BLUM", "BLUR", "BOAR", "BOAT", "BOCA", "BOCK", "BODE", "BODY", + "BOGY", "BOHR", "BOIL", "BOLD", "BOLO", "BOLT", "BOMB", "BONA", + "BOND", "BONE", "BONG", "BONN", "BONY", "BOOK", "BOOM", "BOON", + "BOOT", "BORE", "BORG", "BORN", "BOSE", "BOSS", "BOTH", "BOUT", + "BOWL", "BOYD", "BRAD", "BRAE", "BRAG", "BRAN", "BRAY", "BRED", + "BREW", "BRIG", "BRIM", "BROW", "BUCK", "BUDD", "BUFF", "BULB", + "BULK", "BULL", "BUNK", "BUNT", "BUOY", "BURG", "BURL", "BURN", + "BURR", "BURT", "BURY", "BUSH", "BUSS", "BUST", "BUSY", "BYTE", + "CADY", "CAFE", "CAGE", "CAIN", "CAKE", "CALF", "CALL", "CALM", + "CAME", "CANE", "CANT", "CARD", "CARE", "CARL", "CARR", "CART", + "CASE", "CASH", "CASK", "CAST", "CAVE", "CEIL", "CELL", "CENT", + "CERN", "CHAD", "CHAR", "CHAT", "CHAW", "CHEF", "CHEN", "CHEW", + "CHIC", "CHIN", "CHOU", "CHOW", "CHUB", "CHUG", "CHUM", "CITE", + "CITY", "CLAD", "CLAM", "CLAN", "CLAW", "CLAY", "CLOD", "CLOG", + "CLOT", "CLUB", "CLUE", "COAL", "COAT", "COCA", "COCK", "COCO", + "CODA", "CODE", "CODY", "COED", "COIL", "COIN", "COKE", "COLA", + "COLD", "COLT", "COMA", "COMB", "COME", "COOK", "COOL", "COON", + "COOT", "CORD", "CORE", "CORK", "CORN", "COST", "COVE", "COWL", + "CRAB", "CRAG", "CRAM", "CRAY", "CREW", "CRIB", "CROW", "CRUD", + "CUBA", "CUBE", "CUFF", "CULL", "CULT", "CUNY", "CURB", "CURD", + "CURE", "CURL", "CURT", "CUTS", "DADE", "DALE", "DAME", "DANA", + "DANE", "DANG", "DANK", "DARE", "DARK", "DARN", "DART", "DASH", + "DATA", "DATE", "DAVE", "DAVY", "DAWN", "DAYS", "DEAD", "DEAF", + "DEAL", "DEAN", "DEAR", "DEBT", "DECK", "DEED", "DEEM", "DEER", + "DEFT", "DEFY", "DELL", "DENT", "DENY", "DESK", "DIAL", "DICE", + "DIED", "DIET", "DIME", "DINE", "DING", "DINT", "DIRE", "DIRT", + "DISC", "DISH", "DISK", "DIVE", "DOCK", "DOES", "DOLE", "DOLL", + "DOLT", "DOME", "DONE", "DOOM", "DOOR", "DORA", "DOSE", "DOTE", + "DOUG", "DOUR", "DOVE", "DOWN", "DRAB", "DRAG", "DRAM", "DRAW", + "DREW", "DRUB", "DRUG", "DRUM", "DUAL", "DUCK", "DUCT", "DUEL", + "DUET", "DUKE", "DULL", "DUMB", "DUNE", "DUNK", "DUSK", "DUST", + "DUTY", "EACH", "EARL", "EARN", "EASE", "EAST", "EASY", "EBEN", + "ECHO", "EDDY", "EDEN", "EDGE", "EDGY", "EDIT", "EDNA", "EGAN", + "ELAN", "ELBA", "ELLA", "ELSE", "EMIL", "EMIT", "EMMA", "ENDS", + "ERIC", "EROS", "EVEN", "EVER", "EVIL", "EYED", "FACE", "FACT", + "FADE", "FAIL", "FAIN", "FAIR", "FAKE", "FALL", "FAME", "FANG", + "FARM", "FAST", "FATE", "FAWN", "FEAR", "FEAT", "FEED", "FEEL", + "FEET", "FELL", "FELT", "FEND", "FERN", "FEST", "FEUD", "FIEF", + "FIGS", "FILE", "FILL", "FILM", "FIND", "FINE", "FINK", "FIRE", + "FIRM", "FISH", "FISK", "FIST", "FITS", "FIVE", "FLAG", "FLAK", + "FLAM", "FLAT", "FLAW", "FLEA", "FLED", "FLEW", "FLIT", "FLOC", + "FLOG", "FLOW", "FLUB", "FLUE", "FOAL", "FOAM", "FOGY", "FOIL", + "FOLD", "FOLK", "FOND", "FONT", "FOOD", "FOOL", "FOOT", "FORD", + "FORE", "FORK", "FORM", "FORT", "FOSS", "FOUL", "FOUR", "FOWL", + "FRAU", "FRAY", "FRED", "FREE", "FRET", "FREY", "FROG", "FROM", + "FUEL", "FULL", "FUME", "FUND", "FUNK", "FURY", "FUSE", "FUSS", + "GAFF", "GAGE", "GAIL", "GAIN", "GAIT", "GALA", "GALE", "GALL", + "GALT", "GAME", "GANG", "GARB", "GARY", "GASH", "GATE", "GAUL", + "GAUR", "GAVE", "GAWK", "GEAR", "GELD", "GENE", "GENT", "GERM", + "GETS", "GIBE", "GIFT", "GILD", "GILL", "GILT", "GINA", "GIRD", + "GIRL", "GIST", "GIVE", "GLAD", "GLEE", "GLEN", "GLIB", "GLOB", + "GLOM", "GLOW", "GLUE", "GLUM", "GLUT", "GOAD", "GOAL", "GOAT", + "GOER", "GOES", "GOLD", "GOLF", "GONE", "GONG", "GOOD", "GOOF", + "GORE", "GORY", "GOSH", "GOUT", "GOWN", "GRAB", "GRAD", "GRAY", + "GREG", "GREW", "GREY", "GRID", "GRIM", "GRIN", "GRIT", "GROW", + "GRUB", "GULF", "GULL", "GUNK", "GURU", "GUSH", "GUST", "GWEN", + "GWYN", "HAAG", "HAAS", "HACK", "HAIL", "HAIR", "HALE", "HALF", + "HALL", "HALO", "HALT", "HAND", "HANG", "HANK", "HANS", "HARD", + "HARK", "HARM", "HART", "HASH", "HAST", "HATE", "HATH", "HAUL", + "HAVE", "HAWK", "HAYS", "HEAD", "HEAL", "HEAR", "HEAT", "HEBE", + "HECK", "HEED", "HEEL", "HEFT", "HELD", "HELL", "HELM", "HERB", + "HERD", "HERE", "HERO", "HERS", "HESS", "HEWN", "HICK", "HIDE", + "HIGH", "HIKE", "HILL", "HILT", "HIND", "HINT", "HIRE", "HISS", + "HIVE", "HOBO", "HOCK", "HOFF", "HOLD", "HOLE", "HOLM", "HOLT", + "HOME", "HONE", "HONK", "HOOD", "HOOF", "HOOK", "HOOT", "HORN", + "HOSE", "HOST", "HOUR", "HOVE", "HOWE", "HOWL", "HOYT", "HUCK", + "HUED", "HUFF", "HUGE", "HUGH", "HUGO", "HULK", "HULL", "HUNK", + "HUNT", "HURD", "HURL", "HURT", "HUSH", "HYDE", "HYMN", "IBIS", + "ICON", "IDEA", "IDLE", "IFFY", "INCA", "INCH", "INTO", "IONS", + "IOTA", "IOWA", "IRIS", "IRMA", "IRON", "ISLE", "ITCH", "ITEM", + "IVAN", "JACK", "JADE", "JAIL", "JAKE", "JANE", "JAVA", "JEAN", + "JEFF", "JERK", "JESS", "JEST", "JIBE", "JILL", "JILT", "JIVE", + "JOAN", "JOBS", "JOCK", "JOEL", "JOEY", "JOHN", "JOIN", "JOKE", + "JOLT", "JOVE", "JUDD", "JUDE", "JUDO", "JUDY", "JUJU", "JUKE", + "JULY", "JUNE", "JUNK", "JUNO", "JURY", "JUST", "JUTE", "KAHN", + "KALE", "KANE", "KANT", "KARL", "KATE", "KEEL", "KEEN", "KENO", + "KENT", "KERN", "KERR", "KEYS", "KICK", "KILL", "KIND", "KING", + "KIRK", "KISS", "KITE", "KLAN", "KNEE", "KNEW", "KNIT", "KNOB", + "KNOT", "KNOW", "KOCH", "KONG", "KUDO", "KURD", "KURT", "KYLE", + "LACE", "LACK", "LACY", "LADY", "LAID", "LAIN", "LAIR", "LAKE", + "LAMB", "LAME", "LAND", "LANE", "LANG", "LARD", "LARK", "LASS", + "LAST", "LATE", "LAUD", "LAVA", "LAWN", "LAWS", "LAYS", "LEAD", + "LEAF", "LEAK", "LEAN", "LEAR", "LEEK", "LEER", "LEFT", "LEND", + "LENS", "LENT", "LEON", "LESK", "LESS", "LEST", "LETS", "LIAR", + "LICE", "LICK", "LIED", "LIEN", "LIES", "LIEU", "LIFE", "LIFT", + "LIKE", "LILA", "LILT", "LILY", "LIMA", "LIMB", "LIME", "LIND", + "LINE", "LINK", "LINT", "LION", "LISA", "LIST", "LIVE", "LOAD", + "LOAF", "LOAM", "LOAN", "LOCK", "LOFT", "LOGE", "LOIS", "LOLA", + "LONE", "LONG", "LOOK", "LOON", "LOOT", "LORD", "LORE", "LOSE", + "LOSS", "LOST", "LOUD", "LOVE", "LOWE", "LUCK", "LUCY", "LUGE", + "LUKE", "LULU", "LUND", "LUNG", "LURA", "LURE", "LURK", "LUSH", + "LUST", "LYLE", "LYNN", "LYON", "LYRA", "MACE", "MADE", "MAGI", + "MAID", "MAIL", "MAIN", "MAKE", "MALE", "MALI", "MALL", "MALT", + "MANA", "MANN", "MANY", "MARC", "MARE", "MARK", "MARS", "MART", + "MARY", "MASH", "MASK", "MASS", "MAST", "MATE", "MATH", "MAUL", + "MAYO", "MEAD", "MEAL", "MEAN", "MEAT", "MEEK", "MEET", "MELD", + "MELT", "MEMO", "MEND", "MENU", "MERT", "MESH", "MESS", "MICE", + "MIKE", "MILD", "MILE", "MILK", "MILL", "MILT", "MIMI", "MIND", + "MINE", "MINI", "MINK", "MINT", "MIRE", "MISS", "MIST", "MITE", + "MITT", "MOAN", "MOAT", "MOCK", "MODE", "MOLD", "MOLE", "MOLL", + "MOLT", "MONA", "MONK", "MONT", "MOOD", "MOON", "MOOR", "MOOT", + "MORE", "MORN", "MORT", "MOSS", "MOST", "MOTH", "MOVE", "MUCH", + "MUCK", "MUDD", "MUFF", "MULE", "MULL", "MURK", "MUSH", "MUST", + "MUTE", "MUTT", "MYRA", "MYTH", "NAGY", "NAIL", "NAIR", "NAME", + "NARY", "NASH", "NAVE", "NAVY", "NEAL", "NEAR", "NEAT", "NECK", + "NEED", "NEIL", "NELL", "NEON", "NERO", "NESS", "NEST", "NEWS", + "NEWT", "NIBS", "NICE", "NICK", "NILE", "NINA", "NINE", "NOAH", + "NODE", "NOEL", "NOLL", "NONE", "NOOK", "NOON", "NORM", "NOSE", + "NOTE", "NOUN", "NOVA", "NUDE", "NULL", "NUMB", "OATH", "OBEY", + "OBOE", "ODIN", "OHIO", "OILY", "OINT", "OKAY", "OLAF", "OLDY", + "OLGA", "OLIN", "OMAN", "OMEN", "OMIT", "ONCE", "ONES", "ONLY", + "ONTO", "ONUS", "ORAL", "ORGY", "OSLO", "OTIS", "OTTO", "OUCH", + "OUST", "OUTS", "OVAL", "OVEN", "OVER", "OWLY", "OWNS", "QUAD", + "QUIT", "QUOD", "RACE", "RACK", "RACY", "RAFT", "RAGE", "RAID", + "RAIL", "RAIN", "RAKE", "RANK", "RANT", "RARE", "RASH", "RATE", + "RAVE", "RAYS", "READ", "REAL", "REAM", "REAR", "RECK", "REED", + "REEF", "REEK", "REEL", "REID", "REIN", "RENA", "REND", "RENT", + "REST", "RICE", "RICH", "RICK", "RIDE", "RIFT", "RILL", "RIME", + "RING", "RINK", "RISE", "RISK", "RITE", "ROAD", "ROAM", "ROAR", + "ROBE", "ROCK", "RODE", "ROIL", "ROLL", "ROME", "ROOD", "ROOF", + "ROOK", "ROOM", "ROOT", "ROSA", "ROSE", "ROSS", "ROSY", "ROTH", + "ROUT", "ROVE", "ROWE", "ROWS", "RUBE", "RUBY", "RUDE", "RUDY", + "RUIN", "RULE", "RUNG", "RUNS", "RUNT", "RUSE", "RUSH", "RUSK", + "RUSS", "RUST", "RUTH", "SACK", "SAFE", "SAGE", "SAID", "SAIL", + "SALE", "SALK", "SALT", "SAME", "SAND", "SANE", "SANG", "SANK", + "SARA", "SAUL", "SAVE", "SAYS", "SCAN", "SCAR", "SCAT", "SCOT", + "SEAL", "SEAM", "SEAR", "SEAT", "SEED", "SEEK", "SEEM", "SEEN", + "SEES", "SELF", "SELL", "SEND", "SENT", "SETS", "SEWN", "SHAG", + "SHAM", "SHAW", "SHAY", "SHED", "SHIM", "SHIN", "SHOD", "SHOE", + "SHOT", "SHOW", "SHUN", "SHUT", "SICK", "SIDE", "SIFT", "SIGH", + "SIGN", "SILK", "SILL", "SILO", "SILT", "SINE", "SING", "SINK", + "SIRE", "SITE", "SITS", "SITU", "SKAT", "SKEW", "SKID", "SKIM", + "SKIN", "SKIT", "SLAB", "SLAM", "SLAT", "SLAY", "SLED", "SLEW", + "SLID", "SLIM", "SLIT", "SLOB", "SLOG", "SLOT", "SLOW", "SLUG", + "SLUM", "SLUR", "SMOG", "SMUG", "SNAG", "SNOB", "SNOW", "SNUB", + "SNUG", "SOAK", "SOAR", "SOCK", "SODA", "SOFA", "SOFT", "SOIL", + "SOLD", "SOME", "SONG", "SOON", "SOOT", "SORE", "SORT", "SOUL", + "SOUR", "SOWN", "STAB", "STAG", "STAN", "STAR", "STAY", "STEM", + "STEW", "STIR", "STOW", "STUB", "STUN", "SUCH", "SUDS", "SUIT", + "SULK", "SUMS", "SUNG", "SUNK", "SURE", "SURF", "SWAB", "SWAG", + "SWAM", "SWAN", "SWAT", "SWAY", "SWIM", "SWUM", "TACK", "TACT", + "TAIL", "TAKE", "TALE", "TALK", "TALL", "TANK", "TASK", "TATE", + "TAUT", "TEAL", "TEAM", "TEAR", "TECH", "TEEM", "TEEN", "TEET", + "TELL", "TEND", "TENT", "TERM", "TERN", "TESS", "TEST", "THAN", + "THAT", "THEE", "THEM", "THEN", "THEY", "THIN", "THIS", "THUD", + "THUG", "TICK", "TIDE", "TIDY", "TIED", "TIER", "TILE", "TILL", + "TILT", "TIME", "TINA", "TINE", "TINT", "TINY", "TIRE", "TOAD", + "TOGO", "TOIL", "TOLD", "TOLL", "TONE", "TONG", "TONY", "TOOK", + "TOOL", "TOOT", "TORE", "TORN", "TOTE", "TOUR", "TOUT", "TOWN", + "TRAG", "TRAM", "TRAY", "TREE", "TREK", "TRIG", "TRIM", "TRIO", + "TROD", "TROT", "TROY", "TRUE", "TUBA", "TUBE", "TUCK", "TUFT", + "TUNA", "TUNE", "TUNG", "TURF", "TURN", "TUSK", "TWIG", "TWIN", + "TWIT", "ULAN", "UNIT", "URGE", "USED", "USER", "USES", "UTAH", + "VAIL", "VAIN", "VALE", "VARY", "VASE", "VAST", "VEAL", "VEDA", + "VEIL", "VEIN", "VEND", "VENT", "VERB", "VERY", "VETO", "VICE", + "VIEW", "VINE", "VISE", "VOID", "VOLT", "VOTE", "WACK", "WADE", + "WAGE", "WAIL", "WAIT", "WAKE", "WALE", "WALK", "WALL", "WALT", + "WAND", "WANE", "WANG", "WANT", "WARD", "WARM", "WARN", "WART", + "WASH", "WAST", "WATS", "WATT", "WAVE", "WAVY", "WAYS", "WEAK", + "WEAL", "WEAN", "WEAR", "WEED", "WEEK", "WEIR", "WELD", "WELL", + "WELT", "WENT", "WERE", "WERT", "WEST", "WHAM", "WHAT", "WHEE", + "WHEN", "WHET", "WHOA", "WHOM", "WICK", "WIFE", "WILD", "WILL", + "WIND", "WINE", "WING", "WINK", "WINO", "WIRE", "WISE", "WISH", + "WITH", "WOLF", "WONT", "WOOD", "WOOL", "WORD", "WORE", "WORK", + "WORM", "WORN", "WOVE", "WRIT", "WYNN", "YALE", "YANG", "YANK", + "YARD", "YARN", "YAWL", "YAWN", "YEAH", "YEAR", "YELL", "YOGA", + "YOKE" +]; diff -r deac632e477c -r d1b294812560 src/tizen/otpalg/otpalg.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tizen/otpalg/otpalg.js Wed Jul 31 19:48:00 2013 +0200 @@ -0,0 +1,169 @@ +/* + * OTPWCalc - One time password challenge response calculator client + * Copyright © 2013 Michael Schloh von Bennewitz + * + * OTPWCalc is free software: you can redistribute it and/or modify + * it under the terms of the European Union Public Licence, either + * version 1.1 of the license, or (at your option) any later version. + * + * OTPWCalc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + * the European Union Public License for more details. + * + * You should have received a copy of the European Union Public + * Licence along with OTPWCalc. If not, please refer to + * . + * + * This file is part of project OTWPCalc, a one time password challenge + * response calculator client and is found at http://otpwcalc.europalab.com/ + * + * otpalg.js: ECMA JavaScript implementation + */ + +// 0; --i) { t = mdxfold(coremd4(t, 64)); } + return t; +} + +function genotpmd5(secret, seed, n) { + var t = seed.toString().toLowerCase() + secret; + t = mdxfold(coremd5(str2binl(t), t.length * 8)); + for (var i = n; i > 0; --i) { t = mdxfold(coremd5(t, 64)); } + return t; +} + +function genotpsha1(secret, seed, n) { + var t = seed.toString().toLowerCase() + secret; + t = sha1fold(coresha1(str2binb(t), t.length * 8)); + for (var i = n; i > 0; --i) { t = sha1fold(coresha1(t, 64)); } + t = invertendian(t, true); + return t; +} + +function genotprmd160(secret, seed, n) { + var t = seed.toString().toLowerCase() + secret; + t = rmd160fold(corermd160(str2binl(t), t.length * 8)); + for (var i = n; i > 0; --i) { t = rmd160fold(corermd160(t, 64)); } + return t; +} + +function genotpmultmd4(secret, seed, n, m) { + var res = Array(); var lim = n - m + 1; + var t = seed.toString().toLowerCase() + secret; + t = mdxfold(coremd4(str2binl(t), t.length * 8)); + if (lim == 0) res[0] = t; + for (var i = 1; i <= n; ++i) { + t = mdxfold(coremd4(t, 64)); + if (i >= lim) res[i-lim] = t; + } + return res; +} + +function genotpmultmd5(secret, seed, n, m) { + var res = Array(); var lim = n - m + 1; + var t = seed.toString().toLowerCase() + secret; + t = mdxfold(coremd5(str2binl(t), t.length * 8)); + if (lim == 0) res[0] = t; + for (var i = 1; i <= n; ++i) { + t = mdxfold(coremd5(t, 64)); + if (i >= lim) res[i-lim] = t; + } + return res; +} + +function genotpmultsha1(secret, seed, n, m) { + var res = Array(); var lim = n - m + 1; + var t = seed.toString().toLowerCase() + secret; + t = sha1fold(coresha1(str2binb(t), t.length * 8)); + if (lim == 0) res[0] = invertendian(t, false); + for (var i = 1; i <= n; ++i) { + t = sha1fold(coresha1(t, 64)); + if (i >= lim) res[i-lim] = invertendian(t, false); + } + return res; +} + +function genotpmultrmd160(secret, seed, n, m) { + var res = Array(); var lim = n - m + 1; + var t = seed.toString().toLowerCase() + secret; + t = rmd160fold(corermd160(str2binl(t), t.length * 8)); + if (lim == 0) res[0] = t; + for (var i = 1; i <= n; ++i) { + t = rmd160fold(corermd160(t, 64)); + if (i >= lim) res[i-lim] = t; + } + return res; +} + +function mdxfold(h) { return Array(h[0] ^ h[2], h[1] ^ h[3]); } + +function sha1fold(h) { + h = invertendian(h, true); + return Array(h[0] ^ h[2] ^ h[4], h[1] ^ h[3]); +} + +function rmd160fold(h) { return Array(h[0] ^ h[2] ^ h[4], h[1] ^ h[3]); } + +function invertendian(a, inpl) { + var t = inpl ? a : Array(a.length); + for (var i = 0; i < a.length; ++i) { + var t1 = (a[i] & 0xff) << 24; + var t2 = ((a[i] >> 8) & 0xff) << 16; + var t3 = ((a[i] >> 16) & 0xff) << 8; + var t4 = (a[i] >> 24) & 0xff; + t[i] = t1 | t2 | t3 | t4; + } + return t; +} + +function arrtoboth(a) { return arrtosix(a) + " (" + arrtohex(a) + ")"; } + +function arrtohex(a) { + var s = ""; + for (var i = 0; i < 2; ++i) { + for (var j = 0; j < 4; ++j) { + var t = (a[i] >> (8*j)) & 0xff; + t = t.toString(16).toUpperCase(); + s += (t.length == 1) ? ('0' + t) : t; // 1 octet = 2 hex digits + if (j % 2 == 1) s += ' '; + } + } + return s.substr(0, s.length-1); // drop the last space +} + +function arrtosix(h) { + var s = ""; + var parity = 0; + for (var i = 0; i < 2; ++i) { + for (var j = 0; j < 32; j += 2) { + parity += (h[i] >> j) & 0x3; + } + } + var ind; + ind = (h[0] & 0xff) << 3; + ind |= (h[0] >> 13) & 0x7; + s += words[ind] + " "; + ind = ((h[0] >> 8) & 0x1f) << 6; + ind |= (h[0] >> 18) & 0x3f; + s += words[ind] + " "; + ind = ((h[0] >> 16) & 0x3) << 9; + ind |= ((h[0] >> 24) & 0xff) << 1; + ind |= (h[1] >> 7) & 0x1; + s += words[ind] + " "; + ind = (h[1] & 0x7f) << 4; + ind |= (h[1] >> 12) & 0xf; + s += words[ind] + " "; + ind = ((h[1] >> 8) & 0xf) << 7; + ind |= (h[1] >> 17) & 0x7f; + s += words[ind] + " "; + ind = ((h[1] >> 16) & 0x1) << 10; + ind |= ((h[1] >> 24) & 0xff) << 2; + ind |= (parity & 0x03); + s += words[ind]; + return s; +} +// ]]>