Browse Source

merged with master

gh-pages
Igor Zhukov 10 years ago
parent
commit
fa74b9fae3
  1. 4
      app.manifest
  2. 23
      css/app.css
  3. 14
      css/desktop.css
  4. 3
      css/mobile.css
  5. 45
      js/app.js
  6. 2
      js/background.js
  7. 12
      js/lib/bin_utils.js
  8. 2
      js/lib/crypto_worker.js
  9. 61
      js/locales/en-us.json
  10. 2
      manifest.json
  11. 2
      manifest.webapp
  12. 294
      vendor/cryptoJS/crypto.js
  13. 4
      webogram.appcache

4
app.manifest

@ -1,5 +1,5 @@
CACHE MANIFEST
# Time: Mon Mar 30 2015 21:47:15 GMT+0300 (MSK)
# Time: Wed Apr 08 2015 21:41:28 GMT+0300 (MSK)
CACHE:
@ -73,8 +73,8 @@ js/locales/pt-br.json
js/locales/ru-ru.json
vendor/closure/long.js
vendor/cryptoJS/crypto.js
vendor/jsbn/jsbn_combined.js
vendor/leemon_bigint/bigint.js
vendor/jsbn/jsbn_combined.js
vendor/rusha/rusha.js
vendor/angular/i18n/angular-locale_de-de.js
vendor/angular/i18n/angular-locale_en-us.js

23
css/app.css

@ -1161,6 +1161,7 @@ input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-
.btn-md-danger,.btn-md-danger:focus,.btn-md-danger:hover{color:#c05f5a}
.btn-md-danger:hover{background:#fbe7e6}
.md-input-group{height:50px;border-bottom:1px solid #e6e6e6;padding:0;margin:0 0 22px}
.md-input-grouped{margin-bottom:12px}
.md-input-label{font-weight:400;color:#999;cursor:pointer;display:block;font-size:13px;margin:0;padding:0;z-index:1;pointer-events:none;-webkit-font-smoothing:antialiased;transform-origin:left center;-webkit-transform-origin:left center;-webkit-transform:translate3d(0,22px,0);transform:translate3d(0,22px,0)}
.md-input-animated .md-input-group,.md-input-animated .md-input-label{-webkit-transition:all .15s cubic-bezier(.35,0,.25,1);transition:all .15s cubic-bezier(.35,0,.25,1)}
.md-input{color:#000;background:#fff;display:inline-block;border:0;outline:0;font-size:13px;padding:3px 0;margin:3px 0 0;width:100%;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}
@ -1249,6 +1250,7 @@ a.tg_radio_on:hover i.icon-radio{background-color:#5785aa}
.img_fullsize_progress_overlay{position:absolute;width:100%;height:100%}
.img_fullsize_progress_wrap{position:relative}
.img_fullsize_progress{position:absolute;bottom:0;left:0;width:100%;height:25px;margin:0;background:rgba(0,0,0,.5);border:0;border-radius:0;padding:10px}
.nano-content{outline:0!important}
.login_head_bg{background:#5682a3;height:226px}
.login_page{margin:-131px auto 90px;max-width:404px}
.login_head_wrap{height:75px}
@ -1276,11 +1278,14 @@ a.tg_radio_on:hover i.icon-radio{background-color:#5785aa}
.login_footer_about_wrap p:last-child{margin:0}
.login_form_head{color:#222;margin:0 0 20px;font-size:15px;font-weight:700}
.login_form_lead{color:#999;margin:15px 0 30px;font-size:13px;line-height:160%}
.login_form_hint{color:#999;margin:0 0 20px;font-size:13px;line-height:160%}
.login_form_messaging{color:#999;font-size:13px;margin-top:20px;line-height:160%}
.login_phone_head{color:#222;font-size:15px;font-weight:700;text-align:center;margin:0}
.login_edit_phone{margin:5px 0 15px;text-align:center}
.login_smscode_lead{color:#999;margin:15px 0;line-height:160%;text-align:center}
.login_smscode_lead:last-child{margin-bottom:30px}
.login_forgot_button{text-align:center;margin:30px 0 10px}
.login_reset_button{text-align:center;margin:10px 0 0}
.im_dialogs_empty_wrap{margin:60px 50px;text-align:center}
.im_dialogs_import_phonebook{margin-top:10px}
.im_dialogs_panel{padding:12px 12px 6px;position:relative}
@ -1385,7 +1390,7 @@ div.im_message_video_thumb{position:relative}
.im_message_document_thumb_wrap{border-radius:2px;overflow:hidden;background:#f2f2f2;width:100px;min-height:38px;max-height:100px;margin-right:10px;text-align:center;float:left;line-height:0}
img.im_message_document_thumb{max-width:100px;max-height:100px;vertical-align:middle}
.im_message_document_name_wrap{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;width:265px;padding:0 0 1px}
.im_message_document_actions{width:265px}
.im_message_document_actions,.im_message_website_description{width:265px}
.im_message_document_name{color:#3a6d99;display:inline-block;font-weight:700;max-width:170px;overflow:hidden;vertical-align:text-top;white-space:nowrap;text-overflow:ellipsis}
.im_message_document_size{color:#999;padding-left:2px;vertical-align:text-top}
.audio_player_actions a,.im_message_document_actions a{margin-right:10px}
@ -1409,7 +1414,7 @@ img.im_message_document_thumb{max-width:100px;max-height:100px;vertical-align:mi
.audio_player_progress_wrap{overflow:hidden}
.audio_player_progress_wrap .tg_down_progress{margin-top:5px}
.im_message_download_progress_wrap,.im_message_upload_progress_wrap{margin-top:5px;width:200px}
.im_message_document_thumbed .im_message_document_actions,.im_message_document_thumbed .im_message_document_name_wrap,.im_message_document_thumbed .im_message_download_progress_wrap,.im_message_document_thumbed .im_message_upload_progress_wrap{width:207px}
.im_message_document_thumbed .im_message_document_actions,.im_message_document_thumbed .im_message_document_name_wrap,.im_message_document_thumbed .im_message_download_progress_wrap,.im_message_document_thumbed .im_message_upload_progress_wrap,.im_message_document_thumbed .im_message_website_description{width:207px}
.im_message_document_thumbed .im_message_document_name{max-width:110px}
.im_message_video .im_message_document_actions,.im_message_video .im_message_document_name_wrap,.im_message_video .im_message_download_progress_wrap{width:152px}
.im_message_video .im_message_document_name_wrap{margin-top:5px}
@ -1579,6 +1584,18 @@ img.chat_modal_participant_photo{width:40px;height:40px}
.contacts_modal_members_list .contacts_modal_contact_wrap.active .icon-contact-tick{background-position:-9px -481px;opacity:1}
.contacts_modal_members_list .disabled{pointer-events:none}
.contacts_modal_members_list .disabled .icon-contact-tick{display:none}
.sessions_modal_session{padding:8px 16px}
.sessions_modal_sessions_header{color:#999;font-size:13px;margin-left:16px;margin-top:20px;font-weight:700}
.sessions_modal_terminate_all_wrap{margin:5px 0;text-align:center}
.sessions_modal_sessions_list{margin-bottom:20px}
.session_active_date_online{color:#3a6d99}
.sessions_modal_loading{text-align:center;color:#999;font-size:16px;line-height:18px;padding:1px 50px;margin:0}
.session_active_date{color:#999}
.session_meta_wrap{text-align:right}
.session_terminate_btn{margin-top:17px}
.sessions_modal_session_app{font-weight:700;font-style:12px;margin-bottom:3px}
.sessions_modal_session_device{margin:3px 0}
.sessions_modal_session_location{color:#777}
.confirm_modal_window .modal-dialog,.error_modal_window .modal-dialog,.md_simple_modal_window .modal-dialog{max-width:348px}
.im_edit_panel_title{text-align:center;margin:0;font-size:14px;line-height:34px}
.im_message_focus .audio_player_duration,.im_message_focus .audio_player_size,.im_message_focus .im_message_date,.im_message_focus .im_message_document_size,.im_message_focus .im_message_fwd_date{color:#899daf}
@ -1700,6 +1717,8 @@ a.peer_modal_photo,div.peer_modal_photo{display:block;margin-right:19px}
.md_modal_section_link{color:inherit;display:block;padding:4px 0}
.md_modal_section_link_wrap{padding-bottom:15px}
.md_modal_section_link:hover{text-decoration:none}
.md_modal_section_link.pull-right{color:#3a6d99}
.md_modal_section_text{display:block;padding:4px 0;color:#777}
.md_modal_section_version{color:#777;display:inline-block;margin-left:-70px;position:absolute}
.md_modal_section_splitter{border-top:1px solid #dfdfdf;height:12px;background:#f5f5f5;-webkit-box-shadow:inset 0 1px 1px #ededed;-moz-box-shadow:inset 0 1px 1px #ededed;box-shadow:inset 0 1px 1px #ededed}
.md_modal_versioned_section_wrap{position:relative;border-bottom:1px solid #ebebeb;margin:19px 0 0 120px;padding-right:28px}

14
css/desktop.css

@ -554,6 +554,7 @@ a.footer_link.active:active {
}
.im_history_col .nano > .nano-pane,
.contacts_modal_col .nano > .nano-pane,
.sessions_modal_col .nano > .nano-pane,
.im_dialogs_modal_col .nano > .nano-pane {
background: rgba(216, 223, 225, 0.45);
/*45% d8dfe5*/
@ -572,6 +573,12 @@ a.footer_link.active:active {
width: 5px;
right: 4px;
}
.sessions_modal_col .nano > .nano-pane {
top: 4px;
bottom: 4px;
width: 5px;
right: 4px;
}
.im_dialogs_modal_col .nano > .nano-pane {
width: 6px;
right: 2px;
@ -582,6 +589,7 @@ a.footer_link.active:active {
}
.im_history_col .nano > .nano-pane > .nano-slider,
.contacts_modal_col .nano > .nano-pane > .nano-slider,
.sessions_modal_col .nano > .nano-pane > .nano-slider,
.im_dialogs_modal_col .nano > .nano-pane > .nano-slider {
background: rgba(137, 160, 179, 0.5);
/*50% 89a0b3*/
@ -641,6 +649,12 @@ a.footer_link.active:active {
.contacts_modal_members_list .active a.contacts_modal_contact .md_modal_list_peer_description .status_online {
color: #fff;
}
.session_terminate_btn {
opacity: 0;
}
.sessions_modal_session:hover .session_terminate_btn {
opacity: 1;
}
.icon-message-status {
pointer-events: none;
background: #4eabf1;

3
css/mobile.css

@ -1157,6 +1157,9 @@ a.mobile_modal_action .tg_checkbox_label {
.contacts_modal_members_list li:last-child a {
border-bottom: 0;
}
.sessions_modal_wrap .mobile_modal_body {
padding: 0;
}
.mobile_modal .peer_select_modal_wrap .modal-body {
padding: 0;
}

45
js/app.js

File diff suppressed because one or more lines are too long

2
js/background.js

@ -1,5 +1,5 @@
/*!
* Webogram v0.4.2 - messaging web application for MTProto
* Webogram v0.4.3 - messaging web application for MTProto
* https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE

12
js/lib/bin_utils.js

@ -1,5 +1,5 @@
/*!
* Webogram v0.4.2 - messaging web application for MTProto
* Webogram v0.4.3 - messaging web application for MTProto
* https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE
@ -317,6 +317,16 @@ function sha1BytesSync (bytes) {
return bytesFromArrayBuffer(sha1HashSync(bytes));
}
function sha256HashSync (bytes) {
// console.log(dT(), 'SHA-2 hash start', bytes.byteLength || bytes.length);
var hashWords = CryptoJS.SHA256(bytesToWords(bytes));
// console.log(dT(), 'SHA-2 hash finish');
var hashBytes = bytesFromWords(hashWords);
return hashBytes;
}
function rsaEncrypt (publicKey, bytes) {

2
js/lib/crypto_worker.js

@ -1,5 +1,5 @@
/*!
* Webogram v0.4.2 - messaging web application for MTProto
* Webogram v0.4.3 - messaging web application for MTProto
* https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE

61
js/locales/en-us.json

@ -37,6 +37,7 @@
"settings_modal_edit_username": "Change username",
"settings_modal_empty_username_set": "Set username",
"settings_modal_terminate_sessions": "Terminate all sessions",
"settings_modal_active_sessions": "Active sessions",
"settings_modal_settings": "Settings",
"settings_modal_notification_alert": "Notification alerts",
"settings_modal_vibrate": "Vibrate",
@ -54,6 +55,36 @@
"settings_modal_follow_us_twitter": "Follow us on Twitter!",
"settings_modal_recent_updates": "Recent updates (ver. {version})",
"settings_modal_set_password": "Set Additional Password",
"settings_modal_change_password": "Change password",
"settings_modal_disable_password": "Turn off",
"settings_modal_disable_password_mobile": "Turn password off",
"settings_modal_password_email_pending": "Click the link in {email} to complete Two-Step Verification setup.",
"settings_modal_password_email_pending_cancel": "Abort",
"settings_modal_password_email_pending_cancel_mobile": "Abort Password",
"password_delete_title": "Turn Password Off",
"password_change_title": "Two-Step Verification",
"password_current_placeholder": "Enter current password",
"password_create_placeholder": "Enter a password",
"password_new_placeholder": "Enter new password",
"password_confirm_placeholder": "Re-enter new password",
"password_hint_placeholder": "Enter password hint",
"password_email_placeholder": "Enter recovery e-mail",
"password_create_description": "This password will be required when you log in on a new device in addition to the pin code.",
"password_create_active": "Saving...",
"password_create_submit": "Save",
"password_delete_active": "Deleting...",
"password_delete_submit": "Delete password",
"sessions_modal_title": "Active Sessions",
"sessions_modal_loading": "Loading{dots}",
"sessions_modal_current_session": "Current session",
"sessions_modal_session_online": "online",
"sessions_modal_terminate_one": "Terminate",
"sessions_modal_terminate_all": "Terminate all other sessions",
"sessions_modal_active_sessions": "Active sessions",
"page_title_pluralize_notifications": "{'0': 'No notifications', 'one': '1 notification', 'other': '{} notifications'}",
"profile_edit_modal_title": "Edit profile",
@ -132,7 +163,8 @@
"confirm_modal_logout": "Are you sure you want to log out?",
"confirm_modal_update_reload": "A new version of Telegram Web has been downloaded. Launch it?",
"confirm_modal_history_flush": "Are you sure? This can not be undone!",
"confirm_modal_terminate_sessions": "Are you sure you want to log out all devices except for the current one?",
"confirm_modal_terminate_sessions": "Are you sure you want to log out all devices except for this one?",
"confirm_modal_terminate_session": "Are you sure you want to log out this device?",
"confirm_modal_clipboard_file_send": "Are you sure to send file(s) from clipboard?",
"confirm_modal_clipboard_X_files_send": "{'one': 'Are you sure to send file from clipboard?', 'other': 'Are you sure to send {} files from clipboard?'}",
"confirm_modal_message_delete": "Are you sure you want to delete the message?",
@ -147,6 +179,9 @@
"confirm_modal_migrate_to_https_md": "Telegram Web now supports additional SSL encryption. Would you like to switch to HTTPS?\nThe HTTP version will be disabled soon.",
"confirm_modal_resize_desktop_md": "Would you like to switch to desktop version?",
"confirm_modal_resize_mobile_md": "Would you like to switch to mobile version?",
"confirm_modal_recovery_email_empty_md": "Warning! Are you sure you don't want to add a password recovery e-mail?\n\nIf you forget your password, you will lose access to your Telegram account",
"confirm_modal_abort_password_setup": "Abort two-step verification setup?",
"confirm_modal_reset_account_md": "Are you sure?\nThis action can not be undone.\n\nYou will lose all your chats and messages, along with any media and files you shared, if you proceed with resetting your account.",
"confirm_modal_are_u_sure": "Are you sure?",
"confirm_modal_logout_submit": "Log Out",
@ -161,6 +196,7 @@
"confirm_modal_share_video_submit": "Forward video",
"confirm_modal_share_contact_submit": "Send contact",
"confirm_modal_share_file_submit": "Share file",
"confirm_modal_reset_account_submit": "Reset my account",
"contacts_modal_edit_list": "Edit",
"contacts_modal_edit_cancel": "Cancel",
@ -232,7 +268,12 @@
"error_modal_flood_title": "Too fast",
"error_modal_internal_title": "Server error",
"error_modal_alert": "Alert",
"error_modal_email_unconfirmed_title": "Almost there!",
"error_modal_email_unconfirmed_descripion": "Please check your e-mail (don't forget the spam folder) to complete Two-Step Verification setup.",
"error_modal_password_success_title": "Success!",
"error_modal_password_disabled_title": "Password deactivated",
"error_modal_media_not_supported_title": "Unsupported media",
"error_modal_recovery_na_title": "Sorry",
"error_modal_network_description": "Please check your internet connection.",
"error_modal_firstname_invali_description": "The first name you entered is invalid.",
@ -258,6 +299,9 @@
"error_modal_internal_description": "Internal server error occured. Please try again later.",
"error_modal_tech_details": "Technical details here",
"error_modal_multiple_open_tabs": "Please close other Telegram app tabs.",
"error_modal_recovery_na_description": "Since you haven't provided a recovery e-mail when setting up your password, your remaining options are either to remember your password or to reset your account.",
"error_modal_password_success_descripion": "Your password for Two-Step Verification is now active.",
"error_modal_password_disabled_descripion": "You have disabled Two-Step Verification.",
"head_telegram": "Telegram",
@ -367,6 +411,21 @@
"login_about_desc3_md": "Our {source-link: source code} is open, so everyone can make a contribution.",
"login_about_intro": "Welcome to the official Telegram web-client.",
"login_about_learn": "Learn more",
"login_password_title": "Password",
"login_password_label": "You have enabled Two-Step Verification, so your account is protected with an additional password.",
"login_password_forgot_link": "Forgot password?",
"login_account_reset": "Reset account",
"login_password": "Your Password",
"login_incorrect_password": "Incorrect password",
"login_checking_password": "Checking",
"login_recovery_title": "Forgot password?",
"login_code_placeholder": "Code",
"login_code_incorrect": "Incorrect code",
"login_recovery_description_md": "We have sent a recovery code to the e-mail you provided:\n\n{email}\n\nPlease check your e-mail and enter the 6-digit code we have sent here.",
"password_recover_active": "Checking...",
"password_recover_submit": "Submit",
"login_controller_unknown_country": "Unknown",

2
manifest.json

@ -1,7 +1,7 @@
{
"name": "Telegram",
"description": "Telegram Web App.\nMore info & source code here: https://github.com/zhukov/webogram",
"version": "0.4.2",
"version": "0.4.3",
"short_name": "Telegram",
"manifest_version": 2,
"app": {

2
manifest.webapp

@ -1,7 +1,7 @@
{
"name": "Telegram",
"description": "Telegram Web App.\nMore info & source code here: https://github.com/zhukov/webogram",
"version": "0.4.2",
"version": "0.4.3",
"type": "privileged",
"launch_path": "/index.html",
"developer": {

294
vendor/cryptoJS/crypto.js vendored

@ -1912,136 +1912,188 @@ code.google.com/p/crypto-js/wiki/License
/**
* Copyright (c) 2012 T. Michael Keesey
* LICENSE: http://opensource.org/licenses/MIT
*/
var sha1;
(function (sha1) {
var POW_2_24 = Math.pow(2, 24);
var POW_2_32 = Math.pow(2, 32);
function hex(n) {
var s = "", v;
for(var i = 7; i >= 0; --i) {
v = (n >>> (i << 2)) & 15;
s += v.toString(16);
}
return s;
};
/*
CryptoJS v3.1.2
code.google.com/p/crypto-js
(c) 2009-2013 by Jeff Mott. All rights reserved.
code.google.com/p/crypto-js/wiki/License
*/
(function (Math) {
// Shortcuts
var C = CryptoJS;
var C_lib = C.lib;
var WordArray = C_lib.WordArray;
var Hasher = C_lib.Hasher;
var C_algo = C.algo;
function toBytes(n) {
var b = [], v;
for(var i = 3; i >= 0; --i) {
v = (n >> (i * 8)) & 255;
b.push(v);
}
return b;
};
// Initialization and round constants tables
var H = [];
var K = [];
function lrot(n, bits) {
return ((n << bits) | (n >>> (32 - bits)));
}
var Uint32ArrayBigEndian = (function () {
function Uint32ArrayBigEndian(length) {
this.bytes = new Uint8Array(length << 2);
}
Uint32ArrayBigEndian.prototype.get = function (index) {
index <<= 2;
return (this.bytes[index] * POW_2_24) + ((this.bytes[index + 1] << 16) | (this.bytes[index + 2] << 8) | this.bytes[index + 3]);
};
Uint32ArrayBigEndian.prototype.set = function (index, value) {
var high = Math.floor(value / POW_2_24), rest = value - (high * POW_2_24);
index <<= 2;
this.bytes[index] = high;
this.bytes[index + 1] = rest >> 16;
this.bytes[index + 2] = (rest >> 8) & 255;
this.bytes[index + 3] = rest & 255;
};
return Uint32ArrayBigEndian;
})();
function string2ArrayBuffer(s) {
s = s.replace(/[\u0080-\u07ff]/g, function (c) {
var code = c.charCodeAt(0);
return String.fromCharCode(192 | code >> 6, 128 | code & 63);
});
s = s.replace(/[\u0080-\uffff]/g, function (c) {
var code = c.charCodeAt(0);
return String.fromCharCode(224 | code >> 12, 128 | code >> 6 & 63, 128 | code & 63);
});
var n = s.length, array = new Uint8Array(n);
for(var i = 0; i < n; ++i) {
array[i] = s.charCodeAt(i);
}
return array.buffer;
}
function bytes2ArrayBuffer(b) {
var n = b.length, array = new Uint8Array(n);
for(var i = 0; i < n; ++i) {
array[i] = b[i];
}
return array.buffer;
}
function hash(bufferOrString, byteArray) {
var source;
if (bufferOrString instanceof ArrayBuffer) {
source = bufferOrString;
} else if (Object.prototype.toString.apply(bufferOrString) == '[object Array]') {
source = bytes2ArrayBuffer(bufferOrString);
} else {
source = string2ArrayBuffer(String(bufferOrString));
// Compute constants
(function () {
function isPrime(n) {
var sqrtN = Math.sqrt(n);
for (var factor = 2; factor <= sqrtN; factor++) {
if (!(n % factor)) {
return false;
}
}
return true;
}
var h0 = 1732584193, h1 = 4023233417, h2 = 2562383102, h3 = 271733878, h4 = 3285377520, i, sbytes = source.byteLength, sbits = sbytes << 3, minbits = sbits + 65, bits = Math.ceil(minbits / 512) << 9, bytes = bits >>> 3, slen = bytes >>> 2, s = new Uint32ArrayBigEndian(slen), s8 = s.bytes, j, w = new Uint32Array(80), sourceArray = new Uint8Array(source);
for(i = 0; i < sbytes; ++i) {
s8[i] = sourceArray[i];
function getFractionalBits(n) {
return ((n - (n | 0)) * 0x100000000) | 0;
}
s8[sbytes] = 128;
s.set(slen - 2, Math.floor(sbits / POW_2_32));
s.set(slen - 1, sbits & 4294967295);
for(i = 0; i < slen; i += 16) {
for(j = 0; j < 16; ++j) {
w[j] = s.get(i + j);
}
for(; j < 80; ++j) {
w[j] = lrot(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
var n = 2;
var nPrime = 0;
while (nPrime < 64) {
if (isPrime(n)) {
if (nPrime < 8) {
H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
}
K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
nPrime++;
}
var a = h0, b = h1, c = h2, d = h3, e = h4, f, k, temp;
for(j = 0; j < 80; ++j) {
if(j < 20) {
f = (b & c) | ((~b) & d);
k = 1518500249;
n++;
}
}());
// Reusable object
var W = [];
/**
* SHA-256 hash algorithm.
*/
var SHA256 = C_algo.SHA256 = Hasher.extend({
_doReset: function () {
this._hash = new WordArray.init(H.slice(0));
},
_doProcessBlock: function (M, offset) {
// Shortcut
var H = this._hash.words;
// Working variables
var a = H[0];
var b = H[1];
var c = H[2];
var d = H[3];
var e = H[4];
var f = H[5];
var g = H[6];
var h = H[7];
// Computation
for (var i = 0; i < 64; i++) {
if (i < 16) {
W[i] = M[offset + i] | 0;
} else {
if(j < 40) {
f = b ^ c ^ d;
k = 1859775393;
} else {
if(j < 60) {
f = (b & c) ^ (b & d) ^ (c & d);
k = 2400959708;
} else {
f = b ^ c ^ d;
k = 3395469782;
}
}
var gamma0x = W[i - 15];
var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^
((gamma0x << 14) | (gamma0x >>> 18)) ^
(gamma0x >>> 3);
var gamma1x = W[i - 2];
var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^
((gamma1x << 13) | (gamma1x >>> 19)) ^
(gamma1x >>> 10);
W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
}
temp = (lrot(a, 5) + f + e + k + w[j]) & 4294967295;
e = d;
var ch = (e & f) ^ (~e & g);
var maj = (a & b) ^ (a & c) ^ (b & c);
var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));
var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));
var t1 = h + sigma1 + ch + K[i] + W[i];
var t2 = sigma0 + maj;
h = g;
g = f;
f = e;
e = (d + t1) | 0;
d = c;
c = lrot(b, 30);
c = b;
b = a;
a = temp;
a = (t1 + t2) | 0;
}
h0 = (h0 + a) & 4294967295;
h1 = (h1 + b) & 4294967295;
h2 = (h2 + c) & 4294967295;
h3 = (h3 + d) & 4294967295;
h4 = (h4 + e) & 4294967295;
}
if (byteArray) {
return toBytes(h0).concat(toBytes(h1), toBytes(h2), toBytes(h3), toBytes(h4));
// Intermediate hash value
H[0] = (H[0] + a) | 0;
H[1] = (H[1] + b) | 0;
H[2] = (H[2] + c) | 0;
H[3] = (H[3] + d) | 0;
H[4] = (H[4] + e) | 0;
H[5] = (H[5] + f) | 0;
H[6] = (H[6] + g) | 0;
H[7] = (H[7] + h) | 0;
},
_doFinalize: function () {
// Shortcuts
var data = this._data;
var dataWords = data.words;
var nBitsTotal = this._nDataBytes * 8;
var nBitsLeft = data.sigBytes * 8;
// Add padding
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
data.sigBytes = dataWords.length * 4;
// Hash final blocks
this._process();
// Return final computed hash
return this._hash;
},
clone: function () {
var clone = Hasher.clone.call(this);
clone._hash = this._hash.clone();
return clone;
}
return hex(h0) + hex(h1) + hex(h2) + hex(h3) + hex(h4);
}
sha1.hash = hash;
})(sha1 || (sha1 = {}));
});
/**
* Shortcut function to the hasher's object interface.
*
* @param {WordArray|string} message The message to hash.
*
* @return {WordArray} The hash.
*
* @static
*
* @example
*
* var hash = CryptoJS.SHA256('message');
* var hash = CryptoJS.SHA256(wordArray);
*/
C.SHA256 = Hasher._createHelper(SHA256);
/**
* Shortcut function to the HMAC's object interface.
*
* @param {WordArray|string} message The message to hash.
* @param {WordArray|string} key The secret key.
*
* @return {WordArray} The HMAC.
*
* @static
*
* @example
*
* var hmac = CryptoJS.HmacSHA256(message, key);
*/
C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
}(Math));

4
webogram.appcache

@ -1,5 +1,5 @@
CACHE MANIFEST
# Time: Mon Mar 30 2015 21:47:15 GMT+0300 (MSK)
# Time: Wed Apr 08 2015 21:41:28 GMT+0300 (MSK)
CACHE:
@ -73,8 +73,8 @@ js/locales/pt-br.json
js/locales/ru-ru.json
vendor/closure/long.js
vendor/cryptoJS/crypto.js
vendor/jsbn/jsbn_combined.js
vendor/leemon_bigint/bigint.js
vendor/jsbn/jsbn_combined.js
vendor/rusha/rusha.js
vendor/angular/i18n/angular-locale_de-de.js
vendor/angular/i18n/angular-locale_en-us.js

Loading…
Cancel
Save