]>
Commit | Line | Data |
---|---|---|
ebd8d4e8 IC |
1 | <!DOCTYPE html> |
2 | <html> | |
3 | <head lang="en"> | |
4 | <meta charset="utf-8" /> | |
5 | <title>BIP39 - Mnemonic Code</title> | |
6 | <!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">--> | |
7 | <style> | |
8 | /*! | |
9 | * Bootstrap v3.2.0 (http://getbootstrap.com) | |
10 | * Copyright 2011-2014 Twitter, Inc. | |
11 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) | |
12 | *//*! normalize.css v3.0.1 | MIT License | git.io/normalize */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}@media print{*{color:#000!important;text-shadow:none!important;background:transparent!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.table td,.table th{background-color:#fff!important}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table-bordered th,.table-bordered td{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:before,:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#428bca;text-decoration:none}a:hover,a:focus{color:#2a6496;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.img-responsive,.thumbnail>img,.thumbnail a>img,.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;width:100% \9;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;width:100% \9;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small,.h1 .small,.h2 .small,.h3 .small,.h4 .small,.h5 .small,.h6 .small{font-weight:400;line-height:1;color:#777}h1,.h1,h2,.h2,h3,.h3{margin-top:20px;margin-bottom:10px}h1 small,.h1 small,h2 small,.h2 small,h3 small,.h3 small,h1 .small,.h1 .small,h2 .small,.h2 .small,h3 .small,.h3 .small{font-size:65%}h4,.h4,h5,.h5,h6,.h6{margin-top:10px;margin-bottom:10px}h4 small,.h4 small,h5 small,.h5 small,h6 small,.h6 small,h4 .small,.h4 .small,h5 .small,.h5 .small,h6 .small,.h6 .small{font-size:75%}h1,.h1{font-size:36px}h2,.h2{font-size:30px}h3,.h3{font-size:24px}h4,.h4{font-size:18px}h5,.h5{font-size:14px}h6,.h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}small,.small{font-size:85%}cite{font-style:normal}mark,.mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#428bca}a.text-primary:hover{color:#3071a9}.text-success{color:#3c763d}a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#428bca}a.bg-primary:hover{background-color:#3071a9}.bg-success{background-color:#dff0d8}a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ul,ol{margin-top:0;margin-bottom:10px}ul ul,ol ul,ul ol,ol ol{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dt,dd{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote p:last-child,blockquote ul:last-child,blockquote ol:last-child{margin-bottom:0}blockquote footer,blockquote small,blockquote .small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote footer:before,blockquote small:before,blockquote .small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse footer:before,blockquote.pull-right footer:before,.blockquote-reverse small:before,blockquote.pull-right small:before,.blockquote-reverse .small:before,blockquote.pull-right .small:before{content:''}.blockquote-reverse footer:after,blockquote.pull-right footer:after,.blockquote-reverse small:after,blockquote.pull-right small:after,.blockquote-reverse .small:after,blockquote.pull-right .small:after{content:'\00A0 \2014'}blockquote:before,blockquote:after{content:""}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>th,.table>caption+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>td,.table>thead:first-child>tr:first-child>td{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>thead>tr>th,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>tbody>tr>td,.table-condensed>tfoot>tr>td{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}.table-striped>tbody>tr:nth-child(odd)>td,.table-striped>tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>thead>tr>td.active,.table>tbody>tr>td.active,.table>tfoot>tr>td.active,.table>thead>tr>th.active,.table>tbody>tr>th.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>tbody>tr.active>td,.table>tfoot>tr.active>td,.table>thead>tr.active>th,.table>tbody>tr.active>th,.table>tfoot>tr.active>th{background-color:#f5f5f5}.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover,.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr.active:hover>th{background-color:#e8e8e8}.table>thead>tr>td.success,.table>tbody>tr>td.success,.table>tfoot>tr>td.success,.table>thead>tr>th.success,.table>tbody>tr>th.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>tbody>tr.success>td,.table>tfoot>tr.success>td,.table>thead>tr.success>th,.table>tbody>tr.success>th,.table>tfoot>tr.success>th{background-color:#dff0d8}.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover,.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr.success:hover>th{background-color:#d0e9c6}.table>thead>tr>td.info,.table>tbody>tr>td.info,.table>tfoot>tr>td.info,.table>thead>tr>th.info,.table>tbody>tr>th.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>tbody>tr.info>td,.table>tfoot>tr.info>td,.table>thead>tr.info>th,.table>tbody>tr.info>th,.table>tfoot>tr.info>th{background-color:#d9edf7}.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover,.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr.info:hover>th{background-color:#c4e3f3}.table>thead>tr>td.warning,.table>tbody>tr>td.warning,.table>tfoot>tr>td.warning,.table>thead>tr>th.warning,.table>tbody>tr>th.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>tbody>tr.warning>td,.table>tfoot>tr.warning>td,.table>thead>tr.warning>th,.table>tbody>tr.warning>th,.table>tfoot>tr.warning>th{background-color:#fcf8e3}.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover,.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr.warning:hover>th{background-color:#faf2cc}.table>thead>tr>td.danger,.table>tbody>tr>td.danger,.table>tfoot>tr>td.danger,.table>thead>tr>th.danger,.table>tbody>tr>th.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>tbody>tr.danger>td,.table>tfoot>tr.danger>td,.table>thead>tr.danger>th,.table>tbody>tr.danger>th,.table>tfoot>tr.danger>th{background-color:#f2dede}.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover,.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr.danger:hover>th{background-color:#ebcccc}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>thead>tr>th,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tfoot>tr>td{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>thead>tr>th:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.table-responsive>.table-bordered>thead>tr>th:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>th,.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=radio],input[type=checkbox]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=radio]:focus,input[type=checkbox]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#777;opacity:1}.form-control:-ms-input-placeholder{color:#777}.form-control::-webkit-input-placeholder{color:#777}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee;opacity:1}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}input[type=date],input[type=time],input[type=datetime-local],input[type=month]{line-height:34px;line-height:1.42857143 \0}input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px}.form-group{margin-bottom:15px}.radio,.checkbox{position:relative;display:block;min-height:20px;margin-top:10px;margin-bottom:10px}.radio label,.checkbox label{padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.radio input[type=radio],.radio-inline input[type=radio],.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox]{position:absolute;margin-top:4px \9;margin-left:-20px}.radio+.radio,.checkbox+.checkbox{margin-top:-5px}.radio-inline,.checkbox-inline{display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}input[type=radio][disabled],input[type=checkbox][disabled],input[type=radio].disabled,input[type=checkbox].disabled,fieldset[disabled] input[type=radio],fieldset[disabled] input[type=checkbox]{cursor:not-allowed}.radio-inline.disabled,.checkbox-inline.disabled,fieldset[disabled] .radio-inline,fieldset[disabled] .checkbox-inline{cursor:not-allowed}.radio.disabled label,.checkbox.disabled label,fieldset[disabled] .radio label,fieldset[disabled] .checkbox label{cursor:not-allowed}.form-control-static{padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm,.form-horizontal .form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}textarea.input-sm,select[multiple].input-sm{height:auto}.input-lg,.form-horizontal .form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-lg{height:46px;line-height:46px}textarea.input-lg,select[multiple].input-lg{height:auto}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:25px;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center}.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn,.form-inline .input-group .form-control{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .radio,.form-inline .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .radio label,.form-inline .checkbox label{padding-left:0}.form-inline .radio input[type=radio],.form-inline .checkbox input[type=checkbox]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .radio,.form-horizontal .checkbox{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{top:0;right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:14.3px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn:focus,.btn:active:focus,.btn.active:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:hover,.btn:focus{color:#333;text-decoration:none}.btn:active,.btn.active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{pointer-events:none;cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default:hover,.btn-default:focus,.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default[disabled],fieldset[disabled] .btn-default,.btn-default.disabled:hover,.btn-default[disabled]:hover,fieldset[disabled] .btn-default:hover,.btn-default.disabled:focus,.btn-default[disabled]:focus,fieldset[disabled] .btn-default:focus,.btn-default.disabled:active,.btn-default[disabled]:active,fieldset[disabled] .btn-default:active,.btn-default.disabled.active,.btn-default[disabled].active,fieldset[disabled] .btn-default.active{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#3071a9;border-color:#285e8e}.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active{background-color:#428bca;border-color:#357ebd}.btn-primary .badge{color:#428bca;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success[disabled],fieldset[disabled] .btn-success,.btn-success.disabled:hover,.btn-success[disabled]:hover,fieldset[disabled] .btn-success:hover,.btn-success.disabled:focus,.btn-success[disabled]:focus,fieldset[disabled] .btn-success:focus,.btn-success.disabled:active,.btn-success[disabled]:active,fieldset[disabled] .btn-success:active,.btn-success.disabled.active,.btn-success[disabled].active,fieldset[disabled] .btn-success.active{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info[disabled],fieldset[disabled] .btn-info,.btn-info.disabled:hover,.btn-info[disabled]:hover,fieldset[disabled] .btn-info:hover,.btn-info.disabled:focus,.btn-info[disabled]:focus,fieldset[disabled] .btn-info:focus,.btn-info.disabled:active,.btn-info[disabled]:active,fieldset[disabled] .btn-info:active,.btn-info.disabled.active,.btn-info[disabled].active,fieldset[disabled] .btn-info.active{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-warning,.btn-warning.disabled:hover,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning:hover,.btn-warning.disabled:focus,.btn-warning[disabled]:focus,fieldset[disabled] .btn-warning:focus,.btn-warning.disabled:active,.btn-warning[disabled]:active,fieldset[disabled] .btn-warning:active,.btn-warning.disabled.active,.btn-warning[disabled].active,fieldset[disabled] .btn-warning.active{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger[disabled],fieldset[disabled] .btn-danger,.btn-danger.disabled:hover,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger:hover,.btn-danger.disabled:focus,.btn-danger[disabled]:focus,fieldset[disabled] .btn-danger:focus,.btn-danger.disabled:active,.btn-danger[disabled]:active,fieldset[disabled] .btn-danger:active,.btn-danger.disabled.active,.btn-danger[disabled].active,fieldset[disabled] .btn-danger.active{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#428bca;cursor:pointer;border-radius:0}.btn-link,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active{border-color:transparent}.btn-link:hover,.btn-link:focus{color:#2a6496;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,fieldset[disabled] .btn-link:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:focus{color:#777;text-decoration:none}.btn-lg,.btn-group-lg>.btn{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-sm,.btn-group-sm>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-xs,.btn-group-xs>.btn{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;-o-transition:height .35s ease;transition:height .35s ease}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;background-color:#428bca;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#777}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px solid}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;float:left}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover,.btn-group>.btn:focus,.btn-group-vertical>.btn:focus,.btn-group>.btn:active,.btn-group-vertical>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn.active{z-index:2}.btn-group>.btn:focus,.btn-group-vertical>.btn:focus{outline:0}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child>.btn:last-child,.btn-group>.btn-group:first-child>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn>input[type=radio],[data-toggle=buttons]>.btn>input[type=checkbox]{position:absolute;z-index:-1;filter:alpha(opacity=0);opacity:0}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn,select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn,select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn{height:auto}.input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell}.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=radio],.input-group-addon input[type=checkbox]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group-btn:last-child>.btn-group:not(:last-child)>.btn{border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:first-child>.btn-group:not(:first-child)>.btn{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:hover,.input-group-btn>.btn:focus,.input-group-btn>.btn:active{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:hover,.nav>li.disabled>a:focus{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:hover,.nav .open>a:focus{background-color:#eee;border-color:#428bca}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:hover,.nav-pills>li.active>a:focus{color:#fff;background-color:#428bca}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:340px}@media (max-width:480px) and (orientation:landscape){.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:200px}}.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030;-webkit-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}@media (min-width:768px){.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:hover,.navbar-brand:focus{text-decoration:none}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu>li>a,.navbar-nav .open .dropdown-menu .dropdown-header{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:hover,.navbar-nav .open .dropdown-menu>li>a:focus{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}.navbar-nav.navbar-right:last-child{margin-right:-15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn,.navbar-form .input-group .form-control{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .radio,.navbar-form .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .radio label,.navbar-form .checkbox label{padding-left:0}.navbar-form .radio input[type=radio],.navbar-form .checkbox input[type=checkbox]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-form.navbar-right:last-child{margin-right:-15px}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}.navbar-text.navbar-right:last-child{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:hover,.navbar-default .navbar-brand:focus{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:hover,.navbar-default .navbar-nav>.disabled>a:focus{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:hover,.navbar-default .navbar-toggle:focus{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:hover,.navbar-default .btn-link:focus{color:#333}.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:hover,.navbar-default .btn-link[disabled]:focus,fieldset[disabled] .navbar-default .btn-link:focus{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#777}.navbar-inverse .navbar-brand:hover,.navbar-inverse .navbar-brand:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#777}.navbar-inverse .navbar-nav>li>a{color:#777}.navbar-inverse .navbar-nav>li>a:hover,.navbar-inverse .navbar-nav>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:hover,.navbar-inverse .navbar-nav>.disabled>a:focus{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:hover,.navbar-inverse .navbar-toggle:focus{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a:focus{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#777}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#777}.navbar-inverse .btn-link:hover,.navbar-inverse .btn-link:focus{color:#fff}.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:hover,.navbar-inverse .btn-link[disabled]:focus,fieldset[disabled] .navbar-inverse .btn-link:focus{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#428bca;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{color:#2a6496;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>span,.pagination>.active>a:hover,.pagination>.active>span:hover,.pagination>.active>a:focus,.pagination>.active>span:focus{z-index:2;color:#fff;cursor:default;background-color:#428bca;border-color:#428bca}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:hover,a.label:focus{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:hover,.label-default[href]:focus{background-color:#5e5e5e}.label-primary{background-color:#428bca}.label-primary[href]:hover,.label-primary[href]:focus{background-color:#3071a9}.label-success{background-color:#5cb85c}.label-success[href]:hover,.label-success[href]:focus{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:hover,.label-info[href]:focus{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:hover,.label-warning[href]:focus{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:hover,.label-danger[href]:focus{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-xs .badge{top:0;padding:1px 5px}a.badge:hover,a.badge:focus{color:#fff;text-decoration:none;cursor:pointer}a.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#428bca;background-color:#fff}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron h1,.jumbotron .h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron{border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron{padding-right:60px;padding-left:60px}.jumbotron h1,.jumbotron .h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.thumbnail>img,.thumbnail a>img{margin-right:auto;margin-left:auto}a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active{border-color:#428bca}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#428bca;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-striped .progress-bar,.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress.active .progress-bar,.progress-bar.active{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar[aria-valuenow="1"],.progress-bar[aria-valuenow="2"]{min-width:30px}.progress-bar[aria-valuenow="0"]{min-width:30px;color:#777;background-color:transparent;background-image:none;-webkit-box-shadow:none;box-shadow:none}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media,.media-body{overflow:hidden;zoom:1}.media,.media .media{margin-top:15px}.media:first-child{margin-top:0}.media-object{display:block}.media-heading{margin:0 0 5px}.media>.pull-left{margin-right:10px}.media>.pull-right{margin-left:10px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:hover,a.list-group-item:focus{color:#555;text-decoration:none;background-color:#f5f5f5}.list-group-item.disabled,.list-group-item.disabled:hover,.list-group-item.disabled:focus{color:#777;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus{z-index:2;color:#fff;background-color:#428bca;border-color:#428bca}.list-group-item.active .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>.small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:hover .list-group-item-text,.list-group-item.active:focus .list-group-item-text{color:#e1edf7}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:hover,a.list-group-item-success:focus{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:hover,a.list-group-item-success.active:focus{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:hover,a.list-group-item-info:focus{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:hover,a.list-group-item-info.active:focus{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:hover,a.list-group-item-warning:focus{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:hover,a.list-group-item-warning.active:focus{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:hover,a.list-group-item-danger:focus{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:hover,a.list-group-item-danger.active:focus{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group{margin-bottom:0}.panel>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.table,.panel>.table-responsive>.table,.panel>.panel-collapse>.table{margin-bottom:0}.panel>.table:first-child,.panel>.table-responsive:first-child>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table:last-child,.panel>.table-responsive:last-child>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child th,.panel>.table>tbody:first-child>tr:first-child td{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#428bca}.panel-primary>.panel-heading{color:#fff;background-color:#428bca;border-color:#428bca}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#428bca}.panel-primary>.panel-heading .badge{color:#428bca;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#428bca}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive iframe,.embed-responsive embed,.embed-responsive object{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate3d(0,-25%,0);-o-transform:translate3d(0,-25%,0);transform:translate3d(0,-25%,0)}.modal.in .modal-dialog{-webkit-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{min-height:16.43px;padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-size:12px;line-height:1.4;visibility:visible;filter:alpha(opacity=0);opacity:0}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{bottom:0;left:5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{right:5px;bottom:0;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;left:5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;right:5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;text-align:left;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;font-weight:400;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img,.carousel-inner>.item>a>img{line-height:1}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:hover,.carousel-control:focus{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .icon-prev,.carousel-control .icon-next,.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .icon-prev,.carousel-control .glyphicon-chevron-left{left:50%;margin-left:-10px}.carousel-control .icon-next,.carousel-control .glyphicon-chevron-right{right:50%;margin-right:-10px}.carousel-control .icon-prev,.carousel-control .icon-next{width:20px;height:20px;margin-top:-10px;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-prev,.carousel-control .icon-next{width:30px;height:30px;margin-top:-15px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-15px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-15px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:before,.clearfix:after,.dl-horizontal dd:before,.dl-horizontal dd:after,.container:before,.container:after,.container-fluid:before,.container-fluid:after,.row:before,.row:after,.form-horizontal .form-group:before,.form-horizontal .form-group:after,.btn-toolbar:before,.btn-toolbar:after,.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after,.nav:before,.nav:after,.navbar:before,.navbar:after,.navbar-header:before,.navbar-header:after,.navbar-collapse:before,.navbar-collapse:after,.pager:before,.pager:after,.panel-body:before,.panel-body:after,.modal-footer:before,.modal-footer:after{display:table;content:" "}.clearfix:after,.dl-horizontal dd:after,.container:after,.container-fluid:after,.row:after,.form-horizontal .form-group:after,.btn-toolbar:after,.btn-group-vertical>.btn-group:after,.nav:after,.navbar:after,.navbar-header:after,.navbar-collapse:after,.pager:after,.panel-body:after,.modal-footer:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important;visibility:hidden!important}.affix{position:fixed;-webkit-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}@-ms-viewport{width:device-width}.visible-xs,.visible-sm,.visible-md,.visible-lg{display:none!important}.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table}tr.visible-xs{display:table-row!important}th.visible-xs,td.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table}tr.visible-sm{display:table-row!important}th.visible-sm,td.visible-sm{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table}tr.visible-md{display:table-row!important}th.visible-md,td.visible-md{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table}tr.visible-lg{display:table-row!important}th.visible-lg,td.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table}tr.visible-print{display:table-row!important}th.visible-print,td.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}} | |
13 | </style> | |
14 | ||
15 | <meta content="Mnemonic code for generating deterministic keys" name="description"/> | |
16 | <meta content="width=device-width, initial-scale=1.0" name="viewport" /> | |
17 | <meta content="bitcoin mnemonic converter" name="description" /> | |
18 | <meta content="DC POS" name="author" /> | |
19 | ||
20 | <style> | |
212b1b46 IC |
21 | body { |
22 | padding-bottom: 32px; | |
23 | } | |
ebd8d4e8 IC |
24 | .feedback-container { |
25 | position: fixed; | |
26 | top: 0; | |
27 | width: 100%; | |
28 | text-align: center; | |
29 | z-index: 4; | |
30 | } | |
31 | .feedback { | |
32 | display: table; | |
33 | padding: 0.5em 1em; | |
34 | background-color: orange; | |
35 | margin: 0 auto; | |
36 | font-size: 2em; | |
37 | color: #444; | |
38 | border: 2px solid #555; | |
39 | border-top: 0; | |
40 | border-bottom-left-radius: 20px 20px; | |
41 | border-bottom-right-radius: 20px 20px; | |
42 | } | |
43 | </style> | |
44 | </head> | |
45 | <body> | |
46 | <div class="container"> | |
47 | ||
48 | <h1 class="text-center">Mnemonic Code Converter</h1> | |
49 | <hr> | |
50 | <div class="row"> | |
51 | <div class="col-md-12"> | |
52 | <h2>Phrase</h2> | |
53 | <form class="form-horizontal" role="form"> | |
54 | <div class="col-sm-2"></div> | |
55 | <div class="col-sm-10"> | |
d922d691 | 56 | <p>You can enter an existing BIP39 phrase, or generate a new random one. Typing your own twelve words will probably not work how you expect, since the words require a particular structure (the last word is a checksum)</p> |
ebd8d4e8 IC |
57 | <p>For more info see the <a href="https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki" target="_blank">BIP39 spec</a></p> |
58 | </div> | |
59 | <div class="form-group"> | |
60 | <label for="phrase" class="col-sm-2 control-label">BIP39 Phrase</label> | |
61 | <div class="col-sm-10"> | |
62 | <textarea id="phrase" class="phrase form-control"></textarea> | |
63 | </div> | |
64 | </div> | |
65 | <div class="form-group"> | |
66 | <label for="strength" class="col-sm-2 control-label">Number of words</label> | |
67 | <div class="col-sm-10"> | |
68 | <div class="input-group"> | |
69 | <input type="number" class="strength form-control" id="strength" value="12"> | |
70 | <span class="input-group-btn"> | |
71 | <button class="btn generate">Generate Random Phrase</button> | |
72 | </span> | |
73 | </div> | |
74 | </div> | |
75 | </div> | |
721b7284 IC |
76 | <div class="form-group"> |
77 | <label for="passphrase" class="col-sm-2 control-label">BIP39 Passphrase (optional)</label> | |
78 | <div class="col-sm-10"> | |
79 | <textarea id="passphrase" class="passphrase form-control"></textarea> | |
80 | </div> | |
81 | </div> | |
ebd8d4e8 IC |
82 | <div class="form-group"> |
83 | <label for="root-key" class="col-sm-2 control-label">BIP32 Root Key</label> | |
84 | <div class="col-sm-10"> | |
85 | <textarea id="root-key" class="root-key form-control" disabled="disabled"></textarea> | |
86 | </div> | |
87 | </div> | |
88 | </form> | |
89 | </div> | |
90 | </div> | |
91 | ||
92 | <hr> | |
93 | ||
94 | <div class="row"> | |
95 | <div class="col-md-12"> | |
96 | <h2>Derivation Path</h2> | |
97 | <ul class="derivation-type nav nav-tabs" role="tablist"> | |
98 | <li class="active"> | |
99 | <a href="#bip44" role="tab" data-toggle="tab">BIP44</a></li> | |
100 | <li><a href="#bip32" role="tab" data-toggle="tab">BIP32</a></li> | |
101 | </ul> | |
102 | <div class="derivation-type tab-content"> | |
103 | <div id="bip44" class="tab-pane active"> | |
104 | <form class="form-horizontal" role="form"> | |
105 | <br> | |
106 | <div class="col-sm-2"></div> | |
107 | <div class="col-sm-10"> | |
108 | <p>For more info see the <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki" target="_blank">BIP44 spec</a></p> | |
109 | </div> | |
110 | <div class="form-group"> | |
111 | <label for="purpose" class="col-sm-2 control-label"> | |
112 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#purpose" target="_blank">Purpose</a> | |
113 | </label> | |
114 | <div class="col-sm-10"> | |
115 | <input id="purpose" type="text" class="purpose form-control" value="44"> | |
116 | </div> | |
117 | </div> | |
118 | <div class="form-group"> | |
119 | <label for="coin" class="col-sm-2 control-label"> | |
120 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#registered-coin-types" target="_blank">Coin</a> | |
121 | </label> | |
122 | <div class="col-sm-10"> | |
123 | <input id="coin" type="text" class="coin form-control" value="0"> | |
124 | </div> | |
125 | </div> | |
126 | <div class="form-group"> | |
127 | <label for="account" class="col-sm-2 control-label"> | |
128 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#account" target="_blank">Account</a> | |
129 | </label> | |
130 | <div class="col-sm-10"> | |
131 | <input id="account" type="text" class="account form-control" value="0"> | |
132 | </div> | |
133 | </div> | |
134 | <div class="form-group"> | |
135 | <label for="change" class="col-sm-2 control-label"> | |
136 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#change" target="_blank">External / Internal</a> | |
137 | </label> | |
138 | <div class="col-sm-10"> | |
139 | <input id="change" type="text" class="change form-control" value="0"> | |
140 | </div> | |
141 | </div> | |
142 | <div class="form-group"> | |
143 | <label for="bip44-path" class="col-sm-2 control-label">BIP32 Derivation Path</label> | |
144 | <div class="col-sm-10"> | |
145 | <input id="bip44-path" type="text" class="path form-control" value="m/44'/0'/0'/0" disabled="disabled"> | |
146 | </div> | |
147 | </div> | |
148 | </form> | |
149 | </div> | |
150 | <div id="bip32" class="tab-pane"> | |
151 | <form class="form-horizontal" role="form"> | |
152 | <br> | |
153 | <div class="col-sm-2"></div> | |
154 | <div class="col-sm-10"> | |
155 | <p>For more info see the <a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki" target="_blank">BIP32 spec</a></p> | |
156 | </div> | |
157 | <div class="form-group"> | |
158 | <label for="bip32-path" class="col-sm-2 control-label">BIP32 Derivation Path</label> | |
159 | <div class="col-sm-10"> | |
160 | <input id="bip32-path" type="text" class="path form-control" value="m/0"> | |
161 | </div> | |
162 | </div> | |
163 | </form> | |
164 | </div> | |
165 | </div> | |
166 | <form class="form-horizontal" role="form"> | |
167 | <div class="form-group"> | |
168 | <label for="extended-priv-key" class="col-sm-2 control-label">BIP32 Extended Key</label> | |
169 | <div class="col-sm-10"> | |
170 | <textarea id="extended-priv-key" class="extended-priv-key form-control" disabled="disabled"></textarea> | |
171 | </div> | |
172 | </div> | |
173 | <div class="form-group"> | |
174 | <label for="extended-pub-key" class="col-sm-2 control-label">BIP32 Extended Key (addresses only)</label> | |
175 | <div class="col-sm-10"> | |
176 | <textarea id="extended-pub-key" class="extended-pub-key form-control" disabled="disabled"></textarea> | |
177 | </div> | |
178 | </div> | |
179 | </form> | |
180 | </div> | |
181 | </div> | |
182 | ||
183 | <hr> | |
184 | ||
185 | <div class="row"> | |
186 | <div class="col-md-12"> | |
187 | <h2>Derived Addresses</h2> | |
188 | <p>Note these addreses are derived from the <strong>BIP32 Extended Key</strong></p> | |
189 | <table class="table table-striped"> | |
190 | <thead> | |
191 | <th> | |
192 | <div class="input-group"> | |
193 | Index | |
194 | <button class="index-toggle">Toggle</button> | |
195 | </div> | |
196 | </th> | |
197 | <th> | |
198 | <div class="input-group"> | |
199 | Address | |
200 | <button class="address-toggle">Toggle</button> | |
201 | </div> | |
202 | </th> | |
203 | <th> | |
204 | <div class="input-group"> | |
205 | Private Key | |
206 | <button class="private-key-toggle">Toggle</button> | |
207 | </div> | |
208 | </th> | |
209 | </thead> | |
210 | <tbody class="addresses"> | |
211 | <tr><td> </td><td> </td><td> </td></tr> | |
212 | <tr><td> </td><td> </td><td> </td></tr> | |
213 | <tr><td> </td><td> </td><td> </td></tr> | |
214 | <tr><td> </td><td> </td><td> </td></tr> | |
215 | <tr><td> </td><td> </td><td> </td></tr> | |
216 | </tbody> | |
217 | </table> | |
218 | </div> | |
219 | </div> | |
220 | <span>Show next </button> | |
221 | <input type="number" class="rows-to-add" value="20"> | |
222 | <button class="more">Show</button> | |
223 | ||
224 | <hr> | |
225 | ||
226 | <div class="row"> | |
227 | <div class="col-md-12"> | |
228 | <h2>More info</h2> | |
229 | <h3>BIP39 <span class="small">Mnemonic code for generating deterministic keys</span></h3> | |
230 | <p> | |
231 | Read more at the | |
232 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki">official BIP39 spec</a> | |
233 | </p> | |
234 | <h3>BIP32 <span class="small">Hierarchical Deterministic Wallets</span></h3> | |
235 | <p> | |
236 | Read more at the | |
237 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki" target="_blank">official BIP32 spec</a> | |
238 | and see the demo at | |
239 | <a href="http://bip32.org/" target="_blank">bip32.org</a> | |
240 | </p> | |
241 | <h3>BIP44 <span class="small">Multi-Account Hierarchy for Deterministic Wallets</span></h3> | |
242 | <p> | |
243 | Read more at the | |
244 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki" target="_blank">official BIP44 spec</a> | |
245 | </p> | |
246 | <h3>Private Keys</h3> | |
247 | <p> | |
248 | Use private keys at | |
249 | <a href="https://brainwallet.github.io/" target="_blank">brainwallet.org</a>, | |
250 | but be careful - it can be easy to make mistakes if you | |
251 | don't know what you're doing | |
252 | </p> | |
253 | </div> | |
254 | </div> | |
212b1b46 IC |
255 | |
256 | <hr> | |
257 | ||
258 | <div class="row"> | |
259 | <div class="col-md-12"> | |
260 | <h2>Derived Addresses</h2> | |
261 | <p>Note these addreses are derived from the <strong>BIP32 Extended Key</strong></p> | |
262 | <table class="table table-striped"> | |
263 | <thead> | |
264 | <th> | |
265 | <div class="input-group"> | |
266 | Index | |
267 | <button class="index-toggle">Toggle</button> | |
268 | </div> | |
269 | </th> | |
270 | <th> | |
271 | <div class="input-group"> | |
272 | Address | |
273 | <button class="address-toggle">Toggle</button> | |
274 | </div> | |
275 | </th> | |
276 | <th> | |
277 | <div class="input-group"> | |
278 | Private Key | |
279 | <button class="private-key-toggle">Toggle</button> | |
280 | </div> | |
281 | </th> | |
282 | </thead> | |
283 | <tbody class="addresses"> | |
284 | <tr><td> </td><td> </td><td> </td></tr> | |
285 | <tr><td> </td><td> </td><td> </td></tr> | |
286 | <tr><td> </td><td> </td><td> </td></tr> | |
287 | <tr><td> </td><td> </td><td> </td></tr> | |
288 | <tr><td> </td><td> </td><td> </td></tr> | |
289 | </tbody> | |
290 | </table> | |
291 | </div> | |
292 | </div> | |
293 | <span>Show next </button> | |
294 | <input type="number" class="rows-to-add" value="20"> | |
295 | <button class="more">Show</button> | |
296 | ||
297 | <hr> | |
298 | ||
299 | <div class="row"> | |
300 | <div class="col-md-12"> | |
301 | <h2>More info</h2> | |
302 | <h3>BIP39 <span class="small">Mnemonic code for generating deterministic keys</span></h3> | |
303 | <p> | |
304 | Read more at the | |
305 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki">official BIP39 spec</a> | |
306 | </p> | |
307 | <h3>BIP32 <span class="small">Hierarchical Deterministic Wallets</span></h3> | |
308 | <p> | |
309 | Read more at the | |
310 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki" target="_blank">official BIP32 spec</a> | |
311 | and see the demo at | |
312 | <a href="http://bip32.org/" target="_blank">bip32.org</a> | |
313 | </p> | |
314 | <h3>BIP44 <span class="small">Multi-Account Hierarchy for Deterministic Wallets</span></h3> | |
315 | <p> | |
316 | Read more at the | |
317 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki" target="_blank">official BIP44 spec</a> | |
318 | </p> | |
319 | <h3>Private Keys</h3> | |
320 | <p> | |
321 | Use private keys at | |
322 | <a href="https://brainwallet.github.io/" target="_blank">brainwallet.org</a>, | |
323 | but be careful - it can be easy to make mistakes if you | |
324 | don't know what you're doing | |
325 | </p> | |
326 | </div> | |
327 | </div> | |
328 | ||
329 | <hr> | |
330 | ||
331 | <div class="row"> | |
332 | <div class="col-md-12"> | |
333 | ||
334 | <h2>Offline Usage</h2> | |
335 | ||
336 | <p> | |
337 | You can use this tool without having to be online. | |
338 | </p> | |
339 | <p> | |
340 | In your browser, select file save-as, and save this page | |
341 | as a file. | |
342 | </p> | |
343 | <p> | |
344 | Double-click that file to open it in a browser | |
345 | on any offline computer. | |
346 | </p> | |
347 | <p> | |
348 | Alternatively, download it from | |
349 | <a href="https://github.com/dcpos/bip39"> | |
350 | https://github.com/dcpos/bip39 | |
351 | </a> | |
352 | ||
353 | </div> | |
354 | </div> | |
355 | ||
356 | <hr> | |
357 | ||
358 | <div class="row"> | |
359 | <div class="col-md-12"> | |
360 | ||
361 | <h2>This project is 100% open-source code</h2> | |
362 | ||
363 | <p> | |
364 | <span>Get the source code at - </span> | |
365 | <a href="https://github.com/dcpos/bip39" target="_blank"> | |
366 | https://github.com/dcpos/bip39 | |
367 | </a> | |
368 | </p> | |
369 | ||
370 | <h3>Libraries</h3> | |
371 | ||
372 | <p> | |
373 | <span>BitcoinJS - </span> | |
374 | <a href="https://github.com/bitcoinjs/bitcoinjs-lib" target="_blank"> | |
375 | https://github.com/bitcoinjs/bitcoinjs-lib | |
376 | </a> | |
377 | </p> | |
378 | ||
379 | <p> | |
380 | <span>jsBIP39 - </span> | |
381 | <a href="https://github.com/iancoleman/jsbip39" target="_blank"> | |
382 | https://github.com/iancoleman/jsbip39 | |
383 | </a> | |
384 | </p> | |
385 | ||
386 | <p> | |
387 | <span>asmCrypto - </span> | |
388 | <a href="https://github.com/vibornoff/asmcrypto.js" target="_blank"> | |
389 | https://github.com/vibornoff/asmcrypto.js | |
390 | </a> | |
391 | </p> | |
392 | ||
393 | <p> | |
394 | <span>jQuery - </span> | |
395 | <a href="https://jquery.com/" target="_blank"> | |
396 | https://jquery.com/ | |
397 | </a> | |
398 | </p> | |
399 | ||
400 | <p> | |
401 | <span>Twitter Bootstrap - </span> | |
402 | <a href="http://getbootstrap.com/" target="_blank"> | |
403 | http://getbootstrap.com/ | |
404 | </a> | |
405 | </p> | |
406 | ||
407 | </div> | |
408 | </div> | |
409 | ||
ebd8d4e8 IC |
410 | </div> |
411 | ||
412 | <div class="feedback-container"> | |
413 | <div class="feedback"></div> | |
414 | </div> | |
415 | ||
416 | <script type="text/template" id="address-row-template"> | |
417 | <tr> | |
418 | <td class="index"><span></span></td> | |
419 | <td class="address"><span></span></td> | |
420 | <td class="privkey"><span></span></td> | |
421 | </tr> | |
422 | </script> | |
423 | ||
424 | <!--<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>--> | |
425 | <script> | |
426 | /*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ | |
427 | !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b) | |
428 | },_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=l.createDocumentFragment(),b=a.appendChild(l.createElement("div")),c=l.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||l,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=l),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?Z:$):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=Z,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return n().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=$),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var ab=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ib={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qb[0].contentDocument,b.write(),b.close(),c=sb(a,b),qb.detach()),rb[a]=c),c}var ub=/^margin/,vb=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)};function xb(a,b,c){var d,e,f,g,h=a.style;return c=c||wb(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),vb.test(g)&&ub.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function yb(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),b}})}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var zb=/^(none|table(?!-c[ea]).+)/,Ab=new RegExp("^("+Q+")(.*)$","i"),Bb=new RegExp("^([+-])=("+Q+")","i"),Cb={position:"absolute",visibility:"hidden",display:"block"},Db={letterSpacing:"0",fontWeight:"400"},Eb=["Webkit","O","Moz","ms"];function Fb(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Eb.length;while(e--)if(b=Eb[e]+c,b in a)return b;return d}function Gb(a,b,c){var d=Ab.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Hb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ib(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wb(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xb(a,b,f),(0>e||null==e)&&(e=a.style[b]),vb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Hb(a,b,c||(g?"border":"content"),d,f)+"px"}function Jb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",tb(d.nodeName)))):(e=S(d),"none"===c&&e||L.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Fb(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Bb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Fb(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xb(a,b,d)),"normal"===e&&b in Db&&(e=Db[b]),""===c||c?(f=parseFloat(e),c===!0||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?zb.test(n.css(a,"display"))&&0===a.offsetWidth?n.swap(a,Cb,function(){return Ib(a,b,d)}):Ib(a,b,d):void 0},set:function(a,c,d){var e=d&&wb(a);return Gb(a,c,d?Hb(a,b,d,"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=yb(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ub.test(a)||(n.cssHooks[a+b].set=Gb)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Jb(this,!0)},hide:function(){return Jb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}});function Kb(a,b,c,d,e){return new Kb.prototype.init(a,b,c,d,e)}n.Tween=Kb,Kb.prototype={constructor:Kb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Kb.propHooks[this.prop];return a&&a.get?a.get(this):Kb.propHooks._default.get(this)},run:function(a){var b,c=Kb.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Kb.propHooks._default.set(this),this}},Kb.prototype.init.prototype=Kb.prototype,Kb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Kb.propHooks.scrollTop=Kb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=Kb.prototype.init,n.fx.step={};var Lb,Mb,Nb=/^(?:toggle|show|hide)$/,Ob=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pb=/queueHooks$/,Qb=[Vb],Rb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Ob.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Ob.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sb(){return setTimeout(function(){Lb=void 0}),Lb=n.now()}function Tb(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ub(a,b,c){for(var d,e=(Rb[b]||[]).concat(Rb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Vb(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?L.get(a,"olddisplay")||tb(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Nb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?tb(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ub(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wb(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xb(a,b,c){var d,e,f=0,g=Qb.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Lb||Sb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Lb||Sb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wb(k,j.opts.specialEasing);g>f;f++)if(d=Qb[f].call(j,a,k,j.opts))return d;return n.map(k,Ub,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(Xb,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Rb[c]=Rb[c]||[],Rb[c].unshift(b)},prefilter:function(a,b){b?Qb.unshift(a):Qb.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=Xb(this,n.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Tb(b,!0),a,d,e)}}),n.each({slideDown:Tb("show"),slideUp:Tb("hide"),slideToggle:Tb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Lb=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Lb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Mb||(Mb=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Mb),Mb=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=l.createElement("input"),b=l.createElement("select"),c=b.appendChild(l.createElement("option"));a.type="checkbox",k.checkOn=""!==a.value,k.optSelected=c.selected,b.disabled=!0,k.optDisabled=!c.disabled,a=l.createElement("input"),a.value="t",a.type="radio",k.radioValue="t"===a.value}();var Yb,Zb,$b=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Zb:Yb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b)) | |
429 | },removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Zb={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$b[b]||n.find.attr;$b[b]=function(a,b,d){var e,f;return d||(f=$b[b],$b[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$b[b]=f),e}});var _b=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_b.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ac," ").indexOf(b)>=0)return!0;return!1}});var bc=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bc,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cc=n.now(),dc=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+a),b};var ec,fc,gc=/#.*$/,hc=/([?&])_=[^&]*/,ic=/^(.*?):[ \t]*([^\r\n]*)$/gm,jc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,kc=/^(?:GET|HEAD)$/,lc=/^\/\//,mc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,nc={},oc={},pc="*/".concat("*");try{fc=location.href}catch(qc){fc=l.createElement("a"),fc.href="",fc=fc.href}ec=mc.exec(fc.toLowerCase())||[];function rc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function sc(a,b,c,d){var e={},f=a===oc;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function tc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function uc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function vc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:fc,type:"GET",isLocal:jc.test(ec[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":pc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?tc(tc(a,n.ajaxSettings),b):tc(n.ajaxSettings,a)},ajaxPrefilter:rc(nc),ajaxTransport:rc(oc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=ic.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||fc)+"").replace(gc,"").replace(lc,ec[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=mc.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===ec[1]&&h[2]===ec[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(ec[3]||("http:"===ec[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),sc(nc,k,b,v),2===t)return v;i=k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!kc.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(dc.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=hc.test(d)?d.replace(hc,"$1_="+cc++):d+(dc.test(d)?"&":"?")+"_="+cc++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+pc+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=sc(oc,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=uc(k,v,f)),u=vc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var wc=/%20/g,xc=/\[\]$/,yc=/\r?\n/g,zc=/^(?:submit|button|image|reset|file)$/i,Ac=/^(?:input|select|textarea|keygen)/i;function Bc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||xc.test(a)?d(a,e):Bc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Bc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Bc(c,a[c],b,e);return d.join("&").replace(wc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Ac.test(this.nodeName)&&!zc.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(yc,"\r\n")}}):{name:b.name,value:c.replace(yc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Cc=0,Dc={},Ec={0:200,1223:204},Fc=n.ajaxSettings.xhr();a.ActiveXObject&&n(a).on("unload",function(){for(var a in Dc)Dc[a]()}),k.cors=!!Fc&&"withCredentials"in Fc,k.ajax=Fc=!!Fc,n.ajaxTransport(function(a){var b;return k.cors||Fc&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Cc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Dc[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Ec[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Dc[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=n("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),l.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Gc=[],Hc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Gc.pop()||n.expando+"_"+cc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Hc.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Hc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Hc,"$1"+e):b.jsonp!==!1&&(b.url+=(dc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Gc.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||l;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var Ic=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Ic)return Ic.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var Jc=a.document.documentElement;function Kc(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Kc(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Jc;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Jc})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Kc(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=yb(k.pixelPosition,function(a,c){return c?(c=xb(a,b),vb.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Lc=a.jQuery,Mc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Mc),b&&a.jQuery===n&&(a.jQuery=Lc),n},typeof b===U&&(a.jQuery=a.$=n),n}); | |
430 | </script> | |
431 | ||
432 | <!--<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>--> | |
433 | <script> | |
434 | /*! | |
435 | * Bootstrap v3.2.0 (http://getbootstrap.com) | |
436 | * Copyright 2011-2014 Twitter, Inc. | |
437 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) | |
438 | */ | |
439 | if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.2.0",d.prototype.close=function(b){function c(){f.detach().trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",c).emulateTransitionEnd(150):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.2.0",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),d[e](null==f[b]?this.options[b]:f[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b).on("keydown.bs.carousel",a.proxy(this.keydown,this)),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.2.0",c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},c.prototype.keydown=function(a){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.to=function(b){var c=this,d=this.getItemIndex(this.$active=this.$element.find(".item.active"));return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=e[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:g});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,f&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(e)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:g});return a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one("bsTransitionEnd",function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger(m)),f&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b);!e&&f.toggle&&"show"==b&&(b=!b),e||d.data("bs.collapse",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};c.VERSION="3.2.0",c.DEFAULTS={toggle:!0},c.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},c.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var c=a.Event("show.bs.collapse");if(this.$element.trigger(c),!c.isDefaultPrevented()){var d=this.$parent&&this.$parent.find("> .panel > .in");if(d&&d.length){var e=d.data("bs.collapse");if(e&&e.transitioning)return;b.call(d,"hide"),e||d.data("bs.collapse",null)}var f=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[f](0),this.transitioning=1;var g=function(){this.$element.removeClass("collapsing").addClass("collapse in")[f](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return g.call(this);var h=a.camelCase(["scroll",f].join("-"));this.$element.one("bsTransitionEnd",a.proxy(g,this)).emulateTransitionEnd(350)[f](this.$element[0][h])}}},c.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},c.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var d=a.fn.collapse;a.fn.collapse=b,a.fn.collapse.Constructor=c,a.fn.collapse.noConflict=function(){return a.fn.collapse=d,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(c){var d,e=a(this),f=e.attr("data-target")||c.preventDefault()||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),g=a(f),h=g.data("bs.collapse"),i=h?"toggle":e.data(),j=e.attr("data-parent"),k=j&&a(j);h&&h.transitioning||(k&&k.find('[data-toggle="collapse"][data-parent="'+j+'"]').not(e).addClass("collapsed"),e[g.hasClass("in")?"addClass":"removeClass"]("collapsed")),b.call(g,i)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.2.0",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var e=c(d),g=e.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.divider):visible a",i=e.find('[role="menu"]'+h+', [role="listbox"]'+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f+', [role="menu"], [role="listbox"]',g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$backdrop=this.isShown=null,this.scrollbarWidth=0,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.2.0",c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.$body.addClass("modal-open"),this.setScrollbar(),this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(c.$body),c.$element.show().scrollTop(0),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one("bsTransitionEnd",function(){c.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(300):c.$element.trigger("focus").trigger(e)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.$body.removeClass("modal-open"),this.resetScrollbar(),this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;if(this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;e?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(150):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var f=function(){c.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",f).emulateTransitionEnd(150):f()}else b&&b()},c.prototype.checkScrollbar=function(){document.body.clientWidth>=window.innerWidth||(this.scrollbarWidth=this.scrollbarWidth||this.measureScrollbar())},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.scrollbarWidth&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right","")},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};c.VERSION="3.2.0",c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var c=a.contains(document.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!c)return;var d=this,e=this.tip(),f=this.getUID(this.type);this.setContent(),e.attr("id",f),this.$element.attr("aria-describedby",f),this.options.animation&&e.addClass("fade");var g="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,h=/\s?auto?\s?/i,i=h.test(g);i&&(g=g.replace(h,"")||"top"),e.detach().css({top:0,left:0,display:"block"}).addClass(g).data("bs."+this.type,this),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element);var j=this.getPosition(),k=e[0].offsetWidth,l=e[0].offsetHeight;if(i){var m=g,n=this.$element.parent(),o=this.getPosition(n);g="bottom"==g&&j.top+j.height+l-o.scroll>o.height?"top":"top"==g&&j.top-o.scroll-l<0?"bottom":"right"==g&&j.right+k>o.width?"left":"left"==g&&j.left-k<o.left?"right":g,e.removeClass(m).addClass(g)}var p=this.getCalculatedOffset(g,j,k,l);this.applyPlacement(p,g);var q=function(){d.$element.trigger("shown.bs."+d.type),d.hoverState=null};a.support.transition&&this.$tip.hasClass("fade")?e.one("bsTransitionEnd",q).emulateTransitionEnd(150):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top=b.top+g,b.left=b.left+h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=k.left?2*k.left-e+i:2*k.top-f+j,m=k.left?"left":"top",n=k.left?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(l,d[0][n],m)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(){function b(){"in"!=c.hoverState&&d.detach(),c.$element.trigger("hidden.bs."+c.type)}var c=this,d=this.tip(),e=a.Event("hide.bs."+this.type);return this.$element.removeAttr("aria-describedby"),this.$element.trigger(e),e.isDefaultPrevented()?void 0:(d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.one("bsTransitionEnd",b).emulateTransitionEnd(150):b(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName;return a.extend({},"function"==typeof c.getBoundingClientRect?c.getBoundingClientRect():null,{scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop(),width:d?a(window).width():b.outerWidth(),height:d?a(window).height():b.outerHeight()},d?{top:0,left:0}:b.offset())},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.width&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.2.0",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").empty()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},c.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){var e=a.proxy(this.process,this);this.$body=a("body"),this.$scrollElement=a(a(c).is("body")?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",e),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.2.0",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b="offset",c=0;a.isWindow(this.$scrollElement[0])||(b="position",c=this.$scrollElement.scrollTop()),this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight();var d=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+c,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){d.offsets.push(this[0]),d.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.2.0",c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.closest("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},c.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one("bsTransitionEnd",e).emulateTransitionEnd(150):e(),f.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(c){c.preventDefault(),b.call(a(this),"show")})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.2.0",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=a(document).height(),d=this.$target.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=b-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){null!=this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:b-this.$element.height()-h}))}}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},d.offsetBottom&&(d.offset.bottom=d.offsetBottom),d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery); | |
440 | </script> | |
441 | ||
442 | <!--<script src="/js/bitcoinjs-1-0-0.js"></script>--> | |
443 | <script> | |
444 | (function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Bitcoin=e()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | |
445 | var assert = _dereq_('assert') | |
446 | ||
447 | module.exports = BigInteger | |
448 | ||
449 | // JavaScript engine analysis | |
450 | var canary = 0xdeadbeefcafe; | |
451 | var j_lm = ((canary&0xffffff)==0xefcafe); | |
452 | ||
453 | // (public) Constructor | |
454 | function BigInteger(a,b,c) { | |
455 | if (!(this instanceof BigInteger)) { | |
456 | return new BigInteger(a, b, c); | |
457 | } | |
458 | ||
459 | if(a != null) { | |
460 | if("number" == typeof a) this.fromNumber(a,b,c); | |
461 | else if(b == null && "string" != typeof a) this.fromString(a,256); | |
462 | else this.fromString(a,b); | |
463 | } | |
464 | } | |
465 | ||
466 | var proto = BigInteger.prototype; | |
467 | ||
468 | // return new, unset BigInteger | |
469 | function nbi() { return new BigInteger(null); } | |
470 | ||
471 | // Bits per digit | |
472 | var dbits; | |
473 | ||
474 | // am: Compute w_j += (x*this_i), propagate carries, | |
475 | // c is initial carry, returns final carry. | |
476 | // c < 3*dvalue, x < 2*dvalue, this_i < dvalue | |
477 | // We need to select the fastest one that works in this environment. | |
478 | ||
479 | // am1: use a single mult and divide to get the high bits, | |
480 | // max digit bits should be 26 because | |
481 | // max internal value = 2*dvalue^2-2*dvalue (< 2^53) | |
482 | function am1(i,x,w,j,c,n) { | |
483 | while(--n >= 0) { | |
484 | var v = x*this[i++]+w[j]+c; | |
485 | c = Math.floor(v/0x4000000); | |
486 | w[j++] = v&0x3ffffff; | |
487 | } | |
488 | return c; | |
489 | } | |
490 | // am2 avoids a big mult-and-extract completely. | |
491 | // Max digit bits should be <= 30 because we do bitwise ops | |
492 | // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) | |
493 | function am2(i,x,w,j,c,n) { | |
494 | var xl = x&0x7fff, xh = x>>15; | |
495 | while(--n >= 0) { | |
496 | var l = this[i]&0x7fff; | |
497 | var h = this[i++]>>15; | |
498 | var m = xh*l+h*xl; | |
499 | l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff); | |
500 | c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); | |
501 | w[j++] = l&0x3fffffff; | |
502 | } | |
503 | return c; | |
504 | } | |
505 | // Alternately, set max digit bits to 28 since some | |
506 | // browsers slow down when dealing with 32-bit numbers. | |
507 | function am3(i,x,w,j,c,n) { | |
508 | var xl = x&0x3fff, xh = x>>14; | |
509 | while(--n >= 0) { | |
510 | var l = this[i]&0x3fff; | |
511 | var h = this[i++]>>14; | |
512 | var m = xh*l+h*xl; | |
513 | l = xl*l+((m&0x3fff)<<14)+w[j]+c; | |
514 | c = (l>>28)+(m>>14)+xh*h; | |
515 | w[j++] = l&0xfffffff; | |
516 | } | |
517 | return c; | |
518 | } | |
519 | ||
520 | // wtf? | |
521 | BigInteger.prototype.am = am1; | |
522 | dbits = 26; | |
523 | ||
524 | /* | |
525 | if(j_lm && (navigator.appName == "Microsoft Internet Explorer")) { | |
526 | BigInteger.prototype.am = am2; | |
527 | dbits = 30; | |
528 | } | |
529 | else if(j_lm && (navigator.appName != "Netscape")) { | |
530 | BigInteger.prototype.am = am1; | |
531 | dbits = 26; | |
532 | } | |
533 | else { // Mozilla/Netscape seems to prefer am3 | |
534 | BigInteger.prototype.am = am3; | |
535 | dbits = 28; | |
536 | } | |
537 | */ | |
538 | ||
539 | BigInteger.prototype.DB = dbits; | |
540 | BigInteger.prototype.DM = ((1<<dbits)-1); | |
541 | var DV = BigInteger.prototype.DV = (1<<dbits); | |
542 | ||
543 | var BI_FP = 52; | |
544 | BigInteger.prototype.FV = Math.pow(2,BI_FP); | |
545 | BigInteger.prototype.F1 = BI_FP-dbits; | |
546 | BigInteger.prototype.F2 = 2*dbits-BI_FP; | |
547 | ||
548 | // Digit conversions | |
549 | var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz"; | |
550 | var BI_RC = new Array(); | |
551 | var rr,vv; | |
552 | rr = "0".charCodeAt(0); | |
553 | for(vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv; | |
554 | rr = "a".charCodeAt(0); | |
555 | for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv; | |
556 | rr = "A".charCodeAt(0); | |
557 | for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv; | |
558 | ||
559 | function int2char(n) { return BI_RM.charAt(n); } | |
560 | function intAt(s,i) { | |
561 | var c = BI_RC[s.charCodeAt(i)]; | |
562 | return (c==null)?-1:c; | |
563 | } | |
564 | ||
565 | // (protected) copy this to r | |
566 | function bnpCopyTo(r) { | |
567 | for(var i = this.t-1; i >= 0; --i) r[i] = this[i]; | |
568 | r.t = this.t; | |
569 | r.s = this.s; | |
570 | } | |
571 | ||
572 | // (protected) set from integer value x, -DV <= x < DV | |
573 | function bnpFromInt(x) { | |
574 | this.t = 1; | |
575 | this.s = (x<0)?-1:0; | |
576 | if(x > 0) this[0] = x; | |
577 | else if(x < -1) this[0] = x+DV; | |
578 | else this.t = 0; | |
579 | } | |
580 | ||
581 | // return bigint initialized to value | |
582 | function nbv(i) { var r = nbi(); r.fromInt(i); return r; } | |
583 | ||
584 | // (protected) set from string and radix | |
585 | function bnpFromString(s,b) { | |
586 | var self = this; | |
587 | ||
588 | var k; | |
589 | if(b == 16) k = 4; | |
590 | else if(b == 8) k = 3; | |
591 | else if(b == 256) k = 8; // byte array | |
592 | else if(b == 2) k = 1; | |
593 | else if(b == 32) k = 5; | |
594 | else if(b == 4) k = 2; | |
595 | else { self.fromRadix(s,b); return; } | |
596 | self.t = 0; | |
597 | self.s = 0; | |
598 | var i = s.length, mi = false, sh = 0; | |
599 | while(--i >= 0) { | |
600 | var x = (k==8)?s[i]&0xff:intAt(s,i); | |
601 | if(x < 0) { | |
602 | if(s.charAt(i) == "-") mi = true; | |
603 | continue; | |
604 | } | |
605 | mi = false; | |
606 | if(sh == 0) | |
607 | self[self.t++] = x; | |
608 | else if(sh+k > self.DB) { | |
609 | self[self.t-1] |= (x&((1<<(self.DB-sh))-1))<<sh; | |
610 | self[self.t++] = (x>>(self.DB-sh)); | |
611 | } | |
612 | else | |
613 | self[self.t-1] |= x<<sh; | |
614 | sh += k; | |
615 | if(sh >= self.DB) sh -= self.DB; | |
616 | } | |
617 | if(k == 8 && (s[0]&0x80) != 0) { | |
618 | self.s = -1; | |
619 | if(sh > 0) self[self.t-1] |= ((1<<(self.DB-sh))-1)<<sh; | |
620 | } | |
621 | self.clamp(); | |
622 | if(mi) BigInteger.ZERO.subTo(self,self); | |
623 | } | |
624 | ||
625 | // (protected) clamp off excess high words | |
626 | function bnpClamp() { | |
627 | var c = this.s&this.DM; | |
628 | while(this.t > 0 && this[this.t-1] == c) --this.t; | |
629 | } | |
630 | ||
631 | // (public) return string representation in given radix | |
632 | function bnToString(b) { | |
633 | var self = this; | |
634 | if(self.s < 0) return "-"+self.negate().toString(b); | |
635 | var k; | |
636 | if(b == 16) k = 4; | |
637 | else if(b == 8) k = 3; | |
638 | else if(b == 2) k = 1; | |
639 | else if(b == 32) k = 5; | |
640 | else if(b == 4) k = 2; | |
641 | else return self.toRadix(b); | |
642 | var km = (1<<k)-1, d, m = false, r = "", i = self.t; | |
643 | var p = self.DB-(i*self.DB)%k; | |
644 | if(i-- > 0) { | |
645 | if(p < self.DB && (d = self[i]>>p) > 0) { m = true; r = int2char(d); } | |
646 | while(i >= 0) { | |
647 | if(p < k) { | |
648 | d = (self[i]&((1<<p)-1))<<(k-p); | |
649 | d |= self[--i]>>(p+=self.DB-k); | |
650 | } | |
651 | else { | |
652 | d = (self[i]>>(p-=k))&km; | |
653 | if(p <= 0) { p += self.DB; --i; } | |
654 | } | |
655 | if(d > 0) m = true; | |
656 | if(m) r += int2char(d); | |
657 | } | |
658 | } | |
659 | return m?r:"0"; | |
660 | } | |
661 | ||
662 | // (public) -this | |
663 | function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } | |
664 | ||
665 | // (public) |this| | |
666 | function bnAbs() { return (this.s<0)?this.negate():this; } | |
667 | ||
668 | // (public) return + if this > a, - if this < a, 0 if equal | |
669 | function bnCompareTo(a) { | |
670 | var r = this.s-a.s; | |
671 | if(r != 0) return r; | |
672 | var i = this.t; | |
673 | r = i-a.t; | |
674 | if(r != 0) return (this.s<0)?-r:r; | |
675 | while(--i >= 0) if((r=this[i]-a[i]) != 0) return r; | |
676 | return 0; | |
677 | } | |
678 | ||
679 | // returns bit length of the integer x | |
680 | function nbits(x) { | |
681 | var r = 1, t; | |
682 | if((t=x>>>16) != 0) { x = t; r += 16; } | |
683 | if((t=x>>8) != 0) { x = t; r += 8; } | |
684 | if((t=x>>4) != 0) { x = t; r += 4; } | |
685 | if((t=x>>2) != 0) { x = t; r += 2; } | |
686 | if((t=x>>1) != 0) { x = t; r += 1; } | |
687 | return r; | |
688 | } | |
689 | ||
690 | // (public) return the number of bits in "this" | |
691 | function bnBitLength() { | |
692 | if(this.t <= 0) return 0; | |
693 | return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM)); | |
694 | } | |
695 | ||
696 | // (protected) r = this << n*DB | |
697 | function bnpDLShiftTo(n,r) { | |
698 | var i; | |
699 | for(i = this.t-1; i >= 0; --i) r[i+n] = this[i]; | |
700 | for(i = n-1; i >= 0; --i) r[i] = 0; | |
701 | r.t = this.t+n; | |
702 | r.s = this.s; | |
703 | } | |
704 | ||
705 | // (protected) r = this >> n*DB | |
706 | function bnpDRShiftTo(n,r) { | |
707 | for(var i = n; i < this.t; ++i) r[i-n] = this[i]; | |
708 | r.t = Math.max(this.t-n,0); | |
709 | r.s = this.s; | |
710 | } | |
711 | ||
712 | // (protected) r = this << n | |
713 | function bnpLShiftTo(n,r) { | |
714 | var self = this; | |
715 | var bs = n%self.DB; | |
716 | var cbs = self.DB-bs; | |
717 | var bm = (1<<cbs)-1; | |
718 | var ds = Math.floor(n/self.DB), c = (self.s<<bs)&self.DM, i; | |
719 | for(i = self.t-1; i >= 0; --i) { | |
720 | r[i+ds+1] = (self[i]>>cbs)|c; | |
721 | c = (self[i]&bm)<<bs; | |
722 | } | |
723 | for(i = ds-1; i >= 0; --i) r[i] = 0; | |
724 | r[ds] = c; | |
725 | r.t = self.t+ds+1; | |
726 | r.s = self.s; | |
727 | r.clamp(); | |
728 | } | |
729 | ||
730 | // (protected) r = this >> n | |
731 | function bnpRShiftTo(n,r) { | |
732 | var self = this; | |
733 | r.s = self.s; | |
734 | var ds = Math.floor(n/self.DB); | |
735 | if(ds >= self.t) { r.t = 0; return; } | |
736 | var bs = n%self.DB; | |
737 | var cbs = self.DB-bs; | |
738 | var bm = (1<<bs)-1; | |
739 | r[0] = self[ds]>>bs; | |
740 | for(var i = ds+1; i < self.t; ++i) { | |
741 | r[i-ds-1] |= (self[i]&bm)<<cbs; | |
742 | r[i-ds] = self[i]>>bs; | |
743 | } | |
744 | if(bs > 0) r[self.t-ds-1] |= (self.s&bm)<<cbs; | |
745 | r.t = self.t-ds; | |
746 | r.clamp(); | |
747 | } | |
748 | ||
749 | // (protected) r = this - a | |
750 | function bnpSubTo(a,r) { | |
751 | var self = this; | |
752 | var i = 0, c = 0, m = Math.min(a.t,self.t); | |
753 | while(i < m) { | |
754 | c += self[i]-a[i]; | |
755 | r[i++] = c&self.DM; | |
756 | c >>= self.DB; | |
757 | } | |
758 | if(a.t < self.t) { | |
759 | c -= a.s; | |
760 | while(i < self.t) { | |
761 | c += self[i]; | |
762 | r[i++] = c&self.DM; | |
763 | c >>= self.DB; | |
764 | } | |
765 | c += self.s; | |
766 | } | |
767 | else { | |
768 | c += self.s; | |
769 | while(i < a.t) { | |
770 | c -= a[i]; | |
771 | r[i++] = c&self.DM; | |
772 | c >>= self.DB; | |
773 | } | |
774 | c -= a.s; | |
775 | } | |
776 | r.s = (c<0)?-1:0; | |
777 | if(c < -1) r[i++] = self.DV+c; | |
778 | else if(c > 0) r[i++] = c; | |
779 | r.t = i; | |
780 | r.clamp(); | |
781 | } | |
782 | ||
783 | // (protected) r = this * a, r != this,a (HAC 14.12) | |
784 | // "this" should be the larger one if appropriate. | |
785 | function bnpMultiplyTo(a,r) { | |
786 | var x = this.abs(), y = a.abs(); | |
787 | var i = x.t; | |
788 | r.t = i+y.t; | |
789 | while(--i >= 0) r[i] = 0; | |
790 | for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t); | |
791 | r.s = 0; | |
792 | r.clamp(); | |
793 | if(this.s != a.s) BigInteger.ZERO.subTo(r,r); | |
794 | } | |
795 | ||
796 | // (protected) r = this^2, r != this (HAC 14.16) | |
797 | function bnpSquareTo(r) { | |
798 | var x = this.abs(); | |
799 | var i = r.t = 2*x.t; | |
800 | while(--i >= 0) r[i] = 0; | |
801 | for(i = 0; i < x.t-1; ++i) { | |
802 | var c = x.am(i,x[i],r,2*i,0,1); | |
803 | if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) { | |
804 | r[i+x.t] -= x.DV; | |
805 | r[i+x.t+1] = 1; | |
806 | } | |
807 | } | |
808 | if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1); | |
809 | r.s = 0; | |
810 | r.clamp(); | |
811 | } | |
812 | ||
813 | // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) | |
814 | // r != q, this != m. q or r may be null. | |
815 | function bnpDivRemTo(m,q,r) { | |
816 | var self = this; | |
817 | var pm = m.abs(); | |
818 | if(pm.t <= 0) return; | |
819 | var pt = self.abs(); | |
820 | if(pt.t < pm.t) { | |
821 | if(q != null) q.fromInt(0); | |
822 | if(r != null) self.copyTo(r); | |
823 | return; | |
824 | } | |
825 | if(r == null) r = nbi(); | |
826 | var y = nbi(), ts = self.s, ms = m.s; | |
827 | var nsh = self.DB-nbits(pm[pm.t-1]); // normalize modulus | |
828 | if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } | |
829 | else { pm.copyTo(y); pt.copyTo(r); } | |
830 | var ys = y.t; | |
831 | var y0 = y[ys-1]; | |
832 | if(y0 == 0) return; | |
833 | var yt = y0*(1<<self.F1)+((ys>1)?y[ys-2]>>self.F2:0); | |
834 | var d1 = self.FV/yt, d2 = (1<<self.F1)/yt, e = 1<<self.F2; | |
835 | var i = r.t, j = i-ys, t = (q==null)?nbi():q; | |
836 | y.dlShiftTo(j,t); | |
837 | if(r.compareTo(t) >= 0) { | |
838 | r[r.t++] = 1; | |
839 | r.subTo(t,r); | |
840 | } | |
841 | BigInteger.ONE.dlShiftTo(ys,t); | |
842 | t.subTo(y,y); // "negative" y so we can replace sub with am later | |
843 | while(y.t < ys) y[y.t++] = 0; | |
844 | while(--j >= 0) { | |
845 | // Estimate quotient digit | |
846 | var qd = (r[--i]==y0)?self.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2); | |
847 | if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out | |
848 | y.dlShiftTo(j,t); | |
849 | r.subTo(t,r); | |
850 | while(r[i] < --qd) r.subTo(t,r); | |
851 | } | |
852 | } | |
853 | if(q != null) { | |
854 | r.drShiftTo(ys,q); | |
855 | if(ts != ms) BigInteger.ZERO.subTo(q,q); | |
856 | } | |
857 | r.t = ys; | |
858 | r.clamp(); | |
859 | if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder | |
860 | if(ts < 0) BigInteger.ZERO.subTo(r,r); | |
861 | } | |
862 | ||
863 | // (public) this mod a | |
864 | function bnMod(a) { | |
865 | var r = nbi(); | |
866 | this.abs().divRemTo(a,null,r); | |
867 | if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); | |
868 | return r; | |
869 | } | |
870 | ||
871 | // Modular reduction using "classic" algorithm | |
872 | function Classic(m) { this.m = m; } | |
873 | function cConvert(x) { | |
874 | if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); | |
875 | else return x; | |
876 | } | |
877 | function cRevert(x) { return x; } | |
878 | function cReduce(x) { x.divRemTo(this.m,null,x); } | |
879 | function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } | |
880 | function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } | |
881 | ||
882 | Classic.prototype.convert = cConvert; | |
883 | Classic.prototype.revert = cRevert; | |
884 | Classic.prototype.reduce = cReduce; | |
885 | Classic.prototype.mulTo = cMulTo; | |
886 | Classic.prototype.sqrTo = cSqrTo; | |
887 | ||
888 | // (protected) return "-1/this % 2^DB"; useful for Mont. reduction | |
889 | // justification: | |
890 | // xy == 1 (mod m) | |
891 | // xy = 1+km | |
892 | // xy(2-xy) = (1+km)(1-km) | |
893 | // x[y(2-xy)] = 1-k^2m^2 | |
894 | // x[y(2-xy)] == 1 (mod m^2) | |
895 | // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 | |
896 | // should reduce x and y(2-xy) by m^2 at each step to keep size bounded. | |
897 | // JS multiply "overflows" differently from C/C++, so care is needed here. | |
898 | function bnpInvDigit() { | |
899 | if(this.t < 1) return 0; | |
900 | var x = this[0]; | |
901 | if((x&1) == 0) return 0; | |
902 | var y = x&3; // y == 1/x mod 2^2 | |
903 | y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 | |
904 | y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 | |
905 | y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 | |
906 | // last step - calculate inverse mod DV directly; | |
907 | // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints | |
908 | y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits | |
909 | // we really want the negative inverse, and -DV < y < DV | |
910 | return (y>0)?this.DV-y:-y; | |
911 | } | |
912 | ||
913 | // Montgomery reduction | |
914 | function Montgomery(m) { | |
915 | this.m = m; | |
916 | this.mp = m.invDigit(); | |
917 | this.mpl = this.mp&0x7fff; | |
918 | this.mph = this.mp>>15; | |
919 | this.um = (1<<(m.DB-15))-1; | |
920 | this.mt2 = 2*m.t; | |
921 | } | |
922 | ||
923 | // xR mod m | |
924 | function montConvert(x) { | |
925 | var r = nbi(); | |
926 | x.abs().dlShiftTo(this.m.t,r); | |
927 | r.divRemTo(this.m,null,r); | |
928 | if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); | |
929 | return r; | |
930 | } | |
931 | ||
932 | // x/R mod m | |
933 | function montRevert(x) { | |
934 | var r = nbi(); | |
935 | x.copyTo(r); | |
936 | this.reduce(r); | |
937 | return r; | |
938 | } | |
939 | ||
940 | // x = x/R mod m (HAC 14.32) | |
941 | function montReduce(x) { | |
942 | while(x.t <= this.mt2) // pad x so am has enough room later | |
943 | x[x.t++] = 0; | |
944 | for(var i = 0; i < this.m.t; ++i) { | |
945 | // faster way of calculating u0 = x[i]*mp mod DV | |
946 | var j = x[i]&0x7fff; | |
947 | var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM; | |
948 | // use am to combine the multiply-shift-add into one call | |
949 | j = i+this.m.t; | |
950 | x[j] += this.m.am(0,u0,x,i,0,this.m.t); | |
951 | // propagate carry | |
952 | while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; } | |
953 | } | |
954 | x.clamp(); | |
955 | x.drShiftTo(this.m.t,x); | |
956 | if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); | |
957 | } | |
958 | ||
959 | // r = "x^2/R mod m"; x != r | |
960 | function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } | |
961 | ||
962 | // r = "xy/R mod m"; x,y != r | |
963 | function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } | |
964 | ||
965 | Montgomery.prototype.convert = montConvert; | |
966 | Montgomery.prototype.revert = montRevert; | |
967 | Montgomery.prototype.reduce = montReduce; | |
968 | Montgomery.prototype.mulTo = montMulTo; | |
969 | Montgomery.prototype.sqrTo = montSqrTo; | |
970 | ||
971 | // (protected) true iff this is even | |
972 | function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; } | |
973 | ||
974 | // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) | |
975 | function bnpExp(e,z) { | |
976 | if(e > 0xffffffff || e < 1) return BigInteger.ONE; | |
977 | var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; | |
978 | g.copyTo(r); | |
979 | while(--i >= 0) { | |
980 | z.sqrTo(r,r2); | |
981 | if((e&(1<<i)) > 0) z.mulTo(r2,g,r); | |
982 | else { var t = r; r = r2; r2 = t; } | |
983 | } | |
984 | return z.revert(r); | |
985 | } | |
986 | ||
987 | // (public) this^e % m, 0 <= e < 2^32 | |
988 | function bnModPowInt(e,m) { | |
989 | var z; | |
990 | if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); | |
991 | return this.exp(e,z); | |
992 | } | |
993 | ||
994 | // protected | |
995 | proto.copyTo = bnpCopyTo; | |
996 | proto.fromInt = bnpFromInt; | |
997 | proto.fromString = bnpFromString; | |
998 | proto.clamp = bnpClamp; | |
999 | proto.dlShiftTo = bnpDLShiftTo; | |
1000 | proto.drShiftTo = bnpDRShiftTo; | |
1001 | proto.lShiftTo = bnpLShiftTo; | |
1002 | proto.rShiftTo = bnpRShiftTo; | |
1003 | proto.subTo = bnpSubTo; | |
1004 | proto.multiplyTo = bnpMultiplyTo; | |
1005 | proto.squareTo = bnpSquareTo; | |
1006 | proto.divRemTo = bnpDivRemTo; | |
1007 | proto.invDigit = bnpInvDigit; | |
1008 | proto.isEven = bnpIsEven; | |
1009 | proto.exp = bnpExp; | |
1010 | ||
1011 | // public | |
1012 | proto.toString = bnToString; | |
1013 | proto.negate = bnNegate; | |
1014 | proto.abs = bnAbs; | |
1015 | proto.compareTo = bnCompareTo; | |
1016 | proto.bitLength = bnBitLength; | |
1017 | proto.mod = bnMod; | |
1018 | proto.modPowInt = bnModPowInt; | |
1019 | ||
1020 | //// jsbn2 | |
1021 | ||
1022 | function nbi() { return new BigInteger(null); } | |
1023 | ||
1024 | // (public) | |
1025 | function bnClone() { var r = nbi(); this.copyTo(r); return r; } | |
1026 | ||
1027 | // (public) return value as integer | |
1028 | function bnIntValue() { | |
1029 | if(this.s < 0) { | |
1030 | if(this.t == 1) return this[0]-this.DV; | |
1031 | else if(this.t == 0) return -1; | |
1032 | } | |
1033 | else if(this.t == 1) return this[0]; | |
1034 | else if(this.t == 0) return 0; | |
1035 | // assumes 16 < DB < 32 | |
1036 | return ((this[1]&((1<<(32-this.DB))-1))<<this.DB)|this[0]; | |
1037 | } | |
1038 | ||
1039 | // (public) return value as byte | |
1040 | function bnByteValue() { return (this.t==0)?this.s:(this[0]<<24)>>24; } | |
1041 | ||
1042 | // (public) return value as short (assumes DB>=16) | |
1043 | function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; } | |
1044 | ||
1045 | // (protected) return x s.t. r^x < DV | |
1046 | function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); } | |
1047 | ||
1048 | // (public) 0 if this == 0, 1 if this > 0 | |
1049 | function bnSigNum() { | |
1050 | if(this.s < 0) return -1; | |
1051 | else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0; | |
1052 | else return 1; | |
1053 | } | |
1054 | ||
1055 | // (protected) convert to radix string | |
1056 | function bnpToRadix(b) { | |
1057 | if(b == null) b = 10; | |
1058 | if(this.signum() == 0 || b < 2 || b > 36) return "0"; | |
1059 | var cs = this.chunkSize(b); | |
1060 | var a = Math.pow(b,cs); | |
1061 | var d = nbv(a), y = nbi(), z = nbi(), r = ""; | |
1062 | this.divRemTo(d,y,z); | |
1063 | while(y.signum() > 0) { | |
1064 | r = (a+z.intValue()).toString(b).substr(1) + r; | |
1065 | y.divRemTo(d,y,z); | |
1066 | } | |
1067 | return z.intValue().toString(b) + r; | |
1068 | } | |
1069 | ||
1070 | // (protected) convert from radix string | |
1071 | function bnpFromRadix(s,b) { | |
1072 | var self = this; | |
1073 | self.fromInt(0); | |
1074 | if(b == null) b = 10; | |
1075 | var cs = self.chunkSize(b); | |
1076 | var d = Math.pow(b,cs), mi = false, j = 0, w = 0; | |
1077 | for(var i = 0; i < s.length; ++i) { | |
1078 | var x = intAt(s,i); | |
1079 | if(x < 0) { | |
1080 | if(s.charAt(i) == "-" && self.signum() == 0) mi = true; | |
1081 | continue; | |
1082 | } | |
1083 | w = b*w+x; | |
1084 | if(++j >= cs) { | |
1085 | self.dMultiply(d); | |
1086 | self.dAddOffset(w,0); | |
1087 | j = 0; | |
1088 | w = 0; | |
1089 | } | |
1090 | } | |
1091 | if(j > 0) { | |
1092 | self.dMultiply(Math.pow(b,j)); | |
1093 | self.dAddOffset(w,0); | |
1094 | } | |
1095 | if(mi) BigInteger.ZERO.subTo(self,self); | |
1096 | } | |
1097 | ||
1098 | // (protected) alternate constructor | |
1099 | function bnpFromNumber(a,b,c) { | |
1100 | var self = this; | |
1101 | if("number" == typeof b) { | |
1102 | // new BigInteger(int,int,RNG) | |
1103 | if(a < 2) self.fromInt(1); | |
1104 | else { | |
1105 | self.fromNumber(a,c); | |
1106 | if(!self.testBit(a-1)) // force MSB set | |
1107 | self.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,self); | |
1108 | if(self.isEven()) self.dAddOffset(1,0); // force odd | |
1109 | while(!self.isProbablePrime(b)) { | |
1110 | self.dAddOffset(2,0); | |
1111 | if(self.bitLength() > a) self.subTo(BigInteger.ONE.shiftLeft(a-1),self); | |
1112 | } | |
1113 | } | |
1114 | } | |
1115 | else { | |
1116 | // new BigInteger(int,RNG) | |
1117 | var x = new Array(), t = a&7; | |
1118 | x.length = (a>>3)+1; | |
1119 | b.nextBytes(x); | |
1120 | if(t > 0) x[0] &= ((1<<t)-1); else x[0] = 0; | |
1121 | self.fromString(x,256); | |
1122 | } | |
1123 | } | |
1124 | ||
1125 | // (public) convert to bigendian byte array | |
1126 | function bnToByteArray() { | |
1127 | var self = this; | |
1128 | var i = self.t, r = new Array(); | |
1129 | r[0] = self.s; | |
1130 | var p = self.DB-(i*self.DB)%8, d, k = 0; | |
1131 | if(i-- > 0) { | |
1132 | if(p < self.DB && (d = self[i]>>p) != (self.s&self.DM)>>p) | |
1133 | r[k++] = d|(self.s<<(self.DB-p)); | |
1134 | while(i >= 0) { | |
1135 | if(p < 8) { | |
1136 | d = (self[i]&((1<<p)-1))<<(8-p); | |
1137 | d |= self[--i]>>(p+=self.DB-8); | |
1138 | } | |
1139 | else { | |
1140 | d = (self[i]>>(p-=8))&0xff; | |
1141 | if(p <= 0) { p += self.DB; --i; } | |
1142 | } | |
1143 | if((d&0x80) != 0) d |= -256; | |
1144 | if(k === 0 && (self.s&0x80) != (d&0x80)) ++k; | |
1145 | if(k > 0 || d != self.s) r[k++] = d; | |
1146 | } | |
1147 | } | |
1148 | return r; | |
1149 | } | |
1150 | ||
1151 | function bnEquals(a) { return(this.compareTo(a)==0); } | |
1152 | function bnMin(a) { return(this.compareTo(a)<0)?this:a; } | |
1153 | function bnMax(a) { return(this.compareTo(a)>0)?this:a; } | |
1154 | ||
1155 | // (protected) r = this op a (bitwise) | |
1156 | function bnpBitwiseTo(a,op,r) { | |
1157 | var self = this; | |
1158 | var i, f, m = Math.min(a.t,self.t); | |
1159 | for(i = 0; i < m; ++i) r[i] = op(self[i],a[i]); | |
1160 | if(a.t < self.t) { | |
1161 | f = a.s&self.DM; | |
1162 | for(i = m; i < self.t; ++i) r[i] = op(self[i],f); | |
1163 | r.t = self.t; | |
1164 | } | |
1165 | else { | |
1166 | f = self.s&self.DM; | |
1167 | for(i = m; i < a.t; ++i) r[i] = op(f,a[i]); | |
1168 | r.t = a.t; | |
1169 | } | |
1170 | r.s = op(self.s,a.s); | |
1171 | r.clamp(); | |
1172 | } | |
1173 | ||
1174 | // (public) this & a | |
1175 | function op_and(x,y) { return x&y; } | |
1176 | function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; } | |
1177 | ||
1178 | // (public) this | a | |
1179 | function op_or(x,y) { return x|y; } | |
1180 | function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; } | |
1181 | ||
1182 | // (public) this ^ a | |
1183 | function op_xor(x,y) { return x^y; } | |
1184 | function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; } | |
1185 | ||
1186 | // (public) this & ~a | |
1187 | function op_andnot(x,y) { return x&~y; } | |
1188 | function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; } | |
1189 | ||
1190 | // (public) ~this | |
1191 | function bnNot() { | |
1192 | var r = nbi(); | |
1193 | for(var i = 0; i < this.t; ++i) r[i] = this.DM&~this[i]; | |
1194 | r.t = this.t; | |
1195 | r.s = ~this.s; | |
1196 | return r; | |
1197 | } | |
1198 | ||
1199 | // (public) this << n | |
1200 | function bnShiftLeft(n) { | |
1201 | var r = nbi(); | |
1202 | if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r); | |
1203 | return r; | |
1204 | } | |
1205 | ||
1206 | // (public) this >> n | |
1207 | function bnShiftRight(n) { | |
1208 | var r = nbi(); | |
1209 | if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); | |
1210 | return r; | |
1211 | } | |
1212 | ||
1213 | // return index of lowest 1-bit in x, x < 2^31 | |
1214 | function lbit(x) { | |
1215 | if(x == 0) return -1; | |
1216 | var r = 0; | |
1217 | if((x&0xffff) == 0) { x >>= 16; r += 16; } | |
1218 | if((x&0xff) == 0) { x >>= 8; r += 8; } | |
1219 | if((x&0xf) == 0) { x >>= 4; r += 4; } | |
1220 | if((x&3) == 0) { x >>= 2; r += 2; } | |
1221 | if((x&1) == 0) ++r; | |
1222 | return r; | |
1223 | } | |
1224 | ||
1225 | // (public) returns index of lowest 1-bit (or -1 if none) | |
1226 | function bnGetLowestSetBit() { | |
1227 | for(var i = 0; i < this.t; ++i) | |
1228 | if(this[i] != 0) return i*this.DB+lbit(this[i]); | |
1229 | if(this.s < 0) return this.t*this.DB; | |
1230 | return -1; | |
1231 | } | |
1232 | ||
1233 | // return number of 1 bits in x | |
1234 | function cbit(x) { | |
1235 | var r = 0; | |
1236 | while(x != 0) { x &= x-1; ++r; } | |
1237 | return r; | |
1238 | } | |
1239 | ||
1240 | // (public) return number of set bits | |
1241 | function bnBitCount() { | |
1242 | var r = 0, x = this.s&this.DM; | |
1243 | for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x); | |
1244 | return r; | |
1245 | } | |
1246 | ||
1247 | // (public) true iff nth bit is set | |
1248 | function bnTestBit(n) { | |
1249 | var j = Math.floor(n/this.DB); | |
1250 | if(j >= this.t) return(this.s!=0); | |
1251 | return((this[j]&(1<<(n%this.DB)))!=0); | |
1252 | } | |
1253 | ||
1254 | // (protected) this op (1<<n) | |
1255 | function bnpChangeBit(n,op) { | |
1256 | var r = BigInteger.ONE.shiftLeft(n); | |
1257 | this.bitwiseTo(r,op,r); | |
1258 | return r; | |
1259 | } | |
1260 | ||
1261 | // (public) this | (1<<n) | |
1262 | function bnSetBit(n) { return this.changeBit(n,op_or); } | |
1263 | ||
1264 | // (public) this & ~(1<<n) | |
1265 | function bnClearBit(n) { return this.changeBit(n,op_andnot); } | |
1266 | ||
1267 | // (public) this ^ (1<<n) | |
1268 | function bnFlipBit(n) { return this.changeBit(n,op_xor); } | |
1269 | ||
1270 | // (protected) r = this + a | |
1271 | function bnpAddTo(a,r) { | |
1272 | var self = this; | |
1273 | ||
1274 | var i = 0, c = 0, m = Math.min(a.t,self.t); | |
1275 | while(i < m) { | |
1276 | c += self[i]+a[i]; | |
1277 | r[i++] = c&self.DM; | |
1278 | c >>= self.DB; | |
1279 | } | |
1280 | if(a.t < self.t) { | |
1281 | c += a.s; | |
1282 | while(i < self.t) { | |
1283 | c += self[i]; | |
1284 | r[i++] = c&self.DM; | |
1285 | c >>= self.DB; | |
1286 | } | |
1287 | c += self.s; | |
1288 | } | |
1289 | else { | |
1290 | c += self.s; | |
1291 | while(i < a.t) { | |
1292 | c += a[i]; | |
1293 | r[i++] = c&self.DM; | |
1294 | c >>= self.DB; | |
1295 | } | |
1296 | c += a.s; | |
1297 | } | |
1298 | r.s = (c<0)?-1:0; | |
1299 | if(c > 0) r[i++] = c; | |
1300 | else if(c < -1) r[i++] = self.DV+c; | |
1301 | r.t = i; | |
1302 | r.clamp(); | |
1303 | } | |
1304 | ||
1305 | // (public) this + a | |
1306 | function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } | |
1307 | ||
1308 | // (public) this - a | |
1309 | function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } | |
1310 | ||
1311 | // (public) this * a | |
1312 | function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } | |
1313 | ||
1314 | // (public) this^2 | |
1315 | function bnSquare() { var r = nbi(); this.squareTo(r); return r; } | |
1316 | ||
1317 | // (public) this / a | |
1318 | function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } | |
1319 | ||
1320 | // (public) this % a | |
1321 | function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } | |
1322 | ||
1323 | // (public) [this/a,this%a] | |
1324 | function bnDivideAndRemainder(a) { | |
1325 | var q = nbi(), r = nbi(); | |
1326 | this.divRemTo(a,q,r); | |
1327 | return new Array(q,r); | |
1328 | } | |
1329 | ||
1330 | // (protected) this *= n, this >= 0, 1 < n < DV | |
1331 | function bnpDMultiply(n) { | |
1332 | this[this.t] = this.am(0,n-1,this,0,0,this.t); | |
1333 | ++this.t; | |
1334 | this.clamp(); | |
1335 | } | |
1336 | ||
1337 | // (protected) this += n << w words, this >= 0 | |
1338 | function bnpDAddOffset(n,w) { | |
1339 | if(n == 0) return; | |
1340 | while(this.t <= w) this[this.t++] = 0; | |
1341 | this[w] += n; | |
1342 | while(this[w] >= this.DV) { | |
1343 | this[w] -= this.DV; | |
1344 | if(++w >= this.t) this[this.t++] = 0; | |
1345 | ++this[w]; | |
1346 | } | |
1347 | } | |
1348 | ||
1349 | // A "null" reducer | |
1350 | function NullExp() {} | |
1351 | function nNop(x) { return x; } | |
1352 | function nMulTo(x,y,r) { x.multiplyTo(y,r); } | |
1353 | function nSqrTo(x,r) { x.squareTo(r); } | |
1354 | ||
1355 | NullExp.prototype.convert = nNop; | |
1356 | NullExp.prototype.revert = nNop; | |
1357 | NullExp.prototype.mulTo = nMulTo; | |
1358 | NullExp.prototype.sqrTo = nSqrTo; | |
1359 | ||
1360 | // (public) this^e | |
1361 | function bnPow(e) { return this.exp(e,new NullExp()); } | |
1362 | ||
1363 | // (protected) r = lower n words of "this * a", a.t <= n | |
1364 | // "this" should be the larger one if appropriate. | |
1365 | function bnpMultiplyLowerTo(a,n,r) { | |
1366 | var i = Math.min(this.t+a.t,n); | |
1367 | r.s = 0; // assumes a,this >= 0 | |
1368 | r.t = i; | |
1369 | while(i > 0) r[--i] = 0; | |
1370 | var j; | |
1371 | for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t); | |
1372 | for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i); | |
1373 | r.clamp(); | |
1374 | } | |
1375 | ||
1376 | // (protected) r = "this * a" without lower n words, n > 0 | |
1377 | // "this" should be the larger one if appropriate. | |
1378 | function bnpMultiplyUpperTo(a,n,r) { | |
1379 | --n; | |
1380 | var i = r.t = this.t+a.t-n; | |
1381 | r.s = 0; // assumes a,this >= 0 | |
1382 | while(--i >= 0) r[i] = 0; | |
1383 | for(i = Math.max(n-this.t,0); i < a.t; ++i) | |
1384 | r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n); | |
1385 | r.clamp(); | |
1386 | r.drShiftTo(1,r); | |
1387 | } | |
1388 | ||
1389 | // Barrett modular reduction | |
1390 | function Barrett(m) { | |
1391 | // setup Barrett | |
1392 | this.r2 = nbi(); | |
1393 | this.q3 = nbi(); | |
1394 | BigInteger.ONE.dlShiftTo(2*m.t,this.r2); | |
1395 | this.mu = this.r2.divide(m); | |
1396 | this.m = m; | |
1397 | } | |
1398 | ||
1399 | function barrettConvert(x) { | |
1400 | if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); | |
1401 | else if(x.compareTo(this.m) < 0) return x; | |
1402 | else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } | |
1403 | } | |
1404 | ||
1405 | function barrettRevert(x) { return x; } | |
1406 | ||
1407 | // x = x mod m (HAC 14.42) | |
1408 | function barrettReduce(x) { | |
1409 | var self = this; | |
1410 | x.drShiftTo(self.m.t-1,self.r2); | |
1411 | if(x.t > self.m.t+1) { x.t = self.m.t+1; x.clamp(); } | |
1412 | self.mu.multiplyUpperTo(self.r2,self.m.t+1,self.q3); | |
1413 | self.m.multiplyLowerTo(self.q3,self.m.t+1,self.r2); | |
1414 | while(x.compareTo(self.r2) < 0) x.dAddOffset(1,self.m.t+1); | |
1415 | x.subTo(self.r2,x); | |
1416 | while(x.compareTo(self.m) >= 0) x.subTo(self.m,x); | |
1417 | } | |
1418 | ||
1419 | // r = x^2 mod m; x != r | |
1420 | function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } | |
1421 | ||
1422 | // r = x*y mod m; x,y != r | |
1423 | function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } | |
1424 | ||
1425 | Barrett.prototype.convert = barrettConvert; | |
1426 | Barrett.prototype.revert = barrettRevert; | |
1427 | Barrett.prototype.reduce = barrettReduce; | |
1428 | Barrett.prototype.mulTo = barrettMulTo; | |
1429 | Barrett.prototype.sqrTo = barrettSqrTo; | |
1430 | ||
1431 | // (public) this^e % m (HAC 14.85) | |
1432 | function bnModPow(e,m) { | |
1433 | var i = e.bitLength(), k, r = nbv(1), z; | |
1434 | if(i <= 0) return r; | |
1435 | else if(i < 18) k = 1; | |
1436 | else if(i < 48) k = 3; | |
1437 | else if(i < 144) k = 4; | |
1438 | else if(i < 768) k = 5; | |
1439 | else k = 6; | |
1440 | if(i < 8) | |
1441 | z = new Classic(m); | |
1442 | else if(m.isEven()) | |
1443 | z = new Barrett(m); | |
1444 | else | |
1445 | z = new Montgomery(m); | |
1446 | ||
1447 | // precomputation | |
1448 | var g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1; | |
1449 | g[1] = z.convert(this); | |
1450 | if(k > 1) { | |
1451 | var g2 = nbi(); | |
1452 | z.sqrTo(g[1],g2); | |
1453 | while(n <= km) { | |
1454 | g[n] = nbi(); | |
1455 | z.mulTo(g2,g[n-2],g[n]); | |
1456 | n += 2; | |
1457 | } | |
1458 | } | |
1459 | ||
1460 | var j = e.t-1, w, is1 = true, r2 = nbi(), t; | |
1461 | i = nbits(e[j])-1; | |
1462 | while(j >= 0) { | |
1463 | if(i >= k1) w = (e[j]>>(i-k1))&km; | |
1464 | else { | |
1465 | w = (e[j]&((1<<(i+1))-1))<<(k1-i); | |
1466 | if(j > 0) w |= e[j-1]>>(this.DB+i-k1); | |
1467 | } | |
1468 | ||
1469 | n = k; | |
1470 | while((w&1) == 0) { w >>= 1; --n; } | |
1471 | if((i -= n) < 0) { i += this.DB; --j; } | |
1472 | if(is1) { // ret == 1, don't bother squaring or multiplying it | |
1473 | g[w].copyTo(r); | |
1474 | is1 = false; | |
1475 | } | |
1476 | else { | |
1477 | while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } | |
1478 | if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } | |
1479 | z.mulTo(r2,g[w],r); | |
1480 | } | |
1481 | ||
1482 | while(j >= 0 && (e[j]&(1<<i)) == 0) { | |
1483 | z.sqrTo(r,r2); t = r; r = r2; r2 = t; | |
1484 | if(--i < 0) { i = this.DB-1; --j; } | |
1485 | } | |
1486 | } | |
1487 | return z.revert(r); | |
1488 | } | |
1489 | ||
1490 | // (public) gcd(this,a) (HAC 14.54) | |
1491 | function bnGCD(a) { | |
1492 | var x = (this.s<0)?this.negate():this.clone(); | |
1493 | var y = (a.s<0)?a.negate():a.clone(); | |
1494 | if(x.compareTo(y) < 0) { var t = x; x = y; y = t; } | |
1495 | var i = x.getLowestSetBit(), g = y.getLowestSetBit(); | |
1496 | if(g < 0) return x; | |
1497 | if(i < g) g = i; | |
1498 | if(g > 0) { | |
1499 | x.rShiftTo(g,x); | |
1500 | y.rShiftTo(g,y); | |
1501 | } | |
1502 | while(x.signum() > 0) { | |
1503 | if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); | |
1504 | if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); | |
1505 | if(x.compareTo(y) >= 0) { | |
1506 | x.subTo(y,x); | |
1507 | x.rShiftTo(1,x); | |
1508 | } | |
1509 | else { | |
1510 | y.subTo(x,y); | |
1511 | y.rShiftTo(1,y); | |
1512 | } | |
1513 | } | |
1514 | if(g > 0) y.lShiftTo(g,y); | |
1515 | return y; | |
1516 | } | |
1517 | ||
1518 | // (protected) this % n, n < 2^26 | |
1519 | function bnpModInt(n) { | |
1520 | if(n <= 0) return 0; | |
1521 | var d = this.DV%n, r = (this.s<0)?n-1:0; | |
1522 | if(this.t > 0) | |
1523 | if(d == 0) r = this[0]%n; | |
1524 | else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n; | |
1525 | return r; | |
1526 | } | |
1527 | ||
1528 | // (public) 1/this % m (HAC 14.61) | |
1529 | function bnModInverse(m) { | |
1530 | var ac = m.isEven(); | |
1531 | if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; | |
1532 | var u = m.clone(), v = this.clone(); | |
1533 | var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); | |
1534 | while(u.signum() != 0) { | |
1535 | while(u.isEven()) { | |
1536 | u.rShiftTo(1,u); | |
1537 | if(ac) { | |
1538 | if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } | |
1539 | a.rShiftTo(1,a); | |
1540 | } | |
1541 | else if(!b.isEven()) b.subTo(m,b); | |
1542 | b.rShiftTo(1,b); | |
1543 | } | |
1544 | while(v.isEven()) { | |
1545 | v.rShiftTo(1,v); | |
1546 | if(ac) { | |
1547 | if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } | |
1548 | c.rShiftTo(1,c); | |
1549 | } | |
1550 | else if(!d.isEven()) d.subTo(m,d); | |
1551 | d.rShiftTo(1,d); | |
1552 | } | |
1553 | if(u.compareTo(v) >= 0) { | |
1554 | u.subTo(v,u); | |
1555 | if(ac) a.subTo(c,a); | |
1556 | b.subTo(d,b); | |
1557 | } | |
1558 | else { | |
1559 | v.subTo(u,v); | |
1560 | if(ac) c.subTo(a,c); | |
1561 | d.subTo(b,d); | |
1562 | } | |
1563 | } | |
1564 | if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; | |
1565 | if(d.compareTo(m) >= 0) return d.subtract(m); | |
1566 | if(d.signum() < 0) d.addTo(m,d); else return d; | |
1567 | if(d.signum() < 0) return d.add(m); else return d; | |
1568 | } | |
1569 | ||
1570 | // protected | |
1571 | proto.chunkSize = bnpChunkSize; | |
1572 | proto.toRadix = bnpToRadix; | |
1573 | proto.fromRadix = bnpFromRadix; | |
1574 | proto.fromNumber = bnpFromNumber; | |
1575 | proto.bitwiseTo = bnpBitwiseTo; | |
1576 | proto.changeBit = bnpChangeBit; | |
1577 | proto.addTo = bnpAddTo; | |
1578 | proto.dMultiply = bnpDMultiply; | |
1579 | proto.dAddOffset = bnpDAddOffset; | |
1580 | proto.multiplyLowerTo = bnpMultiplyLowerTo; | |
1581 | proto.multiplyUpperTo = bnpMultiplyUpperTo; | |
1582 | proto.modInt = bnpModInt; | |
1583 | ||
1584 | // public | |
1585 | proto.clone = bnClone; | |
1586 | proto.intValue = bnIntValue; | |
1587 | proto.byteValue = bnByteValue; | |
1588 | proto.shortValue = bnShortValue; | |
1589 | proto.signum = bnSigNum; | |
1590 | proto.toByteArray = bnToByteArray; | |
1591 | proto.equals = bnEquals; | |
1592 | proto.min = bnMin; | |
1593 | proto.max = bnMax; | |
1594 | proto.and = bnAnd; | |
1595 | proto.or = bnOr; | |
1596 | proto.xor = bnXor; | |
1597 | proto.andNot = bnAndNot; | |
1598 | proto.not = bnNot; | |
1599 | proto.shiftLeft = bnShiftLeft; | |
1600 | proto.shiftRight = bnShiftRight; | |
1601 | proto.getLowestSetBit = bnGetLowestSetBit; | |
1602 | proto.bitCount = bnBitCount; | |
1603 | proto.testBit = bnTestBit; | |
1604 | proto.setBit = bnSetBit; | |
1605 | proto.clearBit = bnClearBit; | |
1606 | proto.flipBit = bnFlipBit; | |
1607 | proto.add = bnAdd; | |
1608 | proto.subtract = bnSubtract; | |
1609 | proto.multiply = bnMultiply; | |
1610 | proto.divide = bnDivide; | |
1611 | proto.remainder = bnRemainder; | |
1612 | proto.divideAndRemainder = bnDivideAndRemainder; | |
1613 | proto.modPow = bnModPow; | |
1614 | proto.modInverse = bnModInverse; | |
1615 | proto.pow = bnPow; | |
1616 | proto.gcd = bnGCD; | |
1617 | ||
1618 | // JSBN-specific extension | |
1619 | proto.square = bnSquare; | |
1620 | ||
1621 | // BigInteger interfaces not implemented in jsbn: | |
1622 | ||
1623 | // BigInteger(int signum, byte[] magnitude) | |
1624 | // double doubleValue() | |
1625 | // float floatValue() | |
1626 | // int hashCode() | |
1627 | // long longValue() | |
1628 | // static BigInteger valueOf(long val) | |
1629 | ||
1630 | // "constants" | |
1631 | BigInteger.ZERO = nbv(0); | |
1632 | BigInteger.ONE = nbv(1); | |
1633 | BigInteger.valueOf = nbv; | |
1634 | ||
1635 | },{"assert":4}],2:[function(_dereq_,module,exports){ | |
1636 | (function (Buffer){ | |
1637 | // FIXME: Kind of a weird way to throw exceptions, consider removing | |
1638 | var assert = _dereq_('assert') | |
1639 | var BigInteger = _dereq_('./bigi') | |
1640 | ||
1641 | /** | |
1642 | * Turns a byte array into a big integer. | |
1643 | * | |
1644 | * This function will interpret a byte array as a big integer in big | |
1645 | * endian notation. | |
1646 | */ | |
1647 | BigInteger.fromByteArrayUnsigned = function(byteArray) { | |
1648 | // BigInteger expects a DER integer conformant byte array | |
1649 | if (byteArray[0] & 0x80) { | |
1650 | return new BigInteger([0].concat(byteArray)) | |
1651 | } | |
1652 | ||
1653 | return new BigInteger(byteArray) | |
1654 | } | |
1655 | ||
1656 | /** | |
1657 | * Returns a byte array representation of the big integer. | |
1658 | * | |
1659 | * This returns the absolute of the contained value in big endian | |
1660 | * form. A value of zero results in an empty array. | |
1661 | */ | |
1662 | BigInteger.prototype.toByteArrayUnsigned = function() { | |
1663 | var byteArray = this.toByteArray() | |
1664 | return byteArray[0] === 0 ? byteArray.slice(1) : byteArray | |
1665 | } | |
1666 | ||
1667 | BigInteger.fromDERInteger = function(byteArray) { | |
1668 | return new BigInteger(byteArray) | |
1669 | } | |
1670 | ||
1671 | /* | |
1672 | * Converts BigInteger to a DER integer representation. | |
1673 | * | |
1674 | * The format for this value uses the most significant bit as a sign | |
1675 | * bit. If the most significant bit is already set and the integer is | |
1676 | * positive, a 0x00 is prepended. | |
1677 | * | |
1678 | * Examples: | |
1679 | * | |
1680 | * 0 => 0x00 | |
1681 | * 1 => 0x01 | |
1682 | * -1 => 0x81 | |
1683 | * 127 => 0x7f | |
1684 | * -127 => 0xff | |
1685 | * 128 => 0x0080 | |
1686 | * -128 => 0x80 | |
1687 | * 255 => 0x00ff | |
1688 | * -255 => 0xff | |
1689 | * 16300 => 0x3fac | |
1690 | * -16300 => 0xbfac | |
1691 | * 62300 => 0x00f35c | |
1692 | * -62300 => 0xf35c | |
1693 | */ | |
1694 | BigInteger.prototype.toDERInteger = BigInteger.prototype.toByteArray | |
1695 | ||
1696 | BigInteger.fromBuffer = function(buffer) { | |
1697 | // BigInteger expects a DER integer conformant byte array | |
1698 | if (buffer[0] & 0x80) { | |
1699 | var byteArray = Array.prototype.slice.call(buffer) | |
1700 | ||
1701 | return new BigInteger([0].concat(byteArray)) | |
1702 | } | |
1703 | ||
1704 | return new BigInteger(buffer) | |
1705 | } | |
1706 | ||
1707 | BigInteger.fromHex = function(hex) { | |
1708 | if (hex === '') return BigInteger.ZERO | |
1709 | ||
1710 | assert.equal(hex, hex.match(/^[A-Fa-f0-9]+/), 'Invalid hex string') | |
1711 | assert.equal(hex.length % 2, 0, 'Incomplete hex') | |
1712 | return new BigInteger(hex, 16) | |
1713 | } | |
1714 | ||
1715 | BigInteger.prototype.toBuffer = function(size) { | |
1716 | var byteArray = this.toByteArrayUnsigned() | |
1717 | var zeros = [] | |
1718 | ||
1719 | var padding = size - byteArray.length | |
1720 | while (zeros.length < padding) zeros.push(0) | |
1721 | ||
1722 | return new Buffer(zeros.concat(byteArray)) | |
1723 | } | |
1724 | ||
1725 | BigInteger.prototype.toHex = function(size) { | |
1726 | return this.toBuffer(size).toString('hex') | |
1727 | } | |
1728 | ||
1729 | }).call(this,_dereq_("buffer").Buffer) | |
1730 | },{"./bigi":1,"assert":4,"buffer":8}],3:[function(_dereq_,module,exports){ | |
1731 | var BigInteger = _dereq_('./bigi') | |
1732 | ||
1733 | //addons | |
1734 | _dereq_('./convert') | |
1735 | ||
1736 | module.exports = BigInteger | |
1737 | },{"./bigi":1,"./convert":2}],4:[function(_dereq_,module,exports){ | |
1738 | // http://wiki.commonjs.org/wiki/Unit_Testing/1.0 | |
1739 | // | |
1740 | // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! | |
1741 | // | |
1742 | // Originally from narwhal.js (http://narwhaljs.org) | |
1743 | // Copyright (c) 2009 Thomas Robinson <280north.com> | |
1744 | // | |
1745 | // Permission is hereby granted, free of charge, to any person obtaining a copy | |
1746 | // of this software and associated documentation files (the 'Software'), to | |
1747 | // deal in the Software without restriction, including without limitation the | |
1748 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
1749 | // sell copies of the Software, and to permit persons to whom the Software is | |
1750 | // furnished to do so, subject to the following conditions: | |
1751 | // | |
1752 | // The above copyright notice and this permission notice shall be included in | |
1753 | // all copies or substantial portions of the Software. | |
1754 | // | |
1755 | // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
1756 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
1757 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
1758 | // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | |
1759 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
1760 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
1761 | ||
1762 | // when used in node, this will actually load the util module we depend on | |
1763 | // versus loading the builtin util module as happens otherwise | |
1764 | // this is a bug in node module loading as far as I am concerned | |
1765 | var util = _dereq_('util/'); | |
1766 | ||
1767 | var pSlice = Array.prototype.slice; | |
1768 | var hasOwn = Object.prototype.hasOwnProperty; | |
1769 | ||
1770 | // 1. The assert module provides functions that throw | |
1771 | // AssertionError's when particular conditions are not met. The | |
1772 | // assert module must conform to the following interface. | |
1773 | ||
1774 | var assert = module.exports = ok; | |
1775 | ||
1776 | // 2. The AssertionError is defined in assert. | |
1777 | // new assert.AssertionError({ message: message, | |
1778 | // actual: actual, | |
1779 | // expected: expected }) | |
1780 | ||
1781 | assert.AssertionError = function AssertionError(options) { | |
1782 | this.name = 'AssertionError'; | |
1783 | this.actual = options.actual; | |
1784 | this.expected = options.expected; | |
1785 | this.operator = options.operator; | |
1786 | if (options.message) { | |
1787 | this.message = options.message; | |
1788 | this.generatedMessage = false; | |
1789 | } else { | |
1790 | this.message = getMessage(this); | |
1791 | this.generatedMessage = true; | |
1792 | } | |
1793 | var stackStartFunction = options.stackStartFunction || fail; | |
1794 | ||
1795 | if (Error.captureStackTrace) { | |
1796 | Error.captureStackTrace(this, stackStartFunction); | |
1797 | } | |
1798 | else { | |
1799 | // non v8 browsers so we can have a stacktrace | |
1800 | var err = new Error(); | |
1801 | if (err.stack) { | |
1802 | var out = err.stack; | |
1803 | ||
1804 | // try to strip useless frames | |
1805 | var fn_name = stackStartFunction.name; | |
1806 | var idx = out.indexOf('\n' + fn_name); | |
1807 | if (idx >= 0) { | |
1808 | // once we have located the function frame | |
1809 | // we need to strip out everything before it (and its line) | |
1810 | var next_line = out.indexOf('\n', idx + 1); | |
1811 | out = out.substring(next_line + 1); | |
1812 | } | |
1813 | ||
1814 | this.stack = out; | |
1815 | } | |
1816 | } | |
1817 | }; | |
1818 | ||
1819 | // assert.AssertionError instanceof Error | |
1820 | util.inherits(assert.AssertionError, Error); | |
1821 | ||
1822 | function replacer(key, value) { | |
1823 | if (util.isUndefined(value)) { | |
1824 | return '' + value; | |
1825 | } | |
1826 | if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) { | |
1827 | return value.toString(); | |
1828 | } | |
1829 | if (util.isFunction(value) || util.isRegExp(value)) { | |
1830 | return value.toString(); | |
1831 | } | |
1832 | return value; | |
1833 | } | |
1834 | ||
1835 | function truncate(s, n) { | |
1836 | if (util.isString(s)) { | |
1837 | return s.length < n ? s : s.slice(0, n); | |
1838 | } else { | |
1839 | return s; | |
1840 | } | |
1841 | } | |
1842 | ||
1843 | function getMessage(self) { | |
1844 | return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' + | |
1845 | self.operator + ' ' + | |
1846 | truncate(JSON.stringify(self.expected, replacer), 128); | |
1847 | } | |
1848 | ||
1849 | // At present only the three keys mentioned above are used and | |
1850 | // understood by the spec. Implementations or sub modules can pass | |
1851 | // other keys to the AssertionError's constructor - they will be | |
1852 | // ignored. | |
1853 | ||
1854 | // 3. All of the following functions must throw an AssertionError | |
1855 | // when a corresponding condition is not met, with a message that | |
1856 | // may be undefined if not provided. All assertion methods provide | |
1857 | // both the actual and expected values to the assertion error for | |
1858 | // display purposes. | |
1859 | ||
1860 | function fail(actual, expected, message, operator, stackStartFunction) { | |
1861 | throw new assert.AssertionError({ | |
1862 | message: message, | |
1863 | actual: actual, | |
1864 | expected: expected, | |
1865 | operator: operator, | |
1866 | stackStartFunction: stackStartFunction | |
1867 | }); | |
1868 | } | |
1869 | ||
1870 | // EXTENSION! allows for well behaved errors defined elsewhere. | |
1871 | assert.fail = fail; | |
1872 | ||
1873 | // 4. Pure assertion tests whether a value is truthy, as determined | |
1874 | // by !!guard. | |
1875 | // assert.ok(guard, message_opt); | |
1876 | // This statement is equivalent to assert.equal(true, !!guard, | |
1877 | // message_opt);. To test strictly for the value true, use | |
1878 | // assert.strictEqual(true, guard, message_opt);. | |
1879 | ||
1880 | function ok(value, message) { | |
1881 | if (!value) fail(value, true, message, '==', assert.ok); | |
1882 | } | |
1883 | assert.ok = ok; | |
1884 | ||
1885 | // 5. The equality assertion tests shallow, coercive equality with | |
1886 | // ==. | |
1887 | // assert.equal(actual, expected, message_opt); | |
1888 | ||
1889 | assert.equal = function equal(actual, expected, message) { | |
1890 | if (actual != expected) fail(actual, expected, message, '==', assert.equal); | |
1891 | }; | |
1892 | ||
1893 | // 6. The non-equality assertion tests for whether two objects are not equal | |
1894 | // with != assert.notEqual(actual, expected, message_opt); | |
1895 | ||
1896 | assert.notEqual = function notEqual(actual, expected, message) { | |
1897 | if (actual == expected) { | |
1898 | fail(actual, expected, message, '!=', assert.notEqual); | |
1899 | } | |
1900 | }; | |
1901 | ||
1902 | // 7. The equivalence assertion tests a deep equality relation. | |
1903 | // assert.deepEqual(actual, expected, message_opt); | |
1904 | ||
1905 | assert.deepEqual = function deepEqual(actual, expected, message) { | |
1906 | if (!_deepEqual(actual, expected)) { | |
1907 | fail(actual, expected, message, 'deepEqual', assert.deepEqual); | |
1908 | } | |
1909 | }; | |
1910 | ||
1911 | function _deepEqual(actual, expected) { | |
1912 | // 7.1. All identical values are equivalent, as determined by ===. | |
1913 | if (actual === expected) { | |
1914 | return true; | |
1915 | ||
1916 | } else if (util.isBuffer(actual) && util.isBuffer(expected)) { | |
1917 | if (actual.length != expected.length) return false; | |
1918 | ||
1919 | for (var i = 0; i < actual.length; i++) { | |
1920 | if (actual[i] !== expected[i]) return false; | |
1921 | } | |
1922 | ||
1923 | return true; | |
1924 | ||
1925 | // 7.2. If the expected value is a Date object, the actual value is | |
1926 | // equivalent if it is also a Date object that refers to the same time. | |
1927 | } else if (util.isDate(actual) && util.isDate(expected)) { | |
1928 | return actual.getTime() === expected.getTime(); | |
1929 | ||
1930 | // 7.3 If the expected value is a RegExp object, the actual value is | |
1931 | // equivalent if it is also a RegExp object with the same source and | |
1932 | // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). | |
1933 | } else if (util.isRegExp(actual) && util.isRegExp(expected)) { | |
1934 | return actual.source === expected.source && | |
1935 | actual.global === expected.global && | |
1936 | actual.multiline === expected.multiline && | |
1937 | actual.lastIndex === expected.lastIndex && | |
1938 | actual.ignoreCase === expected.ignoreCase; | |
1939 | ||
1940 | // 7.4. Other pairs that do not both pass typeof value == 'object', | |
1941 | // equivalence is determined by ==. | |
1942 | } else if (!util.isObject(actual) && !util.isObject(expected)) { | |
1943 | return actual == expected; | |
1944 | ||
1945 | // 7.5 For all other Object pairs, including Array objects, equivalence is | |
1946 | // determined by having the same number of owned properties (as verified | |
1947 | // with Object.prototype.hasOwnProperty.call), the same set of keys | |
1948 | // (although not necessarily the same order), equivalent values for every | |
1949 | // corresponding key, and an identical 'prototype' property. Note: this | |
1950 | // accounts for both named and indexed properties on Arrays. | |
1951 | } else { | |
1952 | return objEquiv(actual, expected); | |
1953 | } | |
1954 | } | |
1955 | ||
1956 | function isArguments(object) { | |
1957 | return Object.prototype.toString.call(object) == '[object Arguments]'; | |
1958 | } | |
1959 | ||
1960 | function objEquiv(a, b) { | |
1961 | if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b)) | |
1962 | return false; | |
1963 | // an identical 'prototype' property. | |
1964 | if (a.prototype !== b.prototype) return false; | |
1965 | //~~~I've managed to break Object.keys through screwy arguments passing. | |
1966 | // Converting to array solves the problem. | |
1967 | if (isArguments(a)) { | |
1968 | if (!isArguments(b)) { | |
1969 | return false; | |
1970 | } | |
1971 | a = pSlice.call(a); | |
1972 | b = pSlice.call(b); | |
1973 | return _deepEqual(a, b); | |
1974 | } | |
1975 | try { | |
1976 | var ka = objectKeys(a), | |
1977 | kb = objectKeys(b), | |
1978 | key, i; | |
1979 | } catch (e) {//happens when one is a string literal and the other isn't | |
1980 | return false; | |
1981 | } | |
1982 | // having the same number of owned properties (keys incorporates | |
1983 | // hasOwnProperty) | |
1984 | if (ka.length != kb.length) | |
1985 | return false; | |
1986 | //the same set of keys (although not necessarily the same order), | |
1987 | ka.sort(); | |
1988 | kb.sort(); | |
1989 | //~~~cheap key test | |
1990 | for (i = ka.length - 1; i >= 0; i--) { | |
1991 | if (ka[i] != kb[i]) | |
1992 | return false; | |
1993 | } | |
1994 | //equivalent values for every corresponding key, and | |
1995 | //~~~possibly expensive deep test | |
1996 | for (i = ka.length - 1; i >= 0; i--) { | |
1997 | key = ka[i]; | |
1998 | if (!_deepEqual(a[key], b[key])) return false; | |
1999 | } | |
2000 | return true; | |
2001 | } | |
2002 | ||
2003 | // 8. The non-equivalence assertion tests for any deep inequality. | |
2004 | // assert.notDeepEqual(actual, expected, message_opt); | |
2005 | ||
2006 | assert.notDeepEqual = function notDeepEqual(actual, expected, message) { | |
2007 | if (_deepEqual(actual, expected)) { | |
2008 | fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); | |
2009 | } | |
2010 | }; | |
2011 | ||
2012 | // 9. The strict equality assertion tests strict equality, as determined by ===. | |
2013 | // assert.strictEqual(actual, expected, message_opt); | |
2014 | ||
2015 | assert.strictEqual = function strictEqual(actual, expected, message) { | |
2016 | if (actual !== expected) { | |
2017 | fail(actual, expected, message, '===', assert.strictEqual); | |
2018 | } | |
2019 | }; | |
2020 | ||
2021 | // 10. The strict non-equality assertion tests for strict inequality, as | |
2022 | // determined by !==. assert.notStrictEqual(actual, expected, message_opt); | |
2023 | ||
2024 | assert.notStrictEqual = function notStrictEqual(actual, expected, message) { | |
2025 | if (actual === expected) { | |
2026 | fail(actual, expected, message, '!==', assert.notStrictEqual); | |
2027 | } | |
2028 | }; | |
2029 | ||
2030 | function expectedException(actual, expected) { | |
2031 | if (!actual || !expected) { | |
2032 | return false; | |
2033 | } | |
2034 | ||
2035 | if (Object.prototype.toString.call(expected) == '[object RegExp]') { | |
2036 | return expected.test(actual); | |
2037 | } else if (actual instanceof expected) { | |
2038 | return true; | |
2039 | } else if (expected.call({}, actual) === true) { | |
2040 | return true; | |
2041 | } | |
2042 | ||
2043 | return false; | |
2044 | } | |
2045 | ||
2046 | function _throws(shouldThrow, block, expected, message) { | |
2047 | var actual; | |
2048 | ||
2049 | if (util.isString(expected)) { | |
2050 | message = expected; | |
2051 | expected = null; | |
2052 | } | |
2053 | ||
2054 | try { | |
2055 | block(); | |
2056 | } catch (e) { | |
2057 | actual = e; | |
2058 | } | |
2059 | ||
2060 | message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + | |
2061 | (message ? ' ' + message : '.'); | |
2062 | ||
2063 | if (shouldThrow && !actual) { | |
2064 | fail(actual, expected, 'Missing expected exception' + message); | |
2065 | } | |
2066 | ||
2067 | if (!shouldThrow && expectedException(actual, expected)) { | |
2068 | fail(actual, expected, 'Got unwanted exception' + message); | |
2069 | } | |
2070 | ||
2071 | if ((shouldThrow && actual && expected && | |
2072 | !expectedException(actual, expected)) || (!shouldThrow && actual)) { | |
2073 | throw actual; | |
2074 | } | |
2075 | } | |
2076 | ||
2077 | // 11. Expected to throw an error: | |
2078 | // assert.throws(block, Error_opt, message_opt); | |
2079 | ||
2080 | assert.throws = function(block, /*optional*/error, /*optional*/message) { | |
2081 | _throws.apply(this, [true].concat(pSlice.call(arguments))); | |
2082 | }; | |
2083 | ||
2084 | // EXTENSION! This is annoying to write outside this module. | |
2085 | assert.doesNotThrow = function(block, /*optional*/message) { | |
2086 | _throws.apply(this, [false].concat(pSlice.call(arguments))); | |
2087 | }; | |
2088 | ||
2089 | assert.ifError = function(err) { if (err) {throw err;}}; | |
2090 | ||
2091 | var objectKeys = Object.keys || function (obj) { | |
2092 | var keys = []; | |
2093 | for (var key in obj) { | |
2094 | if (hasOwn.call(obj, key)) keys.push(key); | |
2095 | } | |
2096 | return keys; | |
2097 | }; | |
2098 | ||
2099 | },{"util/":6}],5:[function(_dereq_,module,exports){ | |
2100 | module.exports = function isBuffer(arg) { | |
2101 | return arg && typeof arg === 'object' | |
2102 | && typeof arg.copy === 'function' | |
2103 | && typeof arg.fill === 'function' | |
2104 | && typeof arg.readUInt8 === 'function'; | |
2105 | } | |
2106 | },{}],6:[function(_dereq_,module,exports){ | |
2107 | (function (process,global){ | |
2108 | // Copyright Joyent, Inc. and other Node contributors. | |
2109 | // | |
2110 | // Permission is hereby granted, free of charge, to any person obtaining a | |
2111 | // copy of this software and associated documentation files (the | |
2112 | // "Software"), to deal in the Software without restriction, including | |
2113 | // without limitation the rights to use, copy, modify, merge, publish, | |
2114 | // distribute, sublicense, and/or sell copies of the Software, and to permit | |
2115 | // persons to whom the Software is furnished to do so, subject to the | |
2116 | // following conditions: | |
2117 | // | |
2118 | // The above copyright notice and this permission notice shall be included | |
2119 | // in all copies or substantial portions of the Software. | |
2120 | // | |
2121 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
2122 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
2123 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | |
2124 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | |
2125 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | |
2126 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | |
2127 | // USE OR OTHER DEALINGS IN THE SOFTWARE. | |
2128 | ||
2129 | var formatRegExp = /%[sdj%]/g; | |
2130 | exports.format = function(f) { | |
2131 | if (!isString(f)) { | |
2132 | var objects = []; | |
2133 | for (var i = 0; i < arguments.length; i++) { | |
2134 | objects.push(inspect(arguments[i])); | |
2135 | } | |
2136 | return objects.join(' '); | |
2137 | } | |
2138 | ||
2139 | var i = 1; | |
2140 | var args = arguments; | |
2141 | var len = args.length; | |
2142 | var str = String(f).replace(formatRegExp, function(x) { | |
2143 | if (x === '%%') return '%'; | |
2144 | if (i >= len) return x; | |
2145 | switch (x) { | |
2146 | case '%s': return String(args[i++]); | |
2147 | case '%d': return Number(args[i++]); | |
2148 | case '%j': | |
2149 | try { | |
2150 | return JSON.stringify(args[i++]); | |
2151 | } catch (_) { | |
2152 | return '[Circular]'; | |
2153 | } | |
2154 | default: | |
2155 | return x; | |
2156 | } | |
2157 | }); | |
2158 | for (var x = args[i]; i < len; x = args[++i]) { | |
2159 | if (isNull(x) || !isObject(x)) { | |
2160 | str += ' ' + x; | |
2161 | } else { | |
2162 | str += ' ' + inspect(x); | |
2163 | } | |
2164 | } | |
2165 | return str; | |
2166 | }; | |
2167 | ||
2168 | ||
2169 | // Mark that a method should not be used. | |
2170 | // Returns a modified function which warns once by default. | |
2171 | // If --no-deprecation is set, then it is a no-op. | |
2172 | exports.deprecate = function(fn, msg) { | |
2173 | // Allow for deprecating things in the process of starting up. | |
2174 | if (isUndefined(global.process)) { | |
2175 | return function() { | |
2176 | return exports.deprecate(fn, msg).apply(this, arguments); | |
2177 | }; | |
2178 | } | |
2179 | ||
2180 | if (process.noDeprecation === true) { | |
2181 | return fn; | |
2182 | } | |
2183 | ||
2184 | var warned = false; | |
2185 | function deprecated() { | |
2186 | if (!warned) { | |
2187 | if (process.throwDeprecation) { | |
2188 | throw new Error(msg); | |
2189 | } else if (process.traceDeprecation) { | |
2190 | console.trace(msg); | |
2191 | } else { | |
2192 | console.error(msg); | |
2193 | } | |
2194 | warned = true; | |
2195 | } | |
2196 | return fn.apply(this, arguments); | |
2197 | } | |
2198 | ||
2199 | return deprecated; | |
2200 | }; | |
2201 | ||
2202 | ||
2203 | var debugs = {}; | |
2204 | var debugEnviron; | |
2205 | exports.debuglog = function(set) { | |
2206 | if (isUndefined(debugEnviron)) | |
2207 | debugEnviron = process.env.NODE_DEBUG || ''; | |
2208 | set = set.toUpperCase(); | |
2209 | if (!debugs[set]) { | |
2210 | if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { | |
2211 | var pid = process.pid; | |
2212 | debugs[set] = function() { | |
2213 | var msg = exports.format.apply(exports, arguments); | |
2214 | console.error('%s %d: %s', set, pid, msg); | |
2215 | }; | |
2216 | } else { | |
2217 | debugs[set] = function() {}; | |
2218 | } | |
2219 | } | |
2220 | return debugs[set]; | |
2221 | }; | |
2222 | ||
2223 | ||
2224 | /** | |
2225 | * Echos the value of a value. Trys to print the value out | |
2226 | * in the best way possible given the different types. | |
2227 | * | |
2228 | * @param {Object} obj The object to print out. | |
2229 | * @param {Object} opts Optional options object that alters the output. | |
2230 | */ | |
2231 | /* legacy: obj, showHidden, depth, colors*/ | |
2232 | function inspect(obj, opts) { | |
2233 | // default options | |
2234 | var ctx = { | |
2235 | seen: [], | |
2236 | stylize: stylizeNoColor | |
2237 | }; | |
2238 | // legacy... | |
2239 | if (arguments.length >= 3) ctx.depth = arguments[2]; | |
2240 | if (arguments.length >= 4) ctx.colors = arguments[3]; | |
2241 | if (isBoolean(opts)) { | |
2242 | // legacy... | |
2243 | ctx.showHidden = opts; | |
2244 | } else if (opts) { | |
2245 | // got an "options" object | |
2246 | exports._extend(ctx, opts); | |
2247 | } | |
2248 | // set default options | |
2249 | if (isUndefined(ctx.showHidden)) ctx.showHidden = false; | |
2250 | if (isUndefined(ctx.depth)) ctx.depth = 2; | |
2251 | if (isUndefined(ctx.colors)) ctx.colors = false; | |
2252 | if (isUndefined(ctx.customInspect)) ctx.customInspect = true; | |
2253 | if (ctx.colors) ctx.stylize = stylizeWithColor; | |
2254 | return formatValue(ctx, obj, ctx.depth); | |
2255 | } | |
2256 | exports.inspect = inspect; | |
2257 | ||
2258 | ||
2259 | // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics | |
2260 | inspect.colors = { | |
2261 | 'bold' : [1, 22], | |
2262 | 'italic' : [3, 23], | |
2263 | 'underline' : [4, 24], | |
2264 | 'inverse' : [7, 27], | |
2265 | 'white' : [37, 39], | |
2266 | 'grey' : [90, 39], | |
2267 | 'black' : [30, 39], | |
2268 | 'blue' : [34, 39], | |
2269 | 'cyan' : [36, 39], | |
2270 | 'green' : [32, 39], | |
2271 | 'magenta' : [35, 39], | |
2272 | 'red' : [31, 39], | |
2273 | 'yellow' : [33, 39] | |
2274 | }; | |
2275 | ||
2276 | // Don't use 'blue' not visible on cmd.exe | |
2277 | inspect.styles = { | |
2278 | 'special': 'cyan', | |
2279 | 'number': 'yellow', | |
2280 | 'boolean': 'yellow', | |
2281 | 'undefined': 'grey', | |
2282 | 'null': 'bold', | |
2283 | 'string': 'green', | |
2284 | 'date': 'magenta', | |
2285 | // "name": intentionally not styling | |
2286 | 'regexp': 'red' | |
2287 | }; | |
2288 | ||
2289 | ||
2290 | function stylizeWithColor(str, styleType) { | |
2291 | var style = inspect.styles[styleType]; | |
2292 | ||
2293 | if (style) { | |
2294 | return '\u001b[' + inspect.colors[style][0] + 'm' + str + | |
2295 | '\u001b[' + inspect.colors[style][1] + 'm'; | |
2296 | } else { | |
2297 | return str; | |
2298 | } | |
2299 | } | |
2300 | ||
2301 | ||
2302 | function stylizeNoColor(str, styleType) { | |
2303 | return str; | |
2304 | } | |
2305 | ||
2306 | ||
2307 | function arrayToHash(array) { | |
2308 | var hash = {}; | |
2309 | ||
2310 | array.forEach(function(val, idx) { | |
2311 | hash[val] = true; | |
2312 | }); | |
2313 | ||
2314 | return hash; | |
2315 | } | |
2316 | ||
2317 | ||
2318 | function formatValue(ctx, value, recurseTimes) { | |
2319 | // Provide a hook for user-specified inspect functions. | |
2320 | // Check that value is an object with an inspect function on it | |
2321 | if (ctx.customInspect && | |
2322 | value && | |
2323 | isFunction(value.inspect) && | |
2324 | // Filter out the util module, it's inspect function is special | |
2325 | value.inspect !== exports.inspect && | |
2326 | // Also filter out any prototype objects using the circular check. | |
2327 | !(value.constructor && value.constructor.prototype === value)) { | |
2328 | var ret = value.inspect(recurseTimes, ctx); | |
2329 | if (!isString(ret)) { | |
2330 | ret = formatValue(ctx, ret, recurseTimes); | |
2331 | } | |
2332 | return ret; | |
2333 | } | |
2334 | ||
2335 | // Primitive types cannot have properties | |
2336 | var primitive = formatPrimitive(ctx, value); | |
2337 | if (primitive) { | |
2338 | return primitive; | |
2339 | } | |
2340 | ||
2341 | // Look up the keys of the object. | |
2342 | var keys = Object.keys(value); | |
2343 | var visibleKeys = arrayToHash(keys); | |
2344 | ||
2345 | if (ctx.showHidden) { | |
2346 | keys = Object.getOwnPropertyNames(value); | |
2347 | } | |
2348 | ||
2349 | // IE doesn't make error fields non-enumerable | |
2350 | // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx | |
2351 | if (isError(value) | |
2352 | && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { | |
2353 | return formatError(value); | |
2354 | } | |
2355 | ||
2356 | // Some type of object without properties can be shortcutted. | |
2357 | if (keys.length === 0) { | |
2358 | if (isFunction(value)) { | |
2359 | var name = value.name ? ': ' + value.name : ''; | |
2360 | return ctx.stylize('[Function' + name + ']', 'special'); | |
2361 | } | |
2362 | if (isRegExp(value)) { | |
2363 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); | |
2364 | } | |
2365 | if (isDate(value)) { | |
2366 | return ctx.stylize(Date.prototype.toString.call(value), 'date'); | |
2367 | } | |
2368 | if (isError(value)) { | |
2369 | return formatError(value); | |
2370 | } | |
2371 | } | |
2372 | ||
2373 | var base = '', array = false, braces = ['{', '}']; | |
2374 | ||
2375 | // Make Array say that they are Array | |
2376 | if (isArray(value)) { | |
2377 | array = true; | |
2378 | braces = ['[', ']']; | |
2379 | } | |
2380 | ||
2381 | // Make functions say that they are functions | |
2382 | if (isFunction(value)) { | |
2383 | var n = value.name ? ': ' + value.name : ''; | |
2384 | base = ' [Function' + n + ']'; | |
2385 | } | |
2386 | ||
2387 | // Make RegExps say that they are RegExps | |
2388 | if (isRegExp(value)) { | |
2389 | base = ' ' + RegExp.prototype.toString.call(value); | |
2390 | } | |
2391 | ||
2392 | // Make dates with properties first say the date | |
2393 | if (isDate(value)) { | |
2394 | base = ' ' + Date.prototype.toUTCString.call(value); | |
2395 | } | |
2396 | ||
2397 | // Make error with message first say the error | |
2398 | if (isError(value)) { | |
2399 | base = ' ' + formatError(value); | |
2400 | } | |
2401 | ||
2402 | if (keys.length === 0 && (!array || value.length == 0)) { | |
2403 | return braces[0] + base + braces[1]; | |
2404 | } | |
2405 | ||
2406 | if (recurseTimes < 0) { | |
2407 | if (isRegExp(value)) { | |
2408 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); | |
2409 | } else { | |
2410 | return ctx.stylize('[Object]', 'special'); | |
2411 | } | |
2412 | } | |
2413 | ||
2414 | ctx.seen.push(value); | |
2415 | ||
2416 | var output; | |
2417 | if (array) { | |
2418 | output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); | |
2419 | } else { | |
2420 | output = keys.map(function(key) { | |
2421 | return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); | |
2422 | }); | |
2423 | } | |
2424 | ||
2425 | ctx.seen.pop(); | |
2426 | ||
2427 | return reduceToSingleString(output, base, braces); | |
2428 | } | |
2429 | ||
2430 | ||
2431 | function formatPrimitive(ctx, value) { | |
2432 | if (isUndefined(value)) | |
2433 | return ctx.stylize('undefined', 'undefined'); | |
2434 | if (isString(value)) { | |
2435 | var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') | |
2436 | .replace(/'/g, "\\'") | |
2437 | .replace(/\\"/g, '"') + '\''; | |
2438 | return ctx.stylize(simple, 'string'); | |
2439 | } | |
2440 | if (isNumber(value)) | |
2441 | return ctx.stylize('' + value, 'number'); | |
2442 | if (isBoolean(value)) | |
2443 | return ctx.stylize('' + value, 'boolean'); | |
2444 | // For some reason typeof null is "object", so special case here. | |
2445 | if (isNull(value)) | |
2446 | return ctx.stylize('null', 'null'); | |
2447 | } | |
2448 | ||
2449 | ||
2450 | function formatError(value) { | |
2451 | return '[' + Error.prototype.toString.call(value) + ']'; | |
2452 | } | |
2453 | ||
2454 | ||
2455 | function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { | |
2456 | var output = []; | |
2457 | for (var i = 0, l = value.length; i < l; ++i) { | |
2458 | if (hasOwnProperty(value, String(i))) { | |
2459 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, | |
2460 | String(i), true)); | |
2461 | } else { | |
2462 | output.push(''); | |
2463 | } | |
2464 | } | |
2465 | keys.forEach(function(key) { | |
2466 | if (!key.match(/^\d+$/)) { | |
2467 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, | |
2468 | key, true)); | |
2469 | } | |
2470 | }); | |
2471 | return output; | |
2472 | } | |
2473 | ||
2474 | ||
2475 | function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { | |
2476 | var name, str, desc; | |
2477 | desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; | |
2478 | if (desc.get) { | |
2479 | if (desc.set) { | |
2480 | str = ctx.stylize('[Getter/Setter]', 'special'); | |
2481 | } else { | |
2482 | str = ctx.stylize('[Getter]', 'special'); | |
2483 | } | |
2484 | } else { | |
2485 | if (desc.set) { | |
2486 | str = ctx.stylize('[Setter]', 'special'); | |
2487 | } | |
2488 | } | |
2489 | if (!hasOwnProperty(visibleKeys, key)) { | |
2490 | name = '[' + key + ']'; | |
2491 | } | |
2492 | if (!str) { | |
2493 | if (ctx.seen.indexOf(desc.value) < 0) { | |
2494 | if (isNull(recurseTimes)) { | |
2495 | str = formatValue(ctx, desc.value, null); | |
2496 | } else { | |
2497 | str = formatValue(ctx, desc.value, recurseTimes - 1); | |
2498 | } | |
2499 | if (str.indexOf('\n') > -1) { | |
2500 | if (array) { | |
2501 | str = str.split('\n').map(function(line) { | |
2502 | return ' ' + line; | |
2503 | }).join('\n').substr(2); | |
2504 | } else { | |
2505 | str = '\n' + str.split('\n').map(function(line) { | |
2506 | return ' ' + line; | |
2507 | }).join('\n'); | |
2508 | } | |
2509 | } | |
2510 | } else { | |
2511 | str = ctx.stylize('[Circular]', 'special'); | |
2512 | } | |
2513 | } | |
2514 | if (isUndefined(name)) { | |
2515 | if (array && key.match(/^\d+$/)) { | |
2516 | return str; | |
2517 | } | |
2518 | name = JSON.stringify('' + key); | |
2519 | if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { | |
2520 | name = name.substr(1, name.length - 2); | |
2521 | name = ctx.stylize(name, 'name'); | |
2522 | } else { | |
2523 | name = name.replace(/'/g, "\\'") | |
2524 | .replace(/\\"/g, '"') | |
2525 | .replace(/(^"|"$)/g, "'"); | |
2526 | name = ctx.stylize(name, 'string'); | |
2527 | } | |
2528 | } | |
2529 | ||
2530 | return name + ': ' + str; | |
2531 | } | |
2532 | ||
2533 | ||
2534 | function reduceToSingleString(output, base, braces) { | |
2535 | var numLinesEst = 0; | |
2536 | var length = output.reduce(function(prev, cur) { | |
2537 | numLinesEst++; | |
2538 | if (cur.indexOf('\n') >= 0) numLinesEst++; | |
2539 | return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; | |
2540 | }, 0); | |
2541 | ||
2542 | if (length > 60) { | |
2543 | return braces[0] + | |
2544 | (base === '' ? '' : base + '\n ') + | |
2545 | ' ' + | |
2546 | output.join(',\n ') + | |
2547 | ' ' + | |
2548 | braces[1]; | |
2549 | } | |
2550 | ||
2551 | return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; | |
2552 | } | |
2553 | ||
2554 | ||
2555 | // NOTE: These type checking functions intentionally don't use `instanceof` | |
2556 | // because it is fragile and can be easily faked with `Object.create()`. | |
2557 | function isArray(ar) { | |
2558 | return Array.isArray(ar); | |
2559 | } | |
2560 | exports.isArray = isArray; | |
2561 | ||
2562 | function isBoolean(arg) { | |
2563 | return typeof arg === 'boolean'; | |
2564 | } | |
2565 | exports.isBoolean = isBoolean; | |
2566 | ||
2567 | function isNull(arg) { | |
2568 | return arg === null; | |
2569 | } | |
2570 | exports.isNull = isNull; | |
2571 | ||
2572 | function isNullOrUndefined(arg) { | |
2573 | return arg == null; | |
2574 | } | |
2575 | exports.isNullOrUndefined = isNullOrUndefined; | |
2576 | ||
2577 | function isNumber(arg) { | |
2578 | return typeof arg === 'number'; | |
2579 | } | |
2580 | exports.isNumber = isNumber; | |
2581 | ||
2582 | function isString(arg) { | |
2583 | return typeof arg === 'string'; | |
2584 | } | |
2585 | exports.isString = isString; | |
2586 | ||
2587 | function isSymbol(arg) { | |
2588 | return typeof arg === 'symbol'; | |
2589 | } | |
2590 | exports.isSymbol = isSymbol; | |
2591 | ||
2592 | function isUndefined(arg) { | |
2593 | return arg === void 0; | |
2594 | } | |
2595 | exports.isUndefined = isUndefined; | |
2596 | ||
2597 | function isRegExp(re) { | |
2598 | return isObject(re) && objectToString(re) === '[object RegExp]'; | |
2599 | } | |
2600 | exports.isRegExp = isRegExp; | |
2601 | ||
2602 | function isObject(arg) { | |
2603 | return typeof arg === 'object' && arg !== null; | |
2604 | } | |
2605 | exports.isObject = isObject; | |
2606 | ||
2607 | function isDate(d) { | |
2608 | return isObject(d) && objectToString(d) === '[object Date]'; | |
2609 | } | |
2610 | exports.isDate = isDate; | |
2611 | ||
2612 | function isError(e) { | |
2613 | return isObject(e) && | |
2614 | (objectToString(e) === '[object Error]' || e instanceof Error); | |
2615 | } | |
2616 | exports.isError = isError; | |
2617 | ||
2618 | function isFunction(arg) { | |
2619 | return typeof arg === 'function'; | |
2620 | } | |
2621 | exports.isFunction = isFunction; | |
2622 | ||
2623 | function isPrimitive(arg) { | |
2624 | return arg === null || | |
2625 | typeof arg === 'boolean' || | |
2626 | typeof arg === 'number' || | |
2627 | typeof arg === 'string' || | |
2628 | typeof arg === 'symbol' || // ES6 symbol | |
2629 | typeof arg === 'undefined'; | |
2630 | } | |
2631 | exports.isPrimitive = isPrimitive; | |
2632 | ||
2633 | exports.isBuffer = _dereq_('./support/isBuffer'); | |
2634 | ||
2635 | function objectToString(o) { | |
2636 | return Object.prototype.toString.call(o); | |
2637 | } | |
2638 | ||
2639 | ||
2640 | function pad(n) { | |
2641 | return n < 10 ? '0' + n.toString(10) : n.toString(10); | |
2642 | } | |
2643 | ||
2644 | ||
2645 | var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', | |
2646 | 'Oct', 'Nov', 'Dec']; | |
2647 | ||
2648 | // 26 Feb 16:19:34 | |
2649 | function timestamp() { | |
2650 | var d = new Date(); | |
2651 | var time = [pad(d.getHours()), | |
2652 | pad(d.getMinutes()), | |
2653 | pad(d.getSeconds())].join(':'); | |
2654 | return [d.getDate(), months[d.getMonth()], time].join(' '); | |
2655 | } | |
2656 | ||
2657 | ||
2658 | // log is just a thin wrapper to console.log that prepends a timestamp | |
2659 | exports.log = function() { | |
2660 | console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); | |
2661 | }; | |
2662 | ||
2663 | ||
2664 | /** | |
2665 | * Inherit the prototype methods from one constructor into another. | |
2666 | * | |
2667 | * The Function.prototype.inherits from lang.js rewritten as a standalone | |
2668 | * function (not on Function.prototype). NOTE: If this file is to be loaded | |
2669 | * during bootstrapping this function needs to be rewritten using some native | |
2670 | * functions as prototype setup using normal JavaScript does not work as | |
2671 | * expected during bootstrapping (see mirror.js in r114903). | |
2672 | * | |
2673 | * @param {function} ctor Constructor function which needs to inherit the | |
2674 | * prototype. | |
2675 | * @param {function} superCtor Constructor function to inherit prototype from. | |
2676 | */ | |
2677 | exports.inherits = _dereq_('inherits'); | |
2678 | ||
2679 | exports._extend = function(origin, add) { | |
2680 | // Don't do anything if add isn't an object | |
2681 | if (!add || !isObject(add)) return origin; | |
2682 | ||
2683 | var keys = Object.keys(add); | |
2684 | var i = keys.length; | |
2685 | while (i--) { | |
2686 | origin[keys[i]] = add[keys[i]]; | |
2687 | } | |
2688 | return origin; | |
2689 | }; | |
2690 | ||
2691 | function hasOwnProperty(obj, prop) { | |
2692 | return Object.prototype.hasOwnProperty.call(obj, prop); | |
2693 | } | |
2694 | ||
2695 | }).call(this,_dereq_("FWaASH"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | |
2696 | },{"./support/isBuffer":5,"FWaASH":12,"inherits":11}],7:[function(_dereq_,module,exports){ | |
2697 | ||
2698 | },{}],8:[function(_dereq_,module,exports){ | |
2699 | /*! | |
2700 | * The buffer module from node.js, for the browser. | |
2701 | * | |
2702 | * at author Feross Aboukhadijeh <feross@feross.org> <http://feross.org> | |
2703 | * at license MIT | |
2704 | */ | |
2705 | ||
2706 | var base64 = _dereq_('base64-js') | |
2707 | var ieee754 = _dereq_('ieee754') | |
2708 | ||
2709 | exports.Buffer = Buffer | |
2710 | exports.SlowBuffer = Buffer | |
2711 | exports.INSPECT_MAX_BYTES = 50 | |
2712 | Buffer.poolSize = 8192 | |
2713 | ||
2714 | /** | |
2715 | * If `Buffer._useTypedArrays`: | |
2716 | * === true Use Uint8Array implementation (fastest) | |
2717 | * === false Use Object implementation (compatible down to IE6) | |
2718 | */ | |
2719 | Buffer._useTypedArrays = (function () { | |
2720 | // Detect if browser supports Typed Arrays. Supported browsers are IE 10+, Firefox 4+, | |
2721 | // Chrome 7+, Safari 5.1+, Opera 11.6+, iOS 4.2+. If the browser does not support adding | |
2722 | // properties to `Uint8Array` instances, then that's the same as no `Uint8Array` support | |
2723 | // because we need to be able to add all the node Buffer API methods. This is an issue | |
2724 | // in Firefox 4-29. Now fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=695438 | |
2725 | try { | |
2726 | var buf = new ArrayBuffer(0) | |
2727 | var arr = new Uint8Array(buf) | |
2728 | arr.foo = function () { return 42 } | |
2729 | return 42 === arr.foo() && | |
2730 | typeof arr.subarray === 'function' // Chrome 9-10 lack `subarray` | |
2731 | } catch (e) { | |
2732 | return false | |
2733 | } | |
2734 | })() | |
2735 | ||
2736 | /** | |
2737 | * Class: Buffer | |
2738 | * ============= | |
2739 | * | |
2740 | * The Buffer constructor returns instances of `Uint8Array` that are augmented | |
2741 | * with function properties for all the node `Buffer` API functions. We use | |
2742 | * `Uint8Array` so that square bracket notation works as expected -- it returns | |
2743 | * a single octet. | |
2744 | * | |
2745 | * By augmenting the instances, we can avoid modifying the `Uint8Array` | |
2746 | * prototype. | |
2747 | */ | |
2748 | function Buffer (subject, encoding, noZero) { | |
2749 | if (!(this instanceof Buffer)) | |
2750 | return new Buffer(subject, encoding, noZero) | |
2751 | ||
2752 | var type = typeof subject | |
2753 | ||
2754 | if (encoding === 'base64' && type === 'string') { | |
2755 | subject = base64clean(subject) | |
2756 | } | |
2757 | ||
2758 | // Find the length | |
2759 | var length | |
2760 | if (type === 'number') | |
2761 | length = coerce(subject) | |
2762 | else if (type === 'string') | |
2763 | length = Buffer.byteLength(subject, encoding) | |
2764 | else if (type === 'object') | |
2765 | length = coerce(subject.length) // assume that object is array-like | |
2766 | else | |
2767 | throw new Error('First argument needs to be a number, array or string.') | |
2768 | ||
2769 | var buf | |
2770 | if (Buffer._useTypedArrays) { | |
2771 | // Preferred: Return an augmented `Uint8Array` instance for best performance | |
2772 | buf = Buffer._augment(new Uint8Array(length)) | |
2773 | } else { | |
2774 | // Fallback: Return THIS instance of Buffer (created by `new`) | |
2775 | buf = this | |
2776 | buf.length = length | |
2777 | buf._isBuffer = true | |
2778 | } | |
2779 | ||
2780 | var i | |
2781 | if (Buffer._useTypedArrays && typeof subject.byteLength === 'number') { | |
2782 | // Speed optimization -- use set if we're copying from a typed array | |
2783 | buf._set(subject) | |
2784 | } else if (isArrayish(subject)) { | |
2785 | // Treat array-ish objects as a byte array | |
2786 | if (Buffer.isBuffer(subject)) { | |
2787 | for (i = 0; i < length; i++) | |
2788 | buf[i] = subject.readUInt8(i) | |
2789 | } else { | |
2790 | for (i = 0; i < length; i++) | |
2791 | buf[i] = ((subject[i] % 256) + 256) % 256 | |
2792 | } | |
2793 | } else if (type === 'string') { | |
2794 | buf.write(subject, 0, encoding) | |
2795 | } else if (type === 'number' && !Buffer._useTypedArrays && !noZero) { | |
2796 | for (i = 0; i < length; i++) { | |
2797 | buf[i] = 0 | |
2798 | } | |
2799 | } | |
2800 | ||
2801 | return buf | |
2802 | } | |
2803 | ||
2804 | // STATIC METHODS | |
2805 | // ============== | |
2806 | ||
2807 | Buffer.isEncoding = function (encoding) { | |
2808 | switch (String(encoding).toLowerCase()) { | |
2809 | case 'hex': | |
2810 | case 'utf8': | |
2811 | case 'utf-8': | |
2812 | case 'ascii': | |
2813 | case 'binary': | |
2814 | case 'base64': | |
2815 | case 'raw': | |
2816 | case 'ucs2': | |
2817 | case 'ucs-2': | |
2818 | case 'utf16le': | |
2819 | case 'utf-16le': | |
2820 | return true | |
2821 | default: | |
2822 | return false | |
2823 | } | |
2824 | } | |
2825 | ||
2826 | Buffer.isBuffer = function (b) { | |
2827 | return !!(b !== null && b !== undefined && b._isBuffer) | |
2828 | } | |
2829 | ||
2830 | Buffer.byteLength = function (str, encoding) { | |
2831 | var ret | |
2832 | str = str.toString() | |
2833 | switch (encoding || 'utf8') { | |
2834 | case 'hex': | |
2835 | ret = str.length / 2 | |
2836 | break | |
2837 | case 'utf8': | |
2838 | case 'utf-8': | |
2839 | ret = utf8ToBytes(str).length | |
2840 | break | |
2841 | case 'ascii': | |
2842 | case 'binary': | |
2843 | case 'raw': | |
2844 | ret = str.length | |
2845 | break | |
2846 | case 'base64': | |
2847 | ret = base64ToBytes(str).length | |
2848 | break | |
2849 | case 'ucs2': | |
2850 | case 'ucs-2': | |
2851 | case 'utf16le': | |
2852 | case 'utf-16le': | |
2853 | ret = str.length * 2 | |
2854 | break | |
2855 | default: | |
2856 | throw new Error('Unknown encoding') | |
2857 | } | |
2858 | return ret | |
2859 | } | |
2860 | ||
2861 | Buffer.concat = function (list, totalLength) { | |
2862 | assert(isArray(list), 'Usage: Buffer.concat(list[, length])') | |
2863 | ||
2864 | if (list.length === 0) { | |
2865 | return new Buffer(0) | |
2866 | } else if (list.length === 1) { | |
2867 | return list[0] | |
2868 | } | |
2869 | ||
2870 | var i | |
2871 | if (totalLength === undefined) { | |
2872 | totalLength = 0 | |
2873 | for (i = 0; i < list.length; i++) { | |
2874 | totalLength += list[i].length | |
2875 | } | |
2876 | } | |
2877 | ||
2878 | var buf = new Buffer(totalLength) | |
2879 | var pos = 0 | |
2880 | for (i = 0; i < list.length; i++) { | |
2881 | var item = list[i] | |
2882 | item.copy(buf, pos) | |
2883 | pos += item.length | |
2884 | } | |
2885 | return buf | |
2886 | } | |
2887 | ||
2888 | Buffer.compare = function (a, b) { | |
2889 | assert(Buffer.isBuffer(a) && Buffer.isBuffer(b), 'Arguments must be Buffers') | |
2890 | var x = a.length | |
2891 | var y = b.length | |
2892 | for (var i = 0, len = Math.min(x, y); i < len && a[i] === b[i]; i++) {} | |
2893 | if (i !== len) { | |
2894 | x = a[i] | |
2895 | y = b[i] | |
2896 | } | |
2897 | if (x < y) { | |
2898 | return -1 | |
2899 | } | |
2900 | if (y < x) { | |
2901 | return 1 | |
2902 | } | |
2903 | return 0 | |
2904 | } | |
2905 | ||
2906 | // BUFFER INSTANCE METHODS | |
2907 | // ======================= | |
2908 | ||
2909 | function hexWrite (buf, string, offset, length) { | |
2910 | offset = Number(offset) || 0 | |
2911 | var remaining = buf.length - offset | |
2912 | if (!length) { | |
2913 | length = remaining | |
2914 | } else { | |
2915 | length = Number(length) | |
2916 | if (length > remaining) { | |
2917 | length = remaining | |
2918 | } | |
2919 | } | |
2920 | ||
2921 | // must be an even number of digits | |
2922 | var strLen = string.length | |
2923 | assert(strLen % 2 === 0, 'Invalid hex string') | |
2924 | ||
2925 | if (length > strLen / 2) { | |
2926 | length = strLen / 2 | |
2927 | } | |
2928 | for (var i = 0; i < length; i++) { | |
2929 | var byte = parseInt(string.substr(i * 2, 2), 16) | |
2930 | assert(!isNaN(byte), 'Invalid hex string') | |
2931 | buf[offset + i] = byte | |
2932 | } | |
2933 | return i | |
2934 | } | |
2935 | ||
2936 | function utf8Write (buf, string, offset, length) { | |
2937 | var charsWritten = blitBuffer(utf8ToBytes(string), buf, offset, length) | |
2938 | return charsWritten | |
2939 | } | |
2940 | ||
2941 | function asciiWrite (buf, string, offset, length) { | |
2942 | var charsWritten = blitBuffer(asciiToBytes(string), buf, offset, length) | |
2943 | return charsWritten | |
2944 | } | |
2945 | ||
2946 | function binaryWrite (buf, string, offset, length) { | |
2947 | return asciiWrite(buf, string, offset, length) | |
2948 | } | |
2949 | ||
2950 | function base64Write (buf, string, offset, length) { | |
2951 | var charsWritten = blitBuffer(base64ToBytes(string), buf, offset, length) | |
2952 | return charsWritten | |
2953 | } | |
2954 | ||
2955 | function utf16leWrite (buf, string, offset, length) { | |
2956 | var charsWritten = blitBuffer(utf16leToBytes(string), buf, offset, length) | |
2957 | return charsWritten | |
2958 | } | |
2959 | ||
2960 | Buffer.prototype.write = function (string, offset, length, encoding) { | |
2961 | // Support both (string, offset, length, encoding) | |
2962 | // and the legacy (string, encoding, offset, length) | |
2963 | if (isFinite(offset)) { | |
2964 | if (!isFinite(length)) { | |
2965 | encoding = length | |
2966 | length = undefined | |
2967 | } | |
2968 | } else { // legacy | |
2969 | var swap = encoding | |
2970 | encoding = offset | |
2971 | offset = length | |
2972 | length = swap | |
2973 | } | |
2974 | ||
2975 | offset = Number(offset) || 0 | |
2976 | var remaining = this.length - offset | |
2977 | if (!length) { | |
2978 | length = remaining | |
2979 | } else { | |
2980 | length = Number(length) | |
2981 | if (length > remaining) { | |
2982 | length = remaining | |
2983 | } | |
2984 | } | |
2985 | encoding = String(encoding || 'utf8').toLowerCase() | |
2986 | ||
2987 | var ret | |
2988 | switch (encoding) { | |
2989 | case 'hex': | |
2990 | ret = hexWrite(this, string, offset, length) | |
2991 | break | |
2992 | case 'utf8': | |
2993 | case 'utf-8': | |
2994 | ret = utf8Write(this, string, offset, length) | |
2995 | break | |
2996 | case 'ascii': | |
2997 | ret = asciiWrite(this, string, offset, length) | |
2998 | break | |
2999 | case 'binary': | |
3000 | ret = binaryWrite(this, string, offset, length) | |
3001 | break | |
3002 | case 'base64': | |
3003 | ret = base64Write(this, string, offset, length) | |
3004 | break | |
3005 | case 'ucs2': | |
3006 | case 'ucs-2': | |
3007 | case 'utf16le': | |
3008 | case 'utf-16le': | |
3009 | ret = utf16leWrite(this, string, offset, length) | |
3010 | break | |
3011 | default: | |
3012 | throw new Error('Unknown encoding') | |
3013 | } | |
3014 | return ret | |
3015 | } | |
3016 | ||
3017 | Buffer.prototype.toString = function (encoding, start, end) { | |
3018 | var self = this | |
3019 | ||
3020 | encoding = String(encoding || 'utf8').toLowerCase() | |
3021 | start = Number(start) || 0 | |
3022 | end = (end === undefined) ? self.length : Number(end) | |
3023 | ||
3024 | // Fastpath empty strings | |
3025 | if (end === start) | |
3026 | return '' | |
3027 | ||
3028 | var ret | |
3029 | switch (encoding) { | |
3030 | case 'hex': | |
3031 | ret = hexSlice(self, start, end) | |
3032 | break | |
3033 | case 'utf8': | |
3034 | case 'utf-8': | |
3035 | ret = utf8Slice(self, start, end) | |
3036 | break | |
3037 | case 'ascii': | |
3038 | ret = asciiSlice(self, start, end) | |
3039 | break | |
3040 | case 'binary': | |
3041 | ret = binarySlice(self, start, end) | |
3042 | break | |
3043 | case 'base64': | |
3044 | ret = base64Slice(self, start, end) | |
3045 | break | |
3046 | case 'ucs2': | |
3047 | case 'ucs-2': | |
3048 | case 'utf16le': | |
3049 | case 'utf-16le': | |
3050 | ret = utf16leSlice(self, start, end) | |
3051 | break | |
3052 | default: | |
3053 | throw new Error('Unknown encoding') | |
3054 | } | |
3055 | return ret | |
3056 | } | |
3057 | ||
3058 | Buffer.prototype.toJSON = function () { | |
3059 | return { | |
3060 | type: 'Buffer', | |
3061 | data: Array.prototype.slice.call(this._arr || this, 0) | |
3062 | } | |
3063 | } | |
3064 | ||
3065 | Buffer.prototype.equals = function (b) { | |
3066 | assert(Buffer.isBuffer(b), 'Argument must be a Buffer') | |
3067 | return Buffer.compare(this, b) === 0 | |
3068 | } | |
3069 | ||
3070 | Buffer.prototype.compare = function (b) { | |
3071 | assert(Buffer.isBuffer(b), 'Argument must be a Buffer') | |
3072 | return Buffer.compare(this, b) | |
3073 | } | |
3074 | ||
3075 | // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) | |
3076 | Buffer.prototype.copy = function (target, target_start, start, end) { | |
3077 | var source = this | |
3078 | ||
3079 | if (!start) start = 0 | |
3080 | if (!end && end !== 0) end = this.length | |
3081 | if (!target_start) target_start = 0 | |
3082 | ||
3083 | // Copy 0 bytes; we're done | |
3084 | if (end === start) return | |
3085 | if (target.length === 0 || source.length === 0) return | |
3086 | ||
3087 | // Fatal error conditions | |
3088 | assert(end >= start, 'sourceEnd < sourceStart') | |
3089 | assert(target_start >= 0 && target_start < target.length, | |
3090 | 'targetStart out of bounds') | |
3091 | assert(start >= 0 && start < source.length, 'sourceStart out of bounds') | |
3092 | assert(end >= 0 && end <= source.length, 'sourceEnd out of bounds') | |
3093 | ||
3094 | // Are we oob? | |
3095 | if (end > this.length) | |
3096 | end = this.length | |
3097 | if (target.length - target_start < end - start) | |
3098 | end = target.length - target_start + start | |
3099 | ||
3100 | var len = end - start | |
3101 | ||
3102 | if (len < 100 || !Buffer._useTypedArrays) { | |
3103 | for (var i = 0; i < len; i++) { | |
3104 | target[i + target_start] = this[i + start] | |
3105 | } | |
3106 | } else { | |
3107 | target._set(this.subarray(start, start + len), target_start) | |
3108 | } | |
3109 | } | |
3110 | ||
3111 | function base64Slice (buf, start, end) { | |
3112 | if (start === 0 && end === buf.length) { | |
3113 | return base64.fromByteArray(buf) | |
3114 | } else { | |
3115 | return base64.fromByteArray(buf.slice(start, end)) | |
3116 | } | |
3117 | } | |
3118 | ||
3119 | function utf8Slice (buf, start, end) { | |
3120 | var res = '' | |
3121 | var tmp = '' | |
3122 | end = Math.min(buf.length, end) | |
3123 | ||
3124 | for (var i = start; i < end; i++) { | |
3125 | if (buf[i] <= 0x7F) { | |
3126 | res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i]) | |
3127 | tmp = '' | |
3128 | } else { | |
3129 | tmp += '%' + buf[i].toString(16) | |
3130 | } | |
3131 | } | |
3132 | ||
3133 | return res + decodeUtf8Char(tmp) | |
3134 | } | |
3135 | ||
3136 | function asciiSlice (buf, start, end) { | |
3137 | var ret = '' | |
3138 | end = Math.min(buf.length, end) | |
3139 | ||
3140 | for (var i = start; i < end; i++) { | |
3141 | ret += String.fromCharCode(buf[i]) | |
3142 | } | |
3143 | return ret | |
3144 | } | |
3145 | ||
3146 | function binarySlice (buf, start, end) { | |
3147 | return asciiSlice(buf, start, end) | |
3148 | } | |
3149 | ||
3150 | function hexSlice (buf, start, end) { | |
3151 | var len = buf.length | |
3152 | ||
3153 | if (!start || start < 0) start = 0 | |
3154 | if (!end || end < 0 || end > len) end = len | |
3155 | ||
3156 | var out = '' | |
3157 | for (var i = start; i < end; i++) { | |
3158 | out += toHex(buf[i]) | |
3159 | } | |
3160 | return out | |
3161 | } | |
3162 | ||
3163 | function utf16leSlice (buf, start, end) { | |
3164 | var bytes = buf.slice(start, end) | |
3165 | var res = '' | |
3166 | for (var i = 0; i < bytes.length; i += 2) { | |
3167 | res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) | |
3168 | } | |
3169 | return res | |
3170 | } | |
3171 | ||
3172 | Buffer.prototype.slice = function (start, end) { | |
3173 | var len = this.length | |
3174 | start = clamp(start, len, 0) | |
3175 | end = clamp(end, len, len) | |
3176 | ||
3177 | if (Buffer._useTypedArrays) { | |
3178 | return Buffer._augment(this.subarray(start, end)) | |
3179 | } else { | |
3180 | var sliceLen = end - start | |
3181 | var newBuf = new Buffer(sliceLen, undefined, true) | |
3182 | for (var i = 0; i < sliceLen; i++) { | |
3183 | newBuf[i] = this[i + start] | |
3184 | } | |
3185 | return newBuf | |
3186 | } | |
3187 | } | |
3188 | ||
3189 | // `get` will be removed in Node 0.13+ | |
3190 | Buffer.prototype.get = function (offset) { | |
3191 | console.log('.get() is deprecated. Access using array indexes instead.') | |
3192 | return this.readUInt8(offset) | |
3193 | } | |
3194 | ||
3195 | // `set` will be removed in Node 0.13+ | |
3196 | Buffer.prototype.set = function (v, offset) { | |
3197 | console.log('.set() is deprecated. Access using array indexes instead.') | |
3198 | return this.writeUInt8(v, offset) | |
3199 | } | |
3200 | ||
3201 | Buffer.prototype.readUInt8 = function (offset, noAssert) { | |
3202 | if (!noAssert) { | |
3203 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3204 | assert(offset < this.length, 'Trying to read beyond buffer length') | |
3205 | } | |
3206 | ||
3207 | if (offset >= this.length) | |
3208 | return | |
3209 | ||
3210 | return this[offset] | |
3211 | } | |
3212 | ||
3213 | function readUInt16 (buf, offset, littleEndian, noAssert) { | |
3214 | if (!noAssert) { | |
3215 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3216 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3217 | assert(offset + 1 < buf.length, 'Trying to read beyond buffer length') | |
3218 | } | |
3219 | ||
3220 | var len = buf.length | |
3221 | if (offset >= len) | |
3222 | return | |
3223 | ||
3224 | var val | |
3225 | if (littleEndian) { | |
3226 | val = buf[offset] | |
3227 | if (offset + 1 < len) | |
3228 | val |= buf[offset + 1] << 8 | |
3229 | } else { | |
3230 | val = buf[offset] << 8 | |
3231 | if (offset + 1 < len) | |
3232 | val |= buf[offset + 1] | |
3233 | } | |
3234 | return val | |
3235 | } | |
3236 | ||
3237 | Buffer.prototype.readUInt16LE = function (offset, noAssert) { | |
3238 | return readUInt16(this, offset, true, noAssert) | |
3239 | } | |
3240 | ||
3241 | Buffer.prototype.readUInt16BE = function (offset, noAssert) { | |
3242 | return readUInt16(this, offset, false, noAssert) | |
3243 | } | |
3244 | ||
3245 | function readUInt32 (buf, offset, littleEndian, noAssert) { | |
3246 | if (!noAssert) { | |
3247 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3248 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3249 | assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') | |
3250 | } | |
3251 | ||
3252 | var len = buf.length | |
3253 | if (offset >= len) | |
3254 | return | |
3255 | ||
3256 | var val | |
3257 | if (littleEndian) { | |
3258 | if (offset + 2 < len) | |
3259 | val = buf[offset + 2] << 16 | |
3260 | if (offset + 1 < len) | |
3261 | val |= buf[offset + 1] << 8 | |
3262 | val |= buf[offset] | |
3263 | if (offset + 3 < len) | |
3264 | val = val + (buf[offset + 3] << 24 >>> 0) | |
3265 | } else { | |
3266 | if (offset + 1 < len) | |
3267 | val = buf[offset + 1] << 16 | |
3268 | if (offset + 2 < len) | |
3269 | val |= buf[offset + 2] << 8 | |
3270 | if (offset + 3 < len) | |
3271 | val |= buf[offset + 3] | |
3272 | val = val + (buf[offset] << 24 >>> 0) | |
3273 | } | |
3274 | return val | |
3275 | } | |
3276 | ||
3277 | Buffer.prototype.readUInt32LE = function (offset, noAssert) { | |
3278 | return readUInt32(this, offset, true, noAssert) | |
3279 | } | |
3280 | ||
3281 | Buffer.prototype.readUInt32BE = function (offset, noAssert) { | |
3282 | return readUInt32(this, offset, false, noAssert) | |
3283 | } | |
3284 | ||
3285 | Buffer.prototype.readInt8 = function (offset, noAssert) { | |
3286 | if (!noAssert) { | |
3287 | assert(offset !== undefined && offset !== null, | |
3288 | 'missing offset') | |
3289 | assert(offset < this.length, 'Trying to read beyond buffer length') | |
3290 | } | |
3291 | ||
3292 | if (offset >= this.length) | |
3293 | return | |
3294 | ||
3295 | var neg = this[offset] & 0x80 | |
3296 | if (neg) | |
3297 | return (0xff - this[offset] + 1) * -1 | |
3298 | else | |
3299 | return this[offset] | |
3300 | } | |
3301 | ||
3302 | function readInt16 (buf, offset, littleEndian, noAssert) { | |
3303 | if (!noAssert) { | |
3304 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3305 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3306 | assert(offset + 1 < buf.length, 'Trying to read beyond buffer length') | |
3307 | } | |
3308 | ||
3309 | var len = buf.length | |
3310 | if (offset >= len) | |
3311 | return | |
3312 | ||
3313 | var val = readUInt16(buf, offset, littleEndian, true) | |
3314 | var neg = val & 0x8000 | |
3315 | if (neg) | |
3316 | return (0xffff - val + 1) * -1 | |
3317 | else | |
3318 | return val | |
3319 | } | |
3320 | ||
3321 | Buffer.prototype.readInt16LE = function (offset, noAssert) { | |
3322 | return readInt16(this, offset, true, noAssert) | |
3323 | } | |
3324 | ||
3325 | Buffer.prototype.readInt16BE = function (offset, noAssert) { | |
3326 | return readInt16(this, offset, false, noAssert) | |
3327 | } | |
3328 | ||
3329 | function readInt32 (buf, offset, littleEndian, noAssert) { | |
3330 | if (!noAssert) { | |
3331 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3332 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3333 | assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') | |
3334 | } | |
3335 | ||
3336 | var len = buf.length | |
3337 | if (offset >= len) | |
3338 | return | |
3339 | ||
3340 | var val = readUInt32(buf, offset, littleEndian, true) | |
3341 | var neg = val & 0x80000000 | |
3342 | if (neg) | |
3343 | return (0xffffffff - val + 1) * -1 | |
3344 | else | |
3345 | return val | |
3346 | } | |
3347 | ||
3348 | Buffer.prototype.readInt32LE = function (offset, noAssert) { | |
3349 | return readInt32(this, offset, true, noAssert) | |
3350 | } | |
3351 | ||
3352 | Buffer.prototype.readInt32BE = function (offset, noAssert) { | |
3353 | return readInt32(this, offset, false, noAssert) | |
3354 | } | |
3355 | ||
3356 | function readFloat (buf, offset, littleEndian, noAssert) { | |
3357 | if (!noAssert) { | |
3358 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3359 | assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') | |
3360 | } | |
3361 | ||
3362 | return ieee754.read(buf, offset, littleEndian, 23, 4) | |
3363 | } | |
3364 | ||
3365 | Buffer.prototype.readFloatLE = function (offset, noAssert) { | |
3366 | return readFloat(this, offset, true, noAssert) | |
3367 | } | |
3368 | ||
3369 | Buffer.prototype.readFloatBE = function (offset, noAssert) { | |
3370 | return readFloat(this, offset, false, noAssert) | |
3371 | } | |
3372 | ||
3373 | function readDouble (buf, offset, littleEndian, noAssert) { | |
3374 | if (!noAssert) { | |
3375 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3376 | assert(offset + 7 < buf.length, 'Trying to read beyond buffer length') | |
3377 | } | |
3378 | ||
3379 | return ieee754.read(buf, offset, littleEndian, 52, 8) | |
3380 | } | |
3381 | ||
3382 | Buffer.prototype.readDoubleLE = function (offset, noAssert) { | |
3383 | return readDouble(this, offset, true, noAssert) | |
3384 | } | |
3385 | ||
3386 | Buffer.prototype.readDoubleBE = function (offset, noAssert) { | |
3387 | return readDouble(this, offset, false, noAssert) | |
3388 | } | |
3389 | ||
3390 | Buffer.prototype.writeUInt8 = function (value, offset, noAssert) { | |
3391 | if (!noAssert) { | |
3392 | assert(value !== undefined && value !== null, 'missing value') | |
3393 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3394 | assert(offset < this.length, 'trying to write beyond buffer length') | |
3395 | verifuint(value, 0xff) | |
3396 | } | |
3397 | ||
3398 | if (offset >= this.length) return | |
3399 | ||
3400 | this[offset] = value | |
3401 | return offset + 1 | |
3402 | } | |
3403 | ||
3404 | function writeUInt16 (buf, value, offset, littleEndian, noAssert) { | |
3405 | if (!noAssert) { | |
3406 | assert(value !== undefined && value !== null, 'missing value') | |
3407 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3408 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3409 | assert(offset + 1 < buf.length, 'trying to write beyond buffer length') | |
3410 | verifuint(value, 0xffff) | |
3411 | } | |
3412 | ||
3413 | var len = buf.length | |
3414 | if (offset >= len) | |
3415 | return | |
3416 | ||
3417 | for (var i = 0, j = Math.min(len - offset, 2); i < j; i++) { | |
3418 | buf[offset + i] = | |
3419 | (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> | |
3420 | (littleEndian ? i : 1 - i) * 8 | |
3421 | } | |
3422 | return offset + 2 | |
3423 | } | |
3424 | ||
3425 | Buffer.prototype.writeUInt16LE = function (value, offset, noAssert) { | |
3426 | return writeUInt16(this, value, offset, true, noAssert) | |
3427 | } | |
3428 | ||
3429 | Buffer.prototype.writeUInt16BE = function (value, offset, noAssert) { | |
3430 | return writeUInt16(this, value, offset, false, noAssert) | |
3431 | } | |
3432 | ||
3433 | function writeUInt32 (buf, value, offset, littleEndian, noAssert) { | |
3434 | if (!noAssert) { | |
3435 | assert(value !== undefined && value !== null, 'missing value') | |
3436 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3437 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3438 | assert(offset + 3 < buf.length, 'trying to write beyond buffer length') | |
3439 | verifuint(value, 0xffffffff) | |
3440 | } | |
3441 | ||
3442 | var len = buf.length | |
3443 | if (offset >= len) | |
3444 | return | |
3445 | ||
3446 | for (var i = 0, j = Math.min(len - offset, 4); i < j; i++) { | |
3447 | buf[offset + i] = | |
3448 | (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff | |
3449 | } | |
3450 | return offset + 4 | |
3451 | } | |
3452 | ||
3453 | Buffer.prototype.writeUInt32LE = function (value, offset, noAssert) { | |
3454 | return writeUInt32(this, value, offset, true, noAssert) | |
3455 | } | |
3456 | ||
3457 | Buffer.prototype.writeUInt32BE = function (value, offset, noAssert) { | |
3458 | return writeUInt32(this, value, offset, false, noAssert) | |
3459 | } | |
3460 | ||
3461 | Buffer.prototype.writeInt8 = function (value, offset, noAssert) { | |
3462 | if (!noAssert) { | |
3463 | assert(value !== undefined && value !== null, 'missing value') | |
3464 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3465 | assert(offset < this.length, 'Trying to write beyond buffer length') | |
3466 | verifsint(value, 0x7f, -0x80) | |
3467 | } | |
3468 | ||
3469 | if (offset >= this.length) | |
3470 | return | |
3471 | ||
3472 | if (value >= 0) | |
3473 | this.writeUInt8(value, offset, noAssert) | |
3474 | else | |
3475 | this.writeUInt8(0xff + value + 1, offset, noAssert) | |
3476 | return offset + 1 | |
3477 | } | |
3478 | ||
3479 | function writeInt16 (buf, value, offset, littleEndian, noAssert) { | |
3480 | if (!noAssert) { | |
3481 | assert(value !== undefined && value !== null, 'missing value') | |
3482 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3483 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3484 | assert(offset + 1 < buf.length, 'Trying to write beyond buffer length') | |
3485 | verifsint(value, 0x7fff, -0x8000) | |
3486 | } | |
3487 | ||
3488 | var len = buf.length | |
3489 | if (offset >= len) | |
3490 | return | |
3491 | ||
3492 | if (value >= 0) | |
3493 | writeUInt16(buf, value, offset, littleEndian, noAssert) | |
3494 | else | |
3495 | writeUInt16(buf, 0xffff + value + 1, offset, littleEndian, noAssert) | |
3496 | return offset + 2 | |
3497 | } | |
3498 | ||
3499 | Buffer.prototype.writeInt16LE = function (value, offset, noAssert) { | |
3500 | return writeInt16(this, value, offset, true, noAssert) | |
3501 | } | |
3502 | ||
3503 | Buffer.prototype.writeInt16BE = function (value, offset, noAssert) { | |
3504 | return writeInt16(this, value, offset, false, noAssert) | |
3505 | } | |
3506 | ||
3507 | function writeInt32 (buf, value, offset, littleEndian, noAssert) { | |
3508 | if (!noAssert) { | |
3509 | assert(value !== undefined && value !== null, 'missing value') | |
3510 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3511 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3512 | assert(offset + 3 < buf.length, 'Trying to write beyond buffer length') | |
3513 | verifsint(value, 0x7fffffff, -0x80000000) | |
3514 | } | |
3515 | ||
3516 | var len = buf.length | |
3517 | if (offset >= len) | |
3518 | return | |
3519 | ||
3520 | if (value >= 0) | |
3521 | writeUInt32(buf, value, offset, littleEndian, noAssert) | |
3522 | else | |
3523 | writeUInt32(buf, 0xffffffff + value + 1, offset, littleEndian, noAssert) | |
3524 | return offset + 4 | |
3525 | } | |
3526 | ||
3527 | Buffer.prototype.writeInt32LE = function (value, offset, noAssert) { | |
3528 | return writeInt32(this, value, offset, true, noAssert) | |
3529 | } | |
3530 | ||
3531 | Buffer.prototype.writeInt32BE = function (value, offset, noAssert) { | |
3532 | return writeInt32(this, value, offset, false, noAssert) | |
3533 | } | |
3534 | ||
3535 | function writeFloat (buf, value, offset, littleEndian, noAssert) { | |
3536 | if (!noAssert) { | |
3537 | assert(value !== undefined && value !== null, 'missing value') | |
3538 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3539 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3540 | assert(offset + 3 < buf.length, 'Trying to write beyond buffer length') | |
3541 | verifIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38) | |
3542 | } | |
3543 | ||
3544 | var len = buf.length | |
3545 | if (offset >= len) | |
3546 | return | |
3547 | ||
3548 | ieee754.write(buf, value, offset, littleEndian, 23, 4) | |
3549 | return offset + 4 | |
3550 | } | |
3551 | ||
3552 | Buffer.prototype.writeFloatLE = function (value, offset, noAssert) { | |
3553 | return writeFloat(this, value, offset, true, noAssert) | |
3554 | } | |
3555 | ||
3556 | Buffer.prototype.writeFloatBE = function (value, offset, noAssert) { | |
3557 | return writeFloat(this, value, offset, false, noAssert) | |
3558 | } | |
3559 | ||
3560 | function writeDouble (buf, value, offset, littleEndian, noAssert) { | |
3561 | if (!noAssert) { | |
3562 | assert(value !== undefined && value !== null, 'missing value') | |
3563 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3564 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3565 | assert(offset + 7 < buf.length, | |
3566 | 'Trying to write beyond buffer length') | |
3567 | verifIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308) | |
3568 | } | |
3569 | ||
3570 | var len = buf.length | |
3571 | if (offset >= len) | |
3572 | return | |
3573 | ||
3574 | ieee754.write(buf, value, offset, littleEndian, 52, 8) | |
3575 | return offset + 8 | |
3576 | } | |
3577 | ||
3578 | Buffer.prototype.writeDoubleLE = function (value, offset, noAssert) { | |
3579 | return writeDouble(this, value, offset, true, noAssert) | |
3580 | } | |
3581 | ||
3582 | Buffer.prototype.writeDoubleBE = function (value, offset, noAssert) { | |
3583 | return writeDouble(this, value, offset, false, noAssert) | |
3584 | } | |
3585 | ||
3586 | // fill(value, start=0, end=buffer.length) | |
3587 | Buffer.prototype.fill = function (value, start, end) { | |
3588 | if (!value) value = 0 | |
3589 | if (!start) start = 0 | |
3590 | if (!end) end = this.length | |
3591 | ||
3592 | assert(end >= start, 'end < start') | |
3593 | ||
3594 | // Fill 0 bytes; we're done | |
3595 | if (end === start) return | |
3596 | if (this.length === 0) return | |
3597 | ||
3598 | assert(start >= 0 && start < this.length, 'start out of bounds') | |
3599 | assert(end >= 0 && end <= this.length, 'end out of bounds') | |
3600 | ||
3601 | var i | |
3602 | if (typeof value === 'number') { | |
3603 | for (i = start; i < end; i++) { | |
3604 | this[i] = value | |
3605 | } | |
3606 | } else { | |
3607 | var bytes = utf8ToBytes(value.toString()) | |
3608 | var len = bytes.length | |
3609 | for (i = start; i < end; i++) { | |
3610 | this[i] = bytes[i % len] | |
3611 | } | |
3612 | } | |
3613 | ||
3614 | return this | |
3615 | } | |
3616 | ||
3617 | Buffer.prototype.inspect = function () { | |
3618 | var out = [] | |
3619 | var len = this.length | |
3620 | for (var i = 0; i < len; i++) { | |
3621 | out[i] = toHex(this[i]) | |
3622 | if (i === exports.INSPECT_MAX_BYTES) { | |
3623 | out[i + 1] = '...' | |
3624 | break | |
3625 | } | |
3626 | } | |
3627 | return '<Buffer ' + out.join(' ') + '>' | |
3628 | } | |
3629 | ||
3630 | /** | |
3631 | * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance. | |
3632 | * Added in Node 0.12. Only available in browsers that support ArrayBuffer. | |
3633 | */ | |
3634 | Buffer.prototype.toArrayBuffer = function () { | |
3635 | if (typeof Uint8Array !== 'undefined') { | |
3636 | if (Buffer._useTypedArrays) { | |
3637 | return (new Buffer(this)).buffer | |
3638 | } else { | |
3639 | var buf = new Uint8Array(this.length) | |
3640 | for (var i = 0, len = buf.length; i < len; i += 1) { | |
3641 | buf[i] = this[i] | |
3642 | } | |
3643 | return buf.buffer | |
3644 | } | |
3645 | } else { | |
3646 | throw new Error('Buffer.toArrayBuffer not supported in this browser') | |
3647 | } | |
3648 | } | |
3649 | ||
3650 | // HELPER FUNCTIONS | |
3651 | // ================ | |
3652 | ||
3653 | var BP = Buffer.prototype | |
3654 | ||
3655 | /** | |
3656 | * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods | |
3657 | */ | |
3658 | Buffer._augment = function (arr) { | |
3659 | arr._isBuffer = true | |
3660 | ||
3661 | // save reference to original Uint8Array get/set methods before overwriting | |
3662 | arr._get = arr.get | |
3663 | arr._set = arr.set | |
3664 | ||
3665 | // deprecated, will be removed in node 0.13+ | |
3666 | arr.get = BP.get | |
3667 | arr.set = BP.set | |
3668 | ||
3669 | arr.write = BP.write | |
3670 | arr.toString = BP.toString | |
3671 | arr.toLocaleString = BP.toString | |
3672 | arr.toJSON = BP.toJSON | |
3673 | arr.equals = BP.equals | |
3674 | arr.compare = BP.compare | |
3675 | arr.copy = BP.copy | |
3676 | arr.slice = BP.slice | |
3677 | arr.readUInt8 = BP.readUInt8 | |
3678 | arr.readUInt16LE = BP.readUInt16LE | |
3679 | arr.readUInt16BE = BP.readUInt16BE | |
3680 | arr.readUInt32LE = BP.readUInt32LE | |
3681 | arr.readUInt32BE = BP.readUInt32BE | |
3682 | arr.readInt8 = BP.readInt8 | |
3683 | arr.readInt16LE = BP.readInt16LE | |
3684 | arr.readInt16BE = BP.readInt16BE | |
3685 | arr.readInt32LE = BP.readInt32LE | |
3686 | arr.readInt32BE = BP.readInt32BE | |
3687 | arr.readFloatLE = BP.readFloatLE | |
3688 | arr.readFloatBE = BP.readFloatBE | |
3689 | arr.readDoubleLE = BP.readDoubleLE | |
3690 | arr.readDoubleBE = BP.readDoubleBE | |
3691 | arr.writeUInt8 = BP.writeUInt8 | |
3692 | arr.writeUInt16LE = BP.writeUInt16LE | |
3693 | arr.writeUInt16BE = BP.writeUInt16BE | |
3694 | arr.writeUInt32LE = BP.writeUInt32LE | |
3695 | arr.writeUInt32BE = BP.writeUInt32BE | |
3696 | arr.writeInt8 = BP.writeInt8 | |
3697 | arr.writeInt16LE = BP.writeInt16LE | |
3698 | arr.writeInt16BE = BP.writeInt16BE | |
3699 | arr.writeInt32LE = BP.writeInt32LE | |
3700 | arr.writeInt32BE = BP.writeInt32BE | |
3701 | arr.writeFloatLE = BP.writeFloatLE | |
3702 | arr.writeFloatBE = BP.writeFloatBE | |
3703 | arr.writeDoubleLE = BP.writeDoubleLE | |
3704 | arr.writeDoubleBE = BP.writeDoubleBE | |
3705 | arr.fill = BP.fill | |
3706 | arr.inspect = BP.inspect | |
3707 | arr.toArrayBuffer = BP.toArrayBuffer | |
3708 | ||
3709 | return arr | |
3710 | } | |
3711 | ||
3712 | var INVALID_BASE64_RE = /[^+\/0-9A-z]/g | |
3713 | ||
3714 | function base64clean (str) { | |
3715 | // Node strips out invalid characters like \n and \t from the string, base64-js does not | |
3716 | str = stringtrim(str).replace(INVALID_BASE64_RE, '') | |
3717 | // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not | |
3718 | while (str.length % 4 !== 0) { | |
3719 | str = str + '=' | |
3720 | } | |
3721 | return str | |
3722 | } | |
3723 | ||
3724 | function stringtrim (str) { | |
3725 | if (str.trim) return str.trim() | |
3726 | return str.replace(/^\s+|\s+$/g, '') | |
3727 | } | |
3728 | ||
3729 | // slice(start, end) | |
3730 | function clamp (index, len, defaultValue) { | |
3731 | if (typeof index !== 'number') return defaultValue | |
3732 | index = ~~index; // Coerce to integer. | |
3733 | if (index >= len) return len | |
3734 | if (index >= 0) return index | |
3735 | index += len | |
3736 | if (index >= 0) return index | |
3737 | return 0 | |
3738 | } | |
3739 | ||
3740 | function coerce (length) { | |
3741 | // Coerce length to a number (possibly NaN), round up | |
3742 | // in case it's fractional (e.g. 123.456) then do a | |
3743 | // double negate to coerce a NaN to 0. Easy, right? | |
3744 | length = ~~Math.ceil(+length) | |
3745 | return length < 0 ? 0 : length | |
3746 | } | |
3747 | ||
3748 | function isArray (subject) { | |
3749 | return (Array.isArray || function (subject) { | |
3750 | return Object.prototype.toString.call(subject) === '[object Array]' | |
3751 | })(subject) | |
3752 | } | |
3753 | ||
3754 | function isArrayish (subject) { | |
3755 | return isArray(subject) || Buffer.isBuffer(subject) || | |
3756 | subject && typeof subject === 'object' && | |
3757 | typeof subject.length === 'number' | |
3758 | } | |
3759 | ||
3760 | function toHex (n) { | |
3761 | if (n < 16) return '0' + n.toString(16) | |
3762 | return n.toString(16) | |
3763 | } | |
3764 | ||
3765 | function utf8ToBytes (str) { | |
3766 | var byteArray = [] | |
3767 | for (var i = 0; i < str.length; i++) { | |
3768 | var b = str.charCodeAt(i) | |
3769 | if (b <= 0x7F) { | |
3770 | byteArray.push(b) | |
3771 | } else { | |
3772 | var start = i | |
3773 | if (b >= 0xD800 && b <= 0xDFFF) i++ | |
3774 | var h = encodeURIComponent(str.slice(start, i+1)).substr(1).split('%') | |
3775 | for (var j = 0; j < h.length; j++) { | |
3776 | byteArray.push(parseInt(h[j], 16)) | |
3777 | } | |
3778 | } | |
3779 | } | |
3780 | return byteArray | |
3781 | } | |
3782 | ||
3783 | function asciiToBytes (str) { | |
3784 | var byteArray = [] | |
3785 | for (var i = 0; i < str.length; i++) { | |
3786 | // Node's code seems to be doing this and not & 0x7F.. | |
3787 | byteArray.push(str.charCodeAt(i) & 0xFF) | |
3788 | } | |
3789 | return byteArray | |
3790 | } | |
3791 | ||
3792 | function utf16leToBytes (str) { | |
3793 | var c, hi, lo | |
3794 | var byteArray = [] | |
3795 | for (var i = 0; i < str.length; i++) { | |
3796 | c = str.charCodeAt(i) | |
3797 | hi = c >> 8 | |
3798 | lo = c % 256 | |
3799 | byteArray.push(lo) | |
3800 | byteArray.push(hi) | |
3801 | } | |
3802 | ||
3803 | return byteArray | |
3804 | } | |
3805 | ||
3806 | function base64ToBytes (str) { | |
3807 | return base64.toByteArray(str) | |
3808 | } | |
3809 | ||
3810 | function blitBuffer (src, dst, offset, length) { | |
3811 | for (var i = 0; i < length; i++) { | |
3812 | if ((i + offset >= dst.length) || (i >= src.length)) | |
3813 | break | |
3814 | dst[i + offset] = src[i] | |
3815 | } | |
3816 | return i | |
3817 | } | |
3818 | ||
3819 | function decodeUtf8Char (str) { | |
3820 | try { | |
3821 | return decodeURIComponent(str) | |
3822 | } catch (err) { | |
3823 | return String.fromCharCode(0xFFFD) // UTF 8 invalid char | |
3824 | } | |
3825 | } | |
3826 | ||
3827 | /* | |
3828 | * We have to make sure that the value is a valid integer. This means that it | |
3829 | * is non-negative. It has no fractional component and that it does not | |
3830 | * exceed the maximum allowed value. | |
3831 | */ | |
3832 | function verifuint (value, max) { | |
3833 | assert(typeof value === 'number', 'cannot write a non-number as a number') | |
3834 | assert(value >= 0, 'specified a negative value for writing an unsigned value') | |
3835 | assert(value <= max, 'value is larger than maximum value for type') | |
3836 | assert(Math.floor(value) === value, 'value has a fractional component') | |
3837 | } | |
3838 | ||
3839 | function verifsint (value, max, min) { | |
3840 | assert(typeof value === 'number', 'cannot write a non-number as a number') | |
3841 | assert(value <= max, 'value larger than maximum allowed value') | |
3842 | assert(value >= min, 'value smaller than minimum allowed value') | |
3843 | assert(Math.floor(value) === value, 'value has a fractional component') | |
3844 | } | |
3845 | ||
3846 | function verifIEEE754 (value, max, min) { | |
3847 | assert(typeof value === 'number', 'cannot write a non-number as a number') | |
3848 | assert(value <= max, 'value larger than maximum allowed value') | |
3849 | assert(value >= min, 'value smaller than minimum allowed value') | |
3850 | } | |
3851 | ||
3852 | function assert (test, message) { | |
3853 | if (!test) throw new Error(message || 'Failed assertion') | |
3854 | } | |
3855 | ||
3856 | },{"base64-js":9,"ieee754":10}],9:[function(_dereq_,module,exports){ | |
3857 | var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; | |
3858 | ||
3859 | ;(function (exports) { | |
3860 | 'use strict'; | |
3861 | ||
3862 | var Arr = (typeof Uint8Array !== 'undefined') | |
3863 | ? Uint8Array | |
3864 | : Array | |
3865 | ||
3866 | var PLUS = '+'.charCodeAt(0) | |
3867 | var SLASH = '/'.charCodeAt(0) | |
3868 | var NUMBER = '0'.charCodeAt(0) | |
3869 | var LOWER = 'a'.charCodeAt(0) | |
3870 | var UPPER = 'A'.charCodeAt(0) | |
3871 | ||
3872 | function decode (elt) { | |
3873 | var code = elt.charCodeAt(0) | |
3874 | if (code === PLUS) | |
3875 | return 62 // '+' | |
3876 | if (code === SLASH) | |
3877 | return 63 // '/' | |
3878 | if (code < NUMBER) | |
3879 | return -1 //no match | |
3880 | if (code < NUMBER + 10) | |
3881 | return code - NUMBER + 26 + 26 | |
3882 | if (code < UPPER + 26) | |
3883 | return code - UPPER | |
3884 | if (code < LOWER + 26) | |
3885 | return code - LOWER + 26 | |
3886 | } | |
3887 | ||
3888 | function b64ToByteArray (b64) { | |
3889 | var i, j, l, tmp, placeHolders, arr | |
3890 | ||
3891 | if (b64.length % 4 > 0) { | |
3892 | throw new Error('Invalid string. Length must be a multiple of 4') | |
3893 | } | |
3894 | ||
3895 | // the number of equal signs (place holders) | |
3896 | // if there are two placeholders, than the two characters before it | |
3897 | // represent one byte | |
3898 | // if there is only one, then the three characters before it represent 2 bytes | |
3899 | // this is just a cheap hack to not do indexOf twice | |
3900 | var len = b64.length | |
3901 | placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0 | |
3902 | ||
3903 | // base64 is 4/3 + up to two characters of the original data | |
3904 | arr = new Arr(b64.length * 3 / 4 - placeHolders) | |
3905 | ||
3906 | // if there are placeholders, only get up to the last complete 4 chars | |
3907 | l = placeHolders > 0 ? b64.length - 4 : b64.length | |
3908 | ||
3909 | var L = 0 | |
3910 | ||
3911 | function push (v) { | |
3912 | arr[L++] = v | |
3913 | } | |
3914 | ||
3915 | for (i = 0, j = 0; i < l; i += 4, j += 3) { | |
3916 | tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3)) | |
3917 | push((tmp & 0xFF0000) >> 16) | |
3918 | push((tmp & 0xFF00) >> 8) | |
3919 | push(tmp & 0xFF) | |
3920 | } | |
3921 | ||
3922 | if (placeHolders === 2) { | |
3923 | tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4) | |
3924 | push(tmp & 0xFF) | |
3925 | } else if (placeHolders === 1) { | |
3926 | tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2) | |
3927 | push((tmp >> 8) & 0xFF) | |
3928 | push(tmp & 0xFF) | |
3929 | } | |
3930 | ||
3931 | return arr | |
3932 | } | |
3933 | ||
3934 | function uint8ToBase64 (uint8) { | |
3935 | var i, | |
3936 | extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes | |
3937 | output = "", | |
3938 | temp, length | |
3939 | ||
3940 | function encode (num) { | |
3941 | return lookup.charAt(num) | |
3942 | } | |
3943 | ||
3944 | function tripletToBase64 (num) { | |
3945 | return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F) | |
3946 | } | |
3947 | ||
3948 | // go through the array every three bytes, we'll deal with trailing stuff later | |
3949 | for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) { | |
3950 | temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) | |
3951 | output += tripletToBase64(temp) | |
3952 | } | |
3953 | ||
3954 | // pad the end with zeros, but make sure to not forget the extra bytes | |
3955 | switch (extraBytes) { | |
3956 | case 1: | |
3957 | temp = uint8[uint8.length - 1] | |
3958 | output += encode(temp >> 2) | |
3959 | output += encode((temp << 4) & 0x3F) | |
3960 | output += '==' | |
3961 | break | |
3962 | case 2: | |
3963 | temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1]) | |
3964 | output += encode(temp >> 10) | |
3965 | output += encode((temp >> 4) & 0x3F) | |
3966 | output += encode((temp << 2) & 0x3F) | |
3967 | output += '=' | |
3968 | break | |
3969 | } | |
3970 | ||
3971 | return output | |
3972 | } | |
3973 | ||
3974 | exports.toByteArray = b64ToByteArray | |
3975 | exports.fromByteArray = uint8ToBase64 | |
3976 | }(typeof exports === 'undefined' ? (this.base64js = {}) : exports)) | |
3977 | ||
3978 | },{}],10:[function(_dereq_,module,exports){ | |
3979 | exports.read = function(buffer, offset, isLE, mLen, nBytes) { | |
3980 | var e, m, | |
3981 | eLen = nBytes * 8 - mLen - 1, | |
3982 | eMax = (1 << eLen) - 1, | |
3983 | eBias = eMax >> 1, | |
3984 | nBits = -7, | |
3985 | i = isLE ? (nBytes - 1) : 0, | |
3986 | d = isLE ? -1 : 1, | |
3987 | s = buffer[offset + i]; | |
3988 | ||
3989 | i += d; | |
3990 | ||
3991 | e = s & ((1 << (-nBits)) - 1); | |
3992 | s >>= (-nBits); | |
3993 | nBits += eLen; | |
3994 | for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8){}; | |
3995 | ||
3996 | m = e & ((1 << (-nBits)) - 1); | |
3997 | e >>= (-nBits); | |
3998 | nBits += mLen; | |
3999 | for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8){}; | |
4000 | ||
4001 | if (e === 0) { | |
4002 | e = 1 - eBias; | |
4003 | } else if (e === eMax) { | |
4004 | return m ? NaN : ((s ? -1 : 1) * Infinity); | |
4005 | } else { | |
4006 | m = m + Math.pow(2, mLen); | |
4007 | e = e - eBias; | |
4008 | } | |
4009 | return (s ? -1 : 1) * m * Math.pow(2, e - mLen); | |
4010 | }; | |
4011 | ||
4012 | exports.write = function(buffer, value, offset, isLE, mLen, nBytes) { | |
4013 | var e, m, c, | |
4014 | eLen = nBytes * 8 - mLen - 1, | |
4015 | eMax = (1 << eLen) - 1, | |
4016 | eBias = eMax >> 1, | |
4017 | rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0), | |
4018 | i = isLE ? 0 : (nBytes - 1), | |
4019 | d = isLE ? 1 : -1, | |
4020 | s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; | |
4021 | ||
4022 | value = Math.abs(value); | |
4023 | ||
4024 | if (isNaN(value) || value === Infinity) { | |
4025 | m = isNaN(value) ? 1 : 0; | |
4026 | e = eMax; | |
4027 | } else { | |
4028 | e = Math.floor(Math.log(value) / Math.LN2); | |
4029 | if (value * (c = Math.pow(2, -e)) < 1) { | |
4030 | e--; | |
4031 | c *= 2; | |
4032 | } | |
4033 | if (e + eBias >= 1) { | |
4034 | value += rt / c; | |
4035 | } else { | |
4036 | value += rt * Math.pow(2, 1 - eBias); | |
4037 | } | |
4038 | if (value * c >= 2) { | |
4039 | e++; | |
4040 | c /= 2; | |
4041 | } | |
4042 | ||
4043 | if (e + eBias >= eMax) { | |
4044 | m = 0; | |
4045 | e = eMax; | |
4046 | } else if (e + eBias >= 1) { | |
4047 | m = (value * c - 1) * Math.pow(2, mLen); | |
4048 | e = e + eBias; | |
4049 | } else { | |
4050 | m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); | |
4051 | e = 0; | |
4052 | } | |
4053 | } | |
4054 | ||
4055 | for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8){}; | |
4056 | ||
4057 | e = (e << mLen) | m; | |
4058 | eLen += mLen; | |
4059 | for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8){}; | |
4060 | ||
4061 | buffer[offset + i - d] |= s * 128; | |
4062 | }; | |
4063 | ||
4064 | },{}],11:[function(_dereq_,module,exports){ | |
4065 | if (typeof Object.create === 'function') { | |
4066 | // implementation from standard node.js 'util' module | |
4067 | module.exports = function inherits(ctor, superCtor) { | |
4068 | ctor.super_ = superCtor | |
4069 | ctor.prototype = Object.create(superCtor.prototype, { | |
4070 | constructor: { | |
4071 | value: ctor, | |
4072 | enumerable: false, | |
4073 | writable: true, | |
4074 | configurable: true | |
4075 | } | |
4076 | }); | |
4077 | }; | |
4078 | } else { | |
4079 | // old school shim for old browsers | |
4080 | module.exports = function inherits(ctor, superCtor) { | |
4081 | ctor.super_ = superCtor | |
4082 | var TempCtor = function () {} | |
4083 | TempCtor.prototype = superCtor.prototype | |
4084 | ctor.prototype = new TempCtor() | |
4085 | ctor.prototype.constructor = ctor | |
4086 | } | |
4087 | } | |
4088 | ||
4089 | },{}],12:[function(_dereq_,module,exports){ | |
4090 | // shim for using process in browser | |
4091 | ||
4092 | var process = module.exports = {}; | |
4093 | ||
4094 | process.nextTick = (function () { | |
4095 | var canSetImmediate = typeof window !== 'undefined' | |
4096 | && window.setImmediate; | |
4097 | var canPost = typeof window !== 'undefined' | |
4098 | && window.postMessage && window.addEventListener | |
4099 | ; | |
4100 | ||
4101 | if (canSetImmediate) { | |
4102 | return function (f) { return window.setImmediate(f) }; | |
4103 | } | |
4104 | ||
4105 | if (canPost) { | |
4106 | var queue = []; | |
4107 | window.addEventListener('message', function (ev) { | |
4108 | var source = ev.source; | |
4109 | if ((source === window || source === null) && ev.data === 'process-tick') { | |
4110 | ev.stopPropagation(); | |
4111 | if (queue.length > 0) { | |
4112 | var fn = queue.shift(); | |
4113 | fn(); | |
4114 | } | |
4115 | } | |
4116 | }, true); | |
4117 | ||
4118 | return function nextTick(fn) { | |
4119 | queue.push(fn); | |
4120 | window.postMessage('process-tick', '*'); | |
4121 | }; | |
4122 | } | |
4123 | ||
4124 | return function nextTick(fn) { | |
4125 | setTimeout(fn, 0); | |
4126 | }; | |
4127 | })(); | |
4128 | ||
4129 | process.title = 'browser'; | |
4130 | process.browser = true; | |
4131 | process.env = {}; | |
4132 | process.argv = []; | |
4133 | ||
4134 | function noop() {} | |
4135 | ||
4136 | process.on = noop; | |
4137 | process.addListener = noop; | |
4138 | process.once = noop; | |
4139 | process.off = noop; | |
4140 | process.removeListener = noop; | |
4141 | process.removeAllListeners = noop; | |
4142 | process.emit = noop; | |
4143 | ||
4144 | process.binding = function (name) { | |
4145 | throw new Error('process.binding is not supported'); | |
4146 | } | |
4147 | ||
4148 | // TODO(shtylman) | |
4149 | process.cwd = function () { return '/' }; | |
4150 | process.chdir = function (dir) { | |
4151 | throw new Error('process.chdir is not supported'); | |
4152 | }; | |
4153 | ||
4154 | },{}],13:[function(_dereq_,module,exports){ | |
4155 | module.exports=_dereq_(5) | |
4156 | },{}],14:[function(_dereq_,module,exports){ | |
4157 | module.exports=_dereq_(6) | |
4158 | },{"./support/isBuffer":13,"FWaASH":12,"inherits":11}],15:[function(_dereq_,module,exports){ | |
4159 | (function (Buffer){ | |
4160 | // Base58 encoding/decoding | |
4161 | // Originally written by Mike Hearn for BitcoinJ | |
4162 | // Copyright (c) 2011 Google Inc | |
4163 | // Ported to JavaScript by Stefan Thomas | |
4164 | // Merged Buffer refactorings from base58-native by Stephen Pair | |
4165 | // Copyright (c) 2013 BitPay Inc | |
4166 | ||
4167 | var assert = _dereq_('assert') | |
4168 | var BigInteger = _dereq_('bigi') | |
4169 | ||
4170 | var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' | |
4171 | var ALPHABET_BUF = new Buffer(ALPHABET, 'ascii') | |
4172 | var ALPHABET_MAP = {} | |
4173 | for(var i = 0; i < ALPHABET.length; i++) { | |
4174 | ALPHABET_MAP[ALPHABET.charAt(i)] = BigInteger.valueOf(i) | |
4175 | } | |
4176 | var BASE = new BigInteger('58') | |
4177 | ||
4178 | function encode(buffer) { | |
4179 | var bi = BigInteger.fromBuffer(buffer) | |
4180 | var result = new Buffer(buffer.length << 1) | |
4181 | ||
4182 | var i = result.length - 1 | |
4183 | while (bi.signum() > 0) { | |
4184 | var remainder = bi.mod(BASE) | |
4185 | bi = bi.divide(BASE) | |
4186 | ||
4187 | result[i] = ALPHABET_BUF[remainder.intValue()] | |
4188 | i-- | |
4189 | } | |
4190 | ||
4191 | // deal with leading zeros | |
4192 | var j = 0 | |
4193 | while (buffer[j] === 0) { | |
4194 | result[i] = ALPHABET_BUF[0] | |
4195 | j++ | |
4196 | i-- | |
4197 | } | |
4198 | ||
4199 | return result.slice(i + 1, result.length).toString('ascii') | |
4200 | } | |
4201 | ||
4202 | function decode(string) { | |
4203 | if (string.length === 0) return new Buffer(0) | |
4204 | ||
4205 | var num = BigInteger.ZERO | |
4206 | ||
4207 | for (var i = 0; i < string.length; i++) { | |
4208 | num = num.multiply(BASE) | |
4209 | ||
4210 | var figure = ALPHABET_MAP[string.charAt(i)] | |
4211 | assert.notEqual(figure, undefined, 'Non-base58 character') | |
4212 | ||
4213 | num = num.add(figure) | |
4214 | } | |
4215 | ||
4216 | // deal with leading zeros | |
4217 | var j = 0 | |
4218 | while ((j < string.length) && (string[j] === ALPHABET[0])) { | |
4219 | j++ | |
4220 | } | |
4221 | ||
4222 | var buffer = num.toBuffer() | |
4223 | var leadingZeros = new Buffer(j) | |
4224 | leadingZeros.fill(0) | |
4225 | ||
4226 | return Buffer.concat([leadingZeros, buffer]) | |
4227 | } | |
4228 | ||
4229 | module.exports = { | |
4230 | encode: encode, | |
4231 | decode: decode | |
4232 | } | |
4233 | ||
4234 | }).call(this,_dereq_("buffer").Buffer) | |
4235 | },{"assert":4,"bigi":3,"buffer":8}],16:[function(_dereq_,module,exports){ | |
4236 | (function (Buffer){ | |
4237 | var createHash = _dereq_('sha.js') | |
4238 | ||
4239 | var md5 = toConstructor(_dereq_('./md5')) | |
4240 | var rmd160 = toConstructor(_dereq_('ripemd160')) | |
4241 | ||
4242 | function toConstructor (fn) { | |
4243 | return function () { | |
4244 | var buffers = [] | |
4245 | var m= { | |
4246 | update: function (data, enc) { | |
4247 | if(!Buffer.isBuffer(data)) data = new Buffer(data, enc) | |
4248 | buffers.push(data) | |
4249 | return this | |
4250 | }, | |
4251 | digest: function (enc) { | |
4252 | var buf = Buffer.concat(buffers) | |
4253 | var r = fn(buf) | |
4254 | buffers = null | |
4255 | return enc ? r.toString(enc) : r | |
4256 | } | |
4257 | } | |
4258 | return m | |
4259 | } | |
4260 | } | |
4261 | ||
4262 | module.exports = function (alg) { | |
4263 | if('md5' === alg) return new md5() | |
4264 | if('rmd160' === alg) return new rmd160() | |
4265 | return createHash(alg) | |
4266 | } | |
4267 | ||
4268 | }).call(this,_dereq_("buffer").Buffer) | |
4269 | },{"./md5":20,"buffer":8,"ripemd160":21,"sha.js":23}],17:[function(_dereq_,module,exports){ | |
4270 | (function (Buffer){ | |
4271 | var createHash = _dereq_('./create-hash') | |
4272 | ||
4273 | var blocksize = 64 | |
4274 | var zeroBuffer = new Buffer(blocksize); zeroBuffer.fill(0) | |
4275 | ||
4276 | module.exports = Hmac | |
4277 | ||
4278 | function Hmac (alg, key) { | |
4279 | if(!(this instanceof Hmac)) return new Hmac(alg, key) | |
4280 | this._opad = opad | |
4281 | this._alg = alg | |
4282 | ||
4283 | key = this._key = !Buffer.isBuffer(key) ? new Buffer(key) : key | |
4284 | ||
4285 | if(key.length > blocksize) { | |
4286 | key = createHash(alg).update(key).digest() | |
4287 | } else if(key.length < blocksize) { | |
4288 | key = Buffer.concat([key, zeroBuffer], blocksize) | |
4289 | } | |
4290 | ||
4291 | var ipad = this._ipad = new Buffer(blocksize) | |
4292 | var opad = this._opad = new Buffer(blocksize) | |
4293 | ||
4294 | for(var i = 0; i < blocksize; i++) { | |
4295 | ipad[i] = key[i] ^ 0x36 | |
4296 | opad[i] = key[i] ^ 0x5C | |
4297 | } | |
4298 | ||
4299 | this._hash = createHash(alg).update(ipad) | |
4300 | } | |
4301 | ||
4302 | Hmac.prototype.update = function (data, enc) { | |
4303 | this._hash.update(data, enc) | |
4304 | return this | |
4305 | } | |
4306 | ||
4307 | Hmac.prototype.digest = function (enc) { | |
4308 | var h = this._hash.digest() | |
4309 | return createHash(this._alg).update(this._opad).update(h).digest(enc) | |
4310 | } | |
4311 | ||
4312 | ||
4313 | }).call(this,_dereq_("buffer").Buffer) | |
4314 | },{"./create-hash":16,"buffer":8}],18:[function(_dereq_,module,exports){ | |
4315 | (function (Buffer){ | |
4316 | var intSize = 4; | |
4317 | var zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0); | |
4318 | var chrsz = 8; | |
4319 | ||
4320 | function toArray(buf, bigEndian) { | |
4321 | if ((buf.length % intSize) !== 0) { | |
4322 | var len = buf.length + (intSize - (buf.length % intSize)); | |
4323 | buf = Buffer.concat([buf, zeroBuffer], len); | |
4324 | } | |
4325 | ||
4326 | var arr = []; | |
4327 | var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE; | |
4328 | for (var i = 0; i < buf.length; i += intSize) { | |
4329 | arr.push(fn.call(buf, i)); | |
4330 | } | |
4331 | return arr; | |
4332 | } | |
4333 | ||
4334 | function toBuffer(arr, size, bigEndian) { | |
4335 | var buf = new Buffer(size); | |
4336 | var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE; | |
4337 | for (var i = 0; i < arr.length; i++) { | |
4338 | fn.call(buf, arr[i], i * 4, true); | |
4339 | } | |
4340 | return buf; | |
4341 | } | |
4342 | ||
4343 | function hash(buf, fn, hashSize, bigEndian) { | |
4344 | if (!Buffer.isBuffer(buf)) buf = new Buffer(buf); | |
4345 | var arr = fn(toArray(buf, bigEndian), buf.length * chrsz); | |
4346 | return toBuffer(arr, hashSize, bigEndian); | |
4347 | } | |
4348 | ||
4349 | module.exports = { hash: hash }; | |
4350 | ||
4351 | }).call(this,_dereq_("buffer").Buffer) | |
4352 | },{"buffer":8}],19:[function(_dereq_,module,exports){ | |
4353 | (function (Buffer){ | |
4354 | var rng = _dereq_('./rng') | |
4355 | ||
4356 | function error () { | |
4357 | var m = [].slice.call(arguments).join(' ') | |
4358 | throw new Error([ | |
4359 | m, | |
4360 | 'we accept pull requests', | |
4361 | 'http://github.com/dominictarr/crypto-browserify' | |
4362 | ].join('\n')) | |
4363 | } | |
4364 | ||
4365 | exports.createHash = _dereq_('./create-hash') | |
4366 | ||
4367 | exports.createHmac = _dereq_('./create-hmac') | |
4368 | ||
4369 | exports.randomBytes = function(size, callback) { | |
4370 | if (callback && callback.call) { | |
4371 | try { | |
4372 | callback.call(this, undefined, new Buffer(rng(size))) | |
4373 | } catch (err) { callback(err) } | |
4374 | } else { | |
4375 | return new Buffer(rng(size)) | |
4376 | } | |
4377 | } | |
4378 | ||
4379 | function each(a, f) { | |
4380 | for(var i in a) | |
4381 | f(a[i], i) | |
4382 | } | |
4383 | ||
4384 | exports.getHashes = function () { | |
4385 | return ['sha1', 'sha256', 'md5', 'rmd160'] | |
4386 | ||
4387 | } | |
4388 | ||
4389 | var p = _dereq_('./pbkdf2')(exports.createHmac) | |
4390 | exports.pbkdf2 = p.pbkdf2 | |
4391 | exports.pbkdf2Sync = p.pbkdf2Sync | |
4392 | ||
4393 | ||
4394 | // the least I can do is make error messages for the rest of the node.js/crypto api. | |
4395 | each(['createCredentials' | |
4396 | , 'createCipher' | |
4397 | , 'createCipheriv' | |
4398 | , 'createDecipher' | |
4399 | , 'createDecipheriv' | |
4400 | , 'createSign' | |
4401 | , 'createVerify' | |
4402 | , 'createDiffieHellman' | |
4403 | ], function (name) { | |
4404 | exports[name] = function () { | |
4405 | error('sorry,', name, 'is not implemented yet') | |
4406 | } | |
4407 | }) | |
4408 | ||
4409 | }).call(this,_dereq_("buffer").Buffer) | |
4410 | },{"./create-hash":16,"./create-hmac":17,"./pbkdf2":27,"./rng":28,"buffer":8}],20:[function(_dereq_,module,exports){ | |
4411 | /* | |
4412 | * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message | |
4413 | * Digest Algorithm, as defined in RFC 1321. | |
4414 | * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. | |
4415 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet | |
4416 | * Distributed under the BSD License | |
4417 | * See http://pajhome.org.uk/crypt/md5 for more info. | |
4418 | */ | |
4419 | ||
4420 | var helpers = _dereq_('./helpers'); | |
4421 | ||
4422 | /* | |
4423 | * Calculate the MD5 of an array of little-endian words, and a bit length | |
4424 | */ | |
4425 | function core_md5(x, len) | |
4426 | { | |
4427 | /* append padding */ | |
4428 | x[len >> 5] |= 0x80 << ((len) % 32); | |
4429 | x[(((len + 64) >>> 9) << 4) + 14] = len; | |
4430 | ||
4431 | var a = 1732584193; | |
4432 | var b = -271733879; | |
4433 | var c = -1732584194; | |
4434 | var d = 271733878; | |
4435 | ||
4436 | for(var i = 0; i < x.length; i += 16) | |
4437 | { | |
4438 | var olda = a; | |
4439 | var oldb = b; | |
4440 | var oldc = c; | |
4441 | var oldd = d; | |
4442 | ||
4443 | a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); | |
4444 | d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); | |
4445 | c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); | |
4446 | b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); | |
4447 | a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); | |
4448 | d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); | |
4449 | c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); | |
4450 | b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); | |
4451 | a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); | |
4452 | d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); | |
4453 | c = md5_ff(c, d, a, b, x[i+10], 17, -42063); | |
4454 | b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); | |
4455 | a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); | |
4456 | d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); | |
4457 | c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); | |
4458 | b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); | |
4459 | ||
4460 | a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); | |
4461 | d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); | |
4462 | c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); | |
4463 | b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); | |
4464 | a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); | |
4465 | d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); | |
4466 | c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); | |
4467 | b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); | |
4468 | a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); | |
4469 | d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); | |
4470 | c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); | |
4471 | b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); | |
4472 | a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); | |
4473 | d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); | |
4474 | c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); | |
4475 | b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); | |
4476 | ||
4477 | a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); | |
4478 | d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); | |
4479 | c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); | |
4480 | b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); | |
4481 | a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); | |
4482 | d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); | |
4483 | c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); | |
4484 | b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); | |
4485 | a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); | |
4486 | d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); | |
4487 | c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); | |
4488 | b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); | |
4489 | a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); | |
4490 | d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); | |
4491 | c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); | |
4492 | b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); | |
4493 | ||
4494 | a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); | |
4495 | d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); | |
4496 | c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); | |
4497 | b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); | |
4498 | a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); | |
4499 | d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); | |
4500 | c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); | |
4501 | b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); | |
4502 | a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); | |
4503 | d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); | |
4504 | c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); | |
4505 | b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); | |
4506 | a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); | |
4507 | d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); | |
4508 | c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); | |
4509 | b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); | |
4510 | ||
4511 | a = safe_add(a, olda); | |
4512 | b = safe_add(b, oldb); | |
4513 | c = safe_add(c, oldc); | |
4514 | d = safe_add(d, oldd); | |
4515 | } | |
4516 | return Array(a, b, c, d); | |
4517 | ||
4518 | } | |
4519 | ||
4520 | /* | |
4521 | * These functions implement the four basic operations the algorithm uses. | |
4522 | */ | |
4523 | function md5_cmn(q, a, b, x, s, t) | |
4524 | { | |
4525 | return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); | |
4526 | } | |
4527 | function md5_ff(a, b, c, d, x, s, t) | |
4528 | { | |
4529 | return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); | |
4530 | } | |
4531 | function md5_gg(a, b, c, d, x, s, t) | |
4532 | { | |
4533 | return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); | |
4534 | } | |
4535 | function md5_hh(a, b, c, d, x, s, t) | |
4536 | { | |
4537 | return md5_cmn(b ^ c ^ d, a, b, x, s, t); | |
4538 | } | |
4539 | function md5_ii(a, b, c, d, x, s, t) | |
4540 | { | |
4541 | return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); | |
4542 | } | |
4543 | ||
4544 | /* | |
4545 | * Add integers, wrapping at 2^32. This uses 16-bit operations internally | |
4546 | * to work around bugs in some JS interpreters. | |
4547 | */ | |
4548 | function safe_add(x, y) | |
4549 | { | |
4550 | var lsw = (x & 0xFFFF) + (y & 0xFFFF); | |
4551 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16); | |
4552 | return (msw << 16) | (lsw & 0xFFFF); | |
4553 | } | |
4554 | ||
4555 | /* | |
4556 | * Bitwise rotate a 32-bit number to the left. | |
4557 | */ | |
4558 | function bit_rol(num, cnt) | |
4559 | { | |
4560 | return (num << cnt) | (num >>> (32 - cnt)); | |
4561 | } | |
4562 | ||
4563 | module.exports = function md5(buf) { | |
4564 | return helpers.hash(buf, core_md5, 16); | |
4565 | }; | |
4566 | ||
4567 | },{"./helpers":18}],21:[function(_dereq_,module,exports){ | |
4568 | (function (Buffer){ | |
4569 | ||
4570 | module.exports = ripemd160 | |
4571 | ||
4572 | ||
4573 | ||
4574 | /* | |
4575 | CryptoJS v3.1.2 | |
4576 | code.google.com/p/crypto-js | |
4577 | (c) 2009-2013 by Jeff Mott. All rights reserved. | |
4578 | code.google.com/p/crypto-js/wiki/License | |
4579 | */ | |
4580 | /** @preserve | |
4581 | (c) 2012 by Cédric Mesnil. All rights reserved. | |
4582 | ||
4583 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |
4584 | ||
4585 | - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |
4586 | - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | |
4587 | ||
4588 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
4589 | */ | |
4590 | ||
4591 | // Constants table | |
4592 | var zl = [ | |
4593 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | |
4594 | 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, | |
4595 | 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, | |
4596 | 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, | |
4597 | 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]; | |
4598 | var zr = [ | |
4599 | 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, | |
4600 | 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, | |
4601 | 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, | |
4602 | 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, | |
4603 | 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]; | |
4604 | var sl = [ | |
4605 | 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, | |
4606 | 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, | |
4607 | 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, | |
4608 | 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, | |
4609 | 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]; | |
4610 | var sr = [ | |
4611 | 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, | |
4612 | 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, | |
4613 | 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, | |
4614 | 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, | |
4615 | 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]; | |
4616 | ||
4617 | var hl = [ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]; | |
4618 | var hr = [ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]; | |
4619 | ||
4620 | var bytesToWords = function (bytes) { | |
4621 | var words = []; | |
4622 | for (var i = 0, b = 0; i < bytes.length; i++, b += 8) { | |
4623 | words[b >>> 5] |= bytes[i] << (24 - b % 32); | |
4624 | } | |
4625 | return words; | |
4626 | }; | |
4627 | ||
4628 | var wordsToBytes = function (words) { | |
4629 | var bytes = []; | |
4630 | for (var b = 0; b < words.length * 32; b += 8) { | |
4631 | bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF); | |
4632 | } | |
4633 | return bytes; | |
4634 | }; | |
4635 | ||
4636 | var processBlock = function (H, M, offset) { | |
4637 | ||
4638 | // Swap endian | |
4639 | for (var i = 0; i < 16; i++) { | |
4640 | var offset_i = offset + i; | |
4641 | var M_offset_i = M[offset_i]; | |
4642 | ||
4643 | // Swap | |
4644 | M[offset_i] = ( | |
4645 | (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | | |
4646 | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) | |
4647 | ); | |
4648 | } | |
4649 | ||
4650 | // Working variables | |
4651 | var al, bl, cl, dl, el; | |
4652 | var ar, br, cr, dr, er; | |
4653 | ||
4654 | ar = al = H[0]; | |
4655 | br = bl = H[1]; | |
4656 | cr = cl = H[2]; | |
4657 | dr = dl = H[3]; | |
4658 | er = el = H[4]; | |
4659 | // Computation | |
4660 | var t; | |
4661 | for (var i = 0; i < 80; i += 1) { | |
4662 | t = (al + M[offset+zl[i]])|0; | |
4663 | if (i<16){ | |
4664 | t += f1(bl,cl,dl) + hl[0]; | |
4665 | } else if (i<32) { | |
4666 | t += f2(bl,cl,dl) + hl[1]; | |
4667 | } else if (i<48) { | |
4668 | t += f3(bl,cl,dl) + hl[2]; | |
4669 | } else if (i<64) { | |
4670 | t += f4(bl,cl,dl) + hl[3]; | |
4671 | } else {// if (i<80) { | |
4672 | t += f5(bl,cl,dl) + hl[4]; | |
4673 | } | |
4674 | t = t|0; | |
4675 | t = rotl(t,sl[i]); | |
4676 | t = (t+el)|0; | |
4677 | al = el; | |
4678 | el = dl; | |
4679 | dl = rotl(cl, 10); | |
4680 | cl = bl; | |
4681 | bl = t; | |
4682 | ||
4683 | t = (ar + M[offset+zr[i]])|0; | |
4684 | if (i<16){ | |
4685 | t += f5(br,cr,dr) + hr[0]; | |
4686 | } else if (i<32) { | |
4687 | t += f4(br,cr,dr) + hr[1]; | |
4688 | } else if (i<48) { | |
4689 | t += f3(br,cr,dr) + hr[2]; | |
4690 | } else if (i<64) { | |
4691 | t += f2(br,cr,dr) + hr[3]; | |
4692 | } else {// if (i<80) { | |
4693 | t += f1(br,cr,dr) + hr[4]; | |
4694 | } | |
4695 | t = t|0; | |
4696 | t = rotl(t,sr[i]) ; | |
4697 | t = (t+er)|0; | |
4698 | ar = er; | |
4699 | er = dr; | |
4700 | dr = rotl(cr, 10); | |
4701 | cr = br; | |
4702 | br = t; | |
4703 | } | |
4704 | // Intermediate hash value | |
4705 | t = (H[1] + cl + dr)|0; | |
4706 | H[1] = (H[2] + dl + er)|0; | |
4707 | H[2] = (H[3] + el + ar)|0; | |
4708 | H[3] = (H[4] + al + br)|0; | |
4709 | H[4] = (H[0] + bl + cr)|0; | |
4710 | H[0] = t; | |
4711 | }; | |
4712 | ||
4713 | function f1(x, y, z) { | |
4714 | return ((x) ^ (y) ^ (z)); | |
4715 | } | |
4716 | ||
4717 | function f2(x, y, z) { | |
4718 | return (((x)&(y)) | ((~x)&(z))); | |
4719 | } | |
4720 | ||
4721 | function f3(x, y, z) { | |
4722 | return (((x) | (~(y))) ^ (z)); | |
4723 | } | |
4724 | ||
4725 | function f4(x, y, z) { | |
4726 | return (((x) & (z)) | ((y)&(~(z)))); | |
4727 | } | |
4728 | ||
4729 | function f5(x, y, z) { | |
4730 | return ((x) ^ ((y) |(~(z)))); | |
4731 | } | |
4732 | ||
4733 | function rotl(x,n) { | |
4734 | return (x<<n) | (x>>>(32-n)); | |
4735 | } | |
4736 | ||
4737 | function ripemd160(message) { | |
4738 | var H = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]; | |
4739 | ||
4740 | if (typeof message == 'string') | |
4741 | message = new Buffer(message, 'utf8'); | |
4742 | ||
4743 | var m = bytesToWords(message); | |
4744 | ||
4745 | var nBitsLeft = message.length * 8; | |
4746 | var nBitsTotal = message.length * 8; | |
4747 | ||
4748 | // Add padding | |
4749 | m[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); | |
4750 | m[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( | |
4751 | (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | | |
4752 | (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) | |
4753 | ); | |
4754 | ||
4755 | for (var i=0 ; i<m.length; i += 16) { | |
4756 | processBlock(H, m, i); | |
4757 | } | |
4758 | ||
4759 | // Swap endian | |
4760 | for (var i = 0; i < 5; i++) { | |
4761 | // Shortcut | |
4762 | var H_i = H[i]; | |
4763 | ||
4764 | // Swap | |
4765 | H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | | |
4766 | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); | |
4767 | } | |
4768 | ||
4769 | var digestbytes = wordsToBytes(H); | |
4770 | return new Buffer(digestbytes); | |
4771 | } | |
4772 | ||
4773 | ||
4774 | ||
4775 | }).call(this,_dereq_("buffer").Buffer) | |
4776 | },{"buffer":8}],22:[function(_dereq_,module,exports){ | |
4777 | var u = _dereq_('./util') | |
4778 | var write = u.write | |
4779 | var fill = u.zeroFill | |
4780 | ||
4781 | module.exports = function (Buffer) { | |
4782 | ||
4783 | //prototype class for hash functions | |
4784 | function Hash (blockSize, finalSize) { | |
4785 | this._block = new Buffer(blockSize) //new Uint32Array(blockSize/4) | |
4786 | this._finalSize = finalSize | |
4787 | this._blockSize = blockSize | |
4788 | this._len = 0 | |
4789 | this._s = 0 | |
4790 | } | |
4791 | ||
4792 | Hash.prototype.init = function () { | |
4793 | this._s = 0 | |
4794 | this._len = 0 | |
4795 | } | |
4796 | ||
4797 | function lengthOf(data, enc) { | |
4798 | if(enc == null) return data.byteLength || data.length | |
4799 | if(enc == 'ascii' || enc == 'binary') return data.length | |
4800 | if(enc == 'hex') return data.length/2 | |
4801 | if(enc == 'base64') return data.length/3 | |
4802 | } | |
4803 | ||
4804 | Hash.prototype.update = function (data, enc) { | |
4805 | var bl = this._blockSize | |
4806 | ||
4807 | //I'd rather do this with a streaming encoder, like the opposite of | |
4808 | //http://nodejs.org/api/string_decoder.html | |
4809 | var length | |
4810 | if(!enc && 'string' === typeof data) | |
4811 | enc = 'utf8' | |
4812 | ||
4813 | if(enc) { | |
4814 | if(enc === 'utf-8') | |
4815 | enc = 'utf8' | |
4816 | ||
4817 | if(enc === 'base64' || enc === 'utf8') | |
4818 | data = new Buffer(data, enc), enc = null | |
4819 | ||
4820 | length = lengthOf(data, enc) | |
4821 | } else | |
4822 | length = data.byteLength || data.length | |
4823 | ||
4824 | var l = this._len += length | |
4825 | var s = this._s = (this._s || 0) | |
4826 | var f = 0 | |
4827 | var buffer = this._block | |
4828 | while(s < l) { | |
4829 | var t = Math.min(length, f + bl) | |
4830 | write(buffer, data, enc, s%bl, f, t) | |
4831 | var ch = (t - f); | |
4832 | s += ch; f += ch | |
4833 | ||
4834 | if(!(s%bl)) | |
4835 | this._update(buffer) | |
4836 | } | |
4837 | this._s = s | |
4838 | ||
4839 | return this | |
4840 | ||
4841 | } | |
4842 | ||
4843 | Hash.prototype.digest = function (enc) { | |
4844 | var bl = this._blockSize | |
4845 | var fl = this._finalSize | |
4846 | var len = this._len*8 | |
4847 | ||
4848 | var x = this._block | |
4849 | ||
4850 | var bits = len % (bl*8) | |
4851 | ||
4852 | //add end marker, so that appending 0's creats a different hash. | |
4853 | x[this._len % bl] = 0x80 | |
4854 | fill(this._block, this._len % bl + 1) | |
4855 | ||
4856 | if(bits >= fl*8) { | |
4857 | this._update(this._block) | |
4858 | u.zeroFill(this._block, 0) | |
4859 | } | |
4860 | ||
4861 | //TODO: handle case where the bit length is > Math.pow(2, 29) | |
4862 | x.writeInt32BE(len, fl + 4) //big endian | |
4863 | ||
4864 | var hash = this._update(this._block) || this._hash() | |
4865 | if(enc == null) return hash | |
4866 | return hash.toString(enc) | |
4867 | } | |
4868 | ||
4869 | Hash.prototype._update = function () { | |
4870 | throw new Error('_update must be implemented by subclass') | |
4871 | } | |
4872 | ||
4873 | return Hash | |
4874 | } | |
4875 | ||
4876 | },{"./util":26}],23:[function(_dereq_,module,exports){ | |
4877 | var exports = module.exports = function (alg) { | |
4878 | var Alg = exports[alg] | |
4879 | if(!Alg) throw new Error(alg + ' is not supported (we accept pull requests)') | |
4880 | return new Alg() | |
4881 | } | |
4882 | ||
4883 | var Buffer = _dereq_('buffer').Buffer | |
4884 | var Hash = _dereq_('./hash')(Buffer) | |
4885 | ||
4886 | exports.sha = | |
4887 | exports.sha1 = _dereq_('./sha1')(Buffer, Hash) | |
4888 | exports.sha256 = _dereq_('./sha256')(Buffer, Hash) | |
4889 | ||
4890 | },{"./hash":22,"./sha1":24,"./sha256":25,"buffer":8}],24:[function(_dereq_,module,exports){ | |
4891 | /* | |
4892 | * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined | |
4893 | * in FIPS PUB 180-1 | |
4894 | * Version 2.1a Copyright Paul Johnston 2000 - 2002. | |
4895 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet | |
4896 | * Distributed under the BSD License | |
4897 | * See http://pajhome.org.uk/crypt/md5 for details. | |
4898 | */ | |
4899 | module.exports = function (Buffer, Hash) { | |
4900 | ||
4901 | var inherits = _dereq_('util').inherits | |
4902 | ||
4903 | inherits(Sha1, Hash) | |
4904 | ||
4905 | var A = 0|0 | |
4906 | var B = 4|0 | |
4907 | var C = 8|0 | |
4908 | var D = 12|0 | |
4909 | var E = 16|0 | |
4910 | ||
4911 | var BE = false | |
4912 | var LE = true | |
4913 | ||
4914 | var W = new Int32Array(80) | |
4915 | ||
4916 | var POOL = [] | |
4917 | ||
4918 | function Sha1 () { | |
4919 | if(POOL.length) | |
4920 | return POOL.pop().init() | |
4921 | ||
4922 | if(!(this instanceof Sha1)) return new Sha1() | |
4923 | this._w = W | |
4924 | Hash.call(this, 16*4, 14*4) | |
4925 | ||
4926 | this._h = null | |
4927 | this.init() | |
4928 | } | |
4929 | ||
4930 | Sha1.prototype.init = function () { | |
4931 | this._a = 0x67452301 | |
4932 | this._b = 0xefcdab89 | |
4933 | this._c = 0x98badcfe | |
4934 | this._d = 0x10325476 | |
4935 | this._e = 0xc3d2e1f0 | |
4936 | ||
4937 | Hash.prototype.init.call(this) | |
4938 | return this | |
4939 | } | |
4940 | ||
4941 | Sha1.prototype._POOL = POOL | |
4942 | ||
4943 | // assume that array is a Uint32Array with length=16, | |
4944 | // and that if it is the last block, it already has the length and the 1 bit appended. | |
4945 | ||
4946 | ||
4947 | var isDV = new Buffer(1) instanceof DataView | |
4948 | function readInt32BE (X, i) { | |
4949 | return isDV | |
4950 | ? X.getInt32(i, false) | |
4951 | : X.readInt32BE(i) | |
4952 | } | |
4953 | ||
4954 | Sha1.prototype._update = function (array) { | |
4955 | ||
4956 | var X = this._block | |
4957 | var h = this._h | |
4958 | var a, b, c, d, e, _a, _b, _c, _d, _e | |
4959 | ||
4960 | a = _a = this._a | |
4961 | b = _b = this._b | |
4962 | c = _c = this._c | |
4963 | d = _d = this._d | |
4964 | e = _e = this._e | |
4965 | ||
4966 | var w = this._w | |
4967 | ||
4968 | for(var j = 0; j < 80; j++) { | |
4969 | var W = w[j] | |
4970 | = j < 16 | |
4971 | //? X.getInt32(j*4, false) | |
4972 | //? readInt32BE(X, j*4) //*/ X.readInt32BE(j*4) //*/ | |
4973 | ? X.readInt32BE(j*4) | |
4974 | : rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1) | |
4975 | ||
4976 | var t = | |
4977 | add( | |
4978 | add(rol(a, 5), sha1_ft(j, b, c, d)), | |
4979 | add(add(e, W), sha1_kt(j)) | |
4980 | ); | |
4981 | ||
4982 | e = d | |
4983 | d = c | |
4984 | c = rol(b, 30) | |
4985 | b = a | |
4986 | a = t | |
4987 | } | |
4988 | ||
4989 | this._a = add(a, _a) | |
4990 | this._b = add(b, _b) | |
4991 | this._c = add(c, _c) | |
4992 | this._d = add(d, _d) | |
4993 | this._e = add(e, _e) | |
4994 | } | |
4995 | ||
4996 | Sha1.prototype._hash = function () { | |
4997 | if(POOL.length < 100) POOL.push(this) | |
4998 | var H = new Buffer(20) | |
4999 | //console.log(this._a|0, this._b|0, this._c|0, this._d|0, this._e|0) | |
5000 | H.writeInt32BE(this._a|0, A) | |
5001 | H.writeInt32BE(this._b|0, B) | |
5002 | H.writeInt32BE(this._c|0, C) | |
5003 | H.writeInt32BE(this._d|0, D) | |
5004 | H.writeInt32BE(this._e|0, E) | |
5005 | return H | |
5006 | } | |
5007 | ||
5008 | /* | |
5009 | * Perform the appropriate triplet combination function for the current | |
5010 | * iteration | |
5011 | */ | |
5012 | function sha1_ft(t, b, c, d) { | |
5013 | if(t < 20) return (b & c) | ((~b) & d); | |
5014 | if(t < 40) return b ^ c ^ d; | |
5015 | if(t < 60) return (b & c) | (b & d) | (c & d); | |
5016 | return b ^ c ^ d; | |
5017 | } | |
5018 | ||
5019 | /* | |
5020 | * Determine the appropriate additive constant for the current iteration | |
5021 | */ | |
5022 | function sha1_kt(t) { | |
5023 | return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : | |
5024 | (t < 60) ? -1894007588 : -899497514; | |
5025 | } | |
5026 | ||
5027 | /* | |
5028 | * Add integers, wrapping at 2^32. This uses 16-bit operations internally | |
5029 | * to work around bugs in some JS interpreters. | |
5030 | * //dominictarr: this is 10 years old, so maybe this can be dropped?) | |
5031 | * | |
5032 | */ | |
5033 | function add(x, y) { | |
5034 | return (x + y ) | 0 | |
5035 | //lets see how this goes on testling. | |
5036 | // var lsw = (x & 0xFFFF) + (y & 0xFFFF); | |
5037 | // var msw = (x >> 16) + (y >> 16) + (lsw >> 16); | |
5038 | // return (msw << 16) | (lsw & 0xFFFF); | |
5039 | } | |
5040 | ||
5041 | /* | |
5042 | * Bitwise rotate a 32-bit number to the left. | |
5043 | */ | |
5044 | function rol(num, cnt) { | |
5045 | return (num << cnt) | (num >>> (32 - cnt)); | |
5046 | } | |
5047 | ||
5048 | return Sha1 | |
5049 | } | |
5050 | ||
5051 | },{"util":14}],25:[function(_dereq_,module,exports){ | |
5052 | ||
5053 | /** | |
5054 | * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined | |
5055 | * in FIPS 180-2 | |
5056 | * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. | |
5057 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet | |
5058 | * | |
5059 | */ | |
5060 | ||
5061 | var inherits = _dereq_('util').inherits | |
5062 | var BE = false | |
5063 | var LE = true | |
5064 | var u = _dereq_('./util') | |
5065 | ||
5066 | module.exports = function (Buffer, Hash) { | |
5067 | ||
5068 | var K = [ | |
5069 | 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, | |
5070 | 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, | |
5071 | 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, | |
5072 | 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, | |
5073 | 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, | |
5074 | 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, | |
5075 | 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, | |
5076 | 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, | |
5077 | 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, | |
5078 | 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, | |
5079 | 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, | |
5080 | 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, | |
5081 | 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, | |
5082 | 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, | |
5083 | 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, | |
5084 | 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 | |
5085 | ] | |
5086 | ||
5087 | inherits(Sha256, Hash) | |
5088 | var W = new Array(64) | |
5089 | var POOL = [] | |
5090 | function Sha256() { | |
5091 | // Closure compiler warning - this code lacks side effects - thus commented out | |
5092 | // if(POOL.length) { | |
5093 | // return POOL.shift().init() | |
5094 | // } | |
5095 | //this._data = new Buffer(32) | |
5096 | ||
5097 | this.init() | |
5098 | ||
5099 | this._w = W //new Array(64) | |
5100 | ||
5101 | Hash.call(this, 16*4, 14*4) | |
5102 | }; | |
5103 | ||
5104 | Sha256.prototype.init = function () { | |
5105 | ||
5106 | this._a = 0x6a09e667|0 | |
5107 | this._b = 0xbb67ae85|0 | |
5108 | this._c = 0x3c6ef372|0 | |
5109 | this._d = 0xa54ff53a|0 | |
5110 | this._e = 0x510e527f|0 | |
5111 | this._f = 0x9b05688c|0 | |
5112 | this._g = 0x1f83d9ab|0 | |
5113 | this._h = 0x5be0cd19|0 | |
5114 | ||
5115 | this._len = this._s = 0 | |
5116 | ||
5117 | return this | |
5118 | } | |
5119 | ||
5120 | var safe_add = function(x, y) { | |
5121 | var lsw = (x & 0xFFFF) + (y & 0xFFFF); | |
5122 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16); | |
5123 | return (msw << 16) | (lsw & 0xFFFF); | |
5124 | } | |
5125 | ||
5126 | function S (X, n) { | |
5127 | return (X >>> n) | (X << (32 - n)); | |
5128 | } | |
5129 | ||
5130 | function R (X, n) { | |
5131 | return (X >>> n); | |
5132 | } | |
5133 | ||
5134 | function Ch (x, y, z) { | |
5135 | return ((x & y) ^ ((~x) & z)); | |
5136 | } | |
5137 | ||
5138 | function Maj (x, y, z) { | |
5139 | return ((x & y) ^ (x & z) ^ (y & z)); | |
5140 | } | |
5141 | ||
5142 | function Sigma0256 (x) { | |
5143 | return (S(x, 2) ^ S(x, 13) ^ S(x, 22)); | |
5144 | } | |
5145 | ||
5146 | function Sigma1256 (x) { | |
5147 | return (S(x, 6) ^ S(x, 11) ^ S(x, 25)); | |
5148 | } | |
5149 | ||
5150 | function Gamma0256 (x) { | |
5151 | return (S(x, 7) ^ S(x, 18) ^ R(x, 3)); | |
5152 | } | |
5153 | ||
5154 | function Gamma1256 (x) { | |
5155 | return (S(x, 17) ^ S(x, 19) ^ R(x, 10)); | |
5156 | } | |
5157 | ||
5158 | Sha256.prototype._update = function(m) { | |
5159 | var M = this._block | |
5160 | var W = this._w | |
5161 | var a, b, c, d, e, f, g, h | |
5162 | var T1, T2 | |
5163 | ||
5164 | a = this._a | 0 | |
5165 | b = this._b | 0 | |
5166 | c = this._c | 0 | |
5167 | d = this._d | 0 | |
5168 | e = this._e | 0 | |
5169 | f = this._f | 0 | |
5170 | g = this._g | 0 | |
5171 | h = this._h | 0 | |
5172 | ||
5173 | for (var j = 0; j < 64; j++) { | |
5174 | var w = W[j] = j < 16 | |
5175 | ? M.readInt32BE(j * 4) | |
5176 | : Gamma1256(W[j - 2]) + W[j - 7] + Gamma0256(W[j - 15]) + W[j - 16] | |
5177 | ||
5178 | T1 = h + Sigma1256(e) + Ch(e, f, g) + K[j] + w | |
5179 | ||
5180 | T2 = Sigma0256(a) + Maj(a, b, c); | |
5181 | h = g; g = f; f = e; e = d + T1; d = c; c = b; b = a; a = T1 + T2; | |
5182 | } | |
5183 | ||
5184 | this._a = (a + this._a) | 0 | |
5185 | this._b = (b + this._b) | 0 | |
5186 | this._c = (c + this._c) | 0 | |
5187 | this._d = (d + this._d) | 0 | |
5188 | this._e = (e + this._e) | 0 | |
5189 | this._f = (f + this._f) | 0 | |
5190 | this._g = (g + this._g) | 0 | |
5191 | this._h = (h + this._h) | 0 | |
5192 | ||
5193 | }; | |
5194 | ||
5195 | Sha256.prototype._hash = function () { | |
5196 | if(POOL.length < 10) | |
5197 | POOL.push(this) | |
5198 | ||
5199 | var H = new Buffer(32) | |
5200 | ||
5201 | H.writeInt32BE(this._a, 0) | |
5202 | H.writeInt32BE(this._b, 4) | |
5203 | H.writeInt32BE(this._c, 8) | |
5204 | H.writeInt32BE(this._d, 12) | |
5205 | H.writeInt32BE(this._e, 16) | |
5206 | H.writeInt32BE(this._f, 20) | |
5207 | H.writeInt32BE(this._g, 24) | |
5208 | H.writeInt32BE(this._h, 28) | |
5209 | ||
5210 | return H | |
5211 | } | |
5212 | ||
5213 | return Sha256 | |
5214 | ||
5215 | } | |
5216 | ||
5217 | },{"./util":26,"util":14}],26:[function(_dereq_,module,exports){ | |
5218 | exports.write = write | |
5219 | exports.zeroFill = zeroFill | |
5220 | ||
5221 | exports.toString = toString | |
5222 | ||
5223 | function write (buffer, string, enc, start, from, to, LE) { | |
5224 | var l = (to - from) | |
5225 | if(enc === 'ascii' || enc === 'binary') { | |
5226 | for( var i = 0; i < l; i++) { | |
5227 | buffer[start + i] = string.charCodeAt(i + from) | |
5228 | } | |
5229 | } | |
5230 | else if(enc == null) { | |
5231 | for( var i = 0; i < l; i++) { | |
5232 | buffer[start + i] = string[i + from] | |
5233 | } | |
5234 | } | |
5235 | else if(enc === 'hex') { | |
5236 | for(var i = 0; i < l; i++) { | |
5237 | var j = from + i | |
5238 | buffer[start + i] = parseInt(string[j*2] + string[(j*2)+1], 16) | |
5239 | } | |
5240 | } | |
5241 | else if(enc === 'base64') { | |
5242 | throw new Error('base64 encoding not yet supported') | |
5243 | } | |
5244 | else | |
5245 | throw new Error(enc +' encoding not yet supported') | |
5246 | } | |
5247 | ||
5248 | //always fill to the end! | |
5249 | function zeroFill(buf, from) { | |
5250 | for(var i = from; i < buf.length; i++) | |
5251 | buf[i] = 0 | |
5252 | } | |
5253 | ||
5254 | ||
5255 | },{}],27:[function(_dereq_,module,exports){ | |
5256 | (function (Buffer){ | |
5257 | // JavaScript PBKDF2 Implementation | |
5258 | // Based on http://git.io/qsv2zw | |
5259 | // Licensed under LGPL v3 | |
5260 | // Copyright (c) 2013 jduncanator | |
5261 | ||
5262 | var blocksize = 64 | |
5263 | var zeroBuffer = new Buffer(blocksize); zeroBuffer.fill(0) | |
5264 | ||
5265 | module.exports = function (createHmac, exports) { | |
5266 | exports = exports || {} | |
5267 | ||
5268 | exports.pbkdf2 = function(password, salt, iterations, keylen, cb) { | |
5269 | if('function' !== typeof cb) | |
5270 | throw new Error('No callback provided to pbkdf2'); | |
5271 | setTimeout(function () { | |
5272 | cb(null, exports.pbkdf2Sync(password, salt, iterations, keylen)) | |
5273 | }) | |
5274 | } | |
5275 | ||
5276 | exports.pbkdf2Sync = function(key, salt, iterations, keylen) { | |
5277 | if('number' !== typeof iterations) | |
5278 | throw new TypeError('Iterations not a number') | |
5279 | if(iterations < 0) | |
5280 | throw new TypeError('Bad iterations') | |
5281 | if('number' !== typeof keylen) | |
5282 | throw new TypeError('Key length not a number') | |
5283 | if(keylen < 0) | |
5284 | throw new TypeError('Bad key length') | |
5285 | ||
5286 | //stretch key to the correct length that hmac wants it, | |
5287 | //otherwise this will happen every time hmac is called | |
5288 | //twice per iteration. | |
5289 | var key = !Buffer.isBuffer(key) ? new Buffer(key) : key | |
5290 | ||
5291 | if(key.length > blocksize) { | |
5292 | key = createHash(alg).update(key).digest() | |
5293 | } else if(key.length < blocksize) { | |
5294 | key = Buffer.concat([key, zeroBuffer], blocksize) | |
5295 | } | |
5296 | ||
5297 | var HMAC; | |
5298 | var cplen, p = 0, i = 1, itmp = new Buffer(4), digtmp; | |
5299 | var out = new Buffer(keylen); | |
5300 | out.fill(0); | |
5301 | while(keylen) { | |
5302 | if(keylen > 20) | |
5303 | cplen = 20; | |
5304 | else | |
5305 | cplen = keylen; | |
5306 | ||
5307 | /* We are unlikely to ever use more than 256 blocks (5120 bits!) | |
5308 | * but just in case... | |
5309 | */ | |
5310 | itmp[0] = (i >> 24) & 0xff; | |
5311 | itmp[1] = (i >> 16) & 0xff; | |
5312 | itmp[2] = (i >> 8) & 0xff; | |
5313 | itmp[3] = i & 0xff; | |
5314 | ||
5315 | HMAC = createHmac('sha1', key); | |
5316 | HMAC.update(salt) | |
5317 | HMAC.update(itmp); | |
5318 | digtmp = HMAC.digest(); | |
5319 | digtmp.copy(out, p, 0, cplen); | |
5320 | ||
5321 | for(var j = 1; j < iterations; j++) { | |
5322 | HMAC = createHmac('sha1', key); | |
5323 | HMAC.update(digtmp); | |
5324 | digtmp = HMAC.digest(); | |
5325 | for(var k = 0; k < cplen; k++) { | |
5326 | out[k] ^= digtmp[k]; | |
5327 | } | |
5328 | } | |
5329 | keylen -= cplen; | |
5330 | i++; | |
5331 | p += cplen; | |
5332 | } | |
5333 | ||
5334 | return out; | |
5335 | } | |
5336 | ||
5337 | return exports | |
5338 | } | |
5339 | ||
5340 | }).call(this,_dereq_("buffer").Buffer) | |
5341 | },{"buffer":8}],28:[function(_dereq_,module,exports){ | |
5342 | (function (Buffer){ | |
5343 | // Original code adapted from Robert Kieffer. | |
5344 | // details at https://github.com/broofa/node-uuid | |
5345 | ||
5346 | ||
5347 | (function() { | |
5348 | var _global = this; | |
5349 | ||
5350 | var mathRNG, whatwgRNG; | |
5351 | ||
5352 | // NOTE: Math.random() does not guarantee "cryptographic quality" | |
5353 | mathRNG = function(size) { | |
5354 | var bytes = new Buffer(size); | |
5355 | var r; | |
5356 | ||
5357 | for (var i = 0, r; i < size; i++) { | |
5358 | if ((i & 0x03) == 0) r = Math.random() * 0x100000000; | |
5359 | bytes[i] = r >>> ((i & 0x03) << 3) & 0xff; | |
5360 | } | |
5361 | ||
5362 | return bytes; | |
5363 | } | |
5364 | ||
5365 | if (_global.crypto && crypto.getRandomValues) { | |
5366 | whatwgRNG = function(size) { | |
5367 | var bytes = new Buffer(size); //in browserify, this is an extended Uint8Array | |
5368 | crypto.getRandomValues(bytes); | |
5369 | return bytes; | |
5370 | } | |
5371 | } | |
5372 | ||
5373 | module.exports = whatwgRNG || mathRNG; | |
5374 | ||
5375 | }()) | |
5376 | ||
5377 | }).call(this,_dereq_("buffer").Buffer) | |
5378 | },{"buffer":8}],29:[function(_dereq_,module,exports){ | |
5379 | ;(function (root, factory, undef) { | |
5380 | if (typeof exports === "object") { | |
5381 | // CommonJS | |
5382 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); | |
5383 | } | |
5384 | else if (typeof define === "function" && define.amd) { | |
5385 | // AMD | |
5386 | define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); | |
5387 | } | |
5388 | else { | |
5389 | // Global (browser) | |
5390 | factory(root.CryptoJS); | |
5391 | } | |
5392 | }(this, function (CryptoJS) { | |
5393 | ||
5394 | (function () { | |
5395 | // Shortcuts | |
5396 | var C = CryptoJS; | |
5397 | var C_lib = C.lib; | |
5398 | var BlockCipher = C_lib.BlockCipher; | |
5399 | var C_algo = C.algo; | |
5400 | ||
5401 | // Lookup tables | |
5402 | var SBOX = []; | |
5403 | var INV_SBOX = []; | |
5404 | var SUB_MIX_0 = []; | |
5405 | var SUB_MIX_1 = []; | |
5406 | var SUB_MIX_2 = []; | |
5407 | var SUB_MIX_3 = []; | |
5408 | var INV_SUB_MIX_0 = []; | |
5409 | var INV_SUB_MIX_1 = []; | |
5410 | var INV_SUB_MIX_2 = []; | |
5411 | var INV_SUB_MIX_3 = []; | |
5412 | ||
5413 | // Compute lookup tables | |
5414 | (function () { | |
5415 | // Compute double table | |
5416 | var d = []; | |
5417 | for (var i = 0; i < 256; i++) { | |
5418 | if (i < 128) { | |
5419 | d[i] = i << 1; | |
5420 | } else { | |
5421 | d[i] = (i << 1) ^ 0x11b; | |
5422 | } | |
5423 | } | |
5424 | ||
5425 | // Walk GF(2^8) | |
5426 | var x = 0; | |
5427 | var xi = 0; | |
5428 | for (var i = 0; i < 256; i++) { | |
5429 | // Compute sbox | |
5430 | var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4); | |
5431 | sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63; | |
5432 | SBOX[x] = sx; | |
5433 | INV_SBOX[sx] = x; | |
5434 | ||
5435 | // Compute multiplication | |
5436 | var x2 = d[x]; | |
5437 | var x4 = d[x2]; | |
5438 | var x8 = d[x4]; | |
5439 | ||
5440 | // Compute sub bytes, mix columns tables | |
5441 | var t = (d[sx] * 0x101) ^ (sx * 0x1010100); | |
5442 | SUB_MIX_0[x] = (t << 24) | (t >>> 8); | |
5443 | SUB_MIX_1[x] = (t << 16) | (t >>> 16); | |
5444 | SUB_MIX_2[x] = (t << 8) | (t >>> 24); | |
5445 | SUB_MIX_3[x] = t; | |
5446 | ||
5447 | // Compute inv sub bytes, inv mix columns tables | |
5448 | var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100); | |
5449 | INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8); | |
5450 | INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16); | |
5451 | INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24); | |
5452 | INV_SUB_MIX_3[sx] = t; | |
5453 | ||
5454 | // Compute next counter | |
5455 | if (!x) { | |
5456 | x = xi = 1; | |
5457 | } else { | |
5458 | x = x2 ^ d[d[d[x8 ^ x2]]]; | |
5459 | xi ^= d[d[xi]]; | |
5460 | } | |
5461 | } | |
5462 | }()); | |
5463 | ||
5464 | // Precomputed Rcon lookup | |
5465 | var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; | |
5466 | ||
5467 | /** | |
5468 | * AES block cipher algorithm. | |
5469 | */ | |
5470 | var AES = C_algo.AES = BlockCipher.extend({ | |
5471 | _doReset: function () { | |
5472 | // Shortcuts | |
5473 | var key = this._key; | |
5474 | var keyWords = key.words; | |
5475 | var keySize = key.sigBytes / 4; | |
5476 | ||
5477 | // Compute number of rounds | |
5478 | var nRounds = this._nRounds = keySize + 6 | |
5479 | ||
5480 | // Compute number of key schedule rows | |
5481 | var ksRows = (nRounds + 1) * 4; | |
5482 | ||
5483 | // Compute key schedule | |
5484 | var keySchedule = this._keySchedule = []; | |
5485 | for (var ksRow = 0; ksRow < ksRows; ksRow++) { | |
5486 | if (ksRow < keySize) { | |
5487 | keySchedule[ksRow] = keyWords[ksRow]; | |
5488 | } else { | |
5489 | var t = keySchedule[ksRow - 1]; | |
5490 | ||
5491 | if (!(ksRow % keySize)) { | |
5492 | // Rot word | |
5493 | t = (t << 8) | (t >>> 24); | |
5494 | ||
5495 | // Sub word | |
5496 | t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; | |
5497 | ||
5498 | // Mix Rcon | |
5499 | t ^= RCON[(ksRow / keySize) | 0] << 24; | |
5500 | } else if (keySize > 6 && ksRow % keySize == 4) { | |
5501 | // Sub word | |
5502 | t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; | |
5503 | } | |
5504 | ||
5505 | keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; | |
5506 | } | |
5507 | } | |
5508 | ||
5509 | // Compute inv key schedule | |
5510 | var invKeySchedule = this._invKeySchedule = []; | |
5511 | for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { | |
5512 | var ksRow = ksRows - invKsRow; | |
5513 | ||
5514 | if (invKsRow % 4) { | |
5515 | var t = keySchedule[ksRow]; | |
5516 | } else { | |
5517 | var t = keySchedule[ksRow - 4]; | |
5518 | } | |
5519 | ||
5520 | if (invKsRow < 4 || ksRow <= 4) { | |
5521 | invKeySchedule[invKsRow] = t; | |
5522 | } else { | |
5523 | invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^ | |
5524 | INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; | |
5525 | } | |
5526 | } | |
5527 | }, | |
5528 | ||
5529 | encryptBlock: function (M, offset) { | |
5530 | this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); | |
5531 | }, | |
5532 | ||
5533 | decryptBlock: function (M, offset) { | |
5534 | // Swap 2nd and 4th rows | |
5535 | var t = M[offset + 1]; | |
5536 | M[offset + 1] = M[offset + 3]; | |
5537 | M[offset + 3] = t; | |
5538 | ||
5539 | this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); | |
5540 | ||
5541 | // Inv swap 2nd and 4th rows | |
5542 | var t = M[offset + 1]; | |
5543 | M[offset + 1] = M[offset + 3]; | |
5544 | M[offset + 3] = t; | |
5545 | }, | |
5546 | ||
5547 | _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { | |
5548 | // Shortcut | |
5549 | var nRounds = this._nRounds; | |
5550 | ||
5551 | // Get input, add round key | |
5552 | var s0 = M[offset] ^ keySchedule[0]; | |
5553 | var s1 = M[offset + 1] ^ keySchedule[1]; | |
5554 | var s2 = M[offset + 2] ^ keySchedule[2]; | |
5555 | var s3 = M[offset + 3] ^ keySchedule[3]; | |
5556 | ||
5557 | // Key schedule row counter | |
5558 | var ksRow = 4; | |
5559 | ||
5560 | // Rounds | |
5561 | for (var round = 1; round < nRounds; round++) { | |
5562 | // Shift rows, sub bytes, mix columns, add round key | |
5563 | var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; | |
5564 | var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; | |
5565 | var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; | |
5566 | var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; | |
5567 | ||
5568 | // Update state | |
5569 | s0 = t0; | |
5570 | s1 = t1; | |
5571 | s2 = t2; | |
5572 | s3 = t3; | |
5573 | } | |
5574 | ||
5575 | // Shift rows, sub bytes, add round key | |
5576 | var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; | |
5577 | var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; | |
5578 | var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; | |
5579 | var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; | |
5580 | ||
5581 | // Set output | |
5582 | M[offset] = t0; | |
5583 | M[offset + 1] = t1; | |
5584 | M[offset + 2] = t2; | |
5585 | M[offset + 3] = t3; | |
5586 | }, | |
5587 | ||
5588 | keySize: 256/32 | |
5589 | }); | |
5590 | ||
5591 | /** | |
5592 | * Shortcut functions to the cipher's object interface. | |
5593 | * | |
5594 | * @example | |
5595 | * | |
5596 | * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); | |
5597 | * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); | |
5598 | */ | |
5599 | C.AES = BlockCipher._createHelper(AES); | |
5600 | }()); | |
5601 | ||
5602 | ||
5603 | return CryptoJS.AES; | |
5604 | ||
5605 | })); | |
5606 | },{"./cipher-core":30,"./core":31,"./enc-base64":32,"./evpkdf":34,"./md5":39}],30:[function(_dereq_,module,exports){ | |
5607 | ;(function (root, factory) { | |
5608 | if (typeof exports === "object") { | |
5609 | // CommonJS | |
5610 | module.exports = exports = factory(_dereq_("./core")); | |
5611 | } | |
5612 | else if (typeof define === "function" && define.amd) { | |
5613 | // AMD | |
5614 | define(["./core"], factory); | |
5615 | } | |
5616 | else { | |
5617 | // Global (browser) | |
5618 | factory(root.CryptoJS); | |
5619 | } | |
5620 | }(this, function (CryptoJS) { | |
5621 | ||
5622 | /** | |
5623 | * Cipher core components. | |
5624 | */ | |
5625 | CryptoJS.lib.Cipher || (function (undefined) { | |
5626 | // Shortcuts | |
5627 | var C = CryptoJS; | |
5628 | var C_lib = C.lib; | |
5629 | var Base = C_lib.Base; | |
5630 | var WordArray = C_lib.WordArray; | |
5631 | var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; | |
5632 | var C_enc = C.enc; | |
5633 | var Utf8 = C_enc.Utf8; | |
5634 | var Base64 = C_enc.Base64; | |
5635 | var C_algo = C.algo; | |
5636 | var EvpKDF = C_algo.EvpKDF; | |
5637 | ||
5638 | /** | |
5639 | * Abstract base cipher template. | |
5640 | * | |
5641 | * @property {number} keySize This cipher's key size. Default: 4 (128 bits) | |
5642 | * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) | |
5643 | * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. | |
5644 | * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. | |
5645 | */ | |
5646 | var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ | |
5647 | /** | |
5648 | * Configuration options. | |
5649 | * | |
5650 | * @property {WordArray} iv The IV to use for this operation. | |
5651 | */ | |
5652 | cfg: Base.extend(), | |
5653 | ||
5654 | /** | |
5655 | * Creates this cipher in encryption mode. | |
5656 | * | |
5657 | * @param {WordArray} key The key. | |
5658 | * @param {Object} cfg (Optional) The configuration options to use for this operation. | |
5659 | * | |
5660 | * @return {Cipher} A cipher instance. | |
5661 | * | |
5662 | * @static | |
5663 | * | |
5664 | * @example | |
5665 | * | |
5666 | * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); | |
5667 | */ | |
5668 | createEncryptor: function (key, cfg) { | |
5669 | return this.create(this._ENC_XFORM_MODE, key, cfg); | |
5670 | }, | |
5671 | ||
5672 | /** | |
5673 | * Creates this cipher in decryption mode. | |
5674 | * | |
5675 | * @param {WordArray} key The key. | |
5676 | * @param {Object} cfg (Optional) The configuration options to use for this operation. | |
5677 | * | |
5678 | * @return {Cipher} A cipher instance. | |
5679 | * | |
5680 | * @static | |
5681 | * | |
5682 | * @example | |
5683 | * | |
5684 | * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); | |
5685 | */ | |
5686 | createDecryptor: function (key, cfg) { | |
5687 | return this.create(this._DEC_XFORM_MODE, key, cfg); | |
5688 | }, | |
5689 | ||
5690 | /** | |
5691 | * Initializes a newly created cipher. | |
5692 | * | |
5693 | * @param {number} xformMode Either the encryption or decryption transormation mode constant. | |
5694 | * @param {WordArray} key The key. | |
5695 | * @param {Object} cfg (Optional) The configuration options to use for this operation. | |
5696 | * | |
5697 | * @example | |
5698 | * | |
5699 | * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); | |
5700 | */ | |
5701 | init: function (xformMode, key, cfg) { | |
5702 | // Apply config defaults | |
5703 | this.cfg = this.cfg.extend(cfg); | |
5704 | ||
5705 | // Store transform mode and key | |
5706 | this._xformMode = xformMode; | |
5707 | this._key = key; | |
5708 | ||
5709 | // Set initial values | |
5710 | this.reset(); | |
5711 | }, | |
5712 | ||
5713 | /** | |
5714 | * Resets this cipher to its initial state. | |
5715 | * | |
5716 | * @example | |
5717 | * | |
5718 | * cipher.reset(); | |
5719 | */ | |
5720 | reset: function () { | |
5721 | // Reset data buffer | |
5722 | BufferedBlockAlgorithm.reset.call(this); | |
5723 | ||
5724 | // Perform concrete-cipher logic | |
5725 | this._doReset(); | |
5726 | }, | |
5727 | ||
5728 | /** | |
5729 | * Adds data to be encrypted or decrypted. | |
5730 | * | |
5731 | * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. | |
5732 | * | |
5733 | * @return {WordArray} The data after processing. | |
5734 | * | |
5735 | * @example | |
5736 | * | |
5737 | * var encrypted = cipher.process('data'); | |
5738 | * var encrypted = cipher.process(wordArray); | |
5739 | */ | |
5740 | process: function (dataUpdate) { | |
5741 | // Append | |
5742 | this._append(dataUpdate); | |
5743 | ||
5744 | // Process available blocks | |
5745 | return this._process(); | |
5746 | }, | |
5747 | ||
5748 | /** | |
5749 | * Finalizes the encryption or decryption process. | |
5750 | * Note that the finalize operation is effectively a destructive, read-once operation. | |
5751 | * | |
5752 | * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. | |
5753 | * | |
5754 | * @return {WordArray} The data after final processing. | |
5755 | * | |
5756 | * @example | |
5757 | * | |
5758 | * var encrypted = cipher.finalize(); | |
5759 | * var encrypted = cipher.finalize('data'); | |
5760 | * var encrypted = cipher.finalize(wordArray); | |
5761 | */ | |
5762 | finalize: function (dataUpdate) { | |
5763 | // Final data update | |
5764 | if (dataUpdate) { | |
5765 | this._append(dataUpdate); | |
5766 | } | |
5767 | ||
5768 | // Perform concrete-cipher logic | |
5769 | var finalProcessedData = this._doFinalize(); | |
5770 | ||
5771 | return finalProcessedData; | |
5772 | }, | |
5773 | ||
5774 | keySize: 128/32, | |
5775 | ||
5776 | ivSize: 128/32, | |
5777 | ||
5778 | _ENC_XFORM_MODE: 1, | |
5779 | ||
5780 | _DEC_XFORM_MODE: 2, | |
5781 | ||
5782 | /** | |
5783 | * Creates shortcut functions to a cipher's object interface. | |
5784 | * | |
5785 | * @param {Cipher} cipher The cipher to create a helper for. | |
5786 | * | |
5787 | * @return {Object} An object with encrypt and decrypt shortcut functions. | |
5788 | * | |
5789 | * @static | |
5790 | * | |
5791 | * @example | |
5792 | * | |
5793 | * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); | |
5794 | */ | |
5795 | _createHelper: (function () { | |
5796 | function selectCipherStrategy(key) { | |
5797 | if (typeof key == 'string') { | |
5798 | return PasswordBasedCipher; | |
5799 | } else { | |
5800 | return SerializableCipher; | |
5801 | } | |
5802 | } | |
5803 | ||
5804 | return function (cipher) { | |
5805 | return { | |
5806 | encrypt: function (message, key, cfg) { | |
5807 | return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); | |
5808 | }, | |
5809 | ||
5810 | decrypt: function (ciphertext, key, cfg) { | |
5811 | return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); | |
5812 | } | |
5813 | }; | |
5814 | }; | |
5815 | }()) | |
5816 | }); | |
5817 | ||
5818 | /** | |
5819 | * Abstract base stream cipher template. | |
5820 | * | |
5821 | * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) | |
5822 | */ | |
5823 | var StreamCipher = C_lib.StreamCipher = Cipher.extend({ | |
5824 | _doFinalize: function () { | |
5825 | // Process partial blocks | |
5826 | var finalProcessedBlocks = this._process(!!'flush'); | |
5827 | ||
5828 | return finalProcessedBlocks; | |
5829 | }, | |
5830 | ||
5831 | blockSize: 1 | |
5832 | }); | |
5833 | ||
5834 | /** | |
5835 | * Mode namespace. | |
5836 | */ | |
5837 | var C_mode = C.mode = {}; | |
5838 | ||
5839 | /** | |
5840 | * Abstract base block cipher mode template. | |
5841 | */ | |
5842 | var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ | |
5843 | /** | |
5844 | * Creates this mode for encryption. | |
5845 | * | |
5846 | * @param {Cipher} cipher A block cipher instance. | |
5847 | * @param {Array} iv The IV words. | |
5848 | * | |
5849 | * @static | |
5850 | * | |
5851 | * @example | |
5852 | * | |
5853 | * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); | |
5854 | */ | |
5855 | createEncryptor: function (cipher, iv) { | |
5856 | return this.Encryptor.create(cipher, iv); | |
5857 | }, | |
5858 | ||
5859 | /** | |
5860 | * Creates this mode for decryption. | |
5861 | * | |
5862 | * @param {Cipher} cipher A block cipher instance. | |
5863 | * @param {Array} iv The IV words. | |
5864 | * | |
5865 | * @static | |
5866 | * | |
5867 | * @example | |
5868 | * | |
5869 | * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); | |
5870 | */ | |
5871 | createDecryptor: function (cipher, iv) { | |
5872 | return this.Decryptor.create(cipher, iv); | |
5873 | }, | |
5874 | ||
5875 | /** | |
5876 | * Initializes a newly created mode. | |
5877 | * | |
5878 | * @param {Cipher} cipher A block cipher instance. | |
5879 | * @param {Array} iv The IV words. | |
5880 | * | |
5881 | * @example | |
5882 | * | |
5883 | * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); | |
5884 | */ | |
5885 | init: function (cipher, iv) { | |
5886 | this._cipher = cipher; | |
5887 | this._iv = iv; | |
5888 | } | |
5889 | }); | |
5890 | ||
5891 | /** | |
5892 | * Cipher Block Chaining mode. | |
5893 | */ | |
5894 | var CBC = C_mode.CBC = (function () { | |
5895 | /** | |
5896 | * Abstract base CBC mode. | |
5897 | */ | |
5898 | var CBC = BlockCipherMode.extend(); | |
5899 | ||
5900 | /** | |
5901 | * CBC encryptor. | |
5902 | */ | |
5903 | CBC.Encryptor = CBC.extend({ | |
5904 | /** | |
5905 | * Processes the data block at offset. | |
5906 | * | |
5907 | * @param {Array} words The data words to operate on. | |
5908 | * @param {number} offset The offset where the block starts. | |
5909 | * | |
5910 | * @example | |
5911 | * | |
5912 | * mode.processBlock(data.words, offset); | |
5913 | */ | |
5914 | processBlock: function (words, offset) { | |
5915 | // Shortcuts | |
5916 | var cipher = this._cipher; | |
5917 | var blockSize = cipher.blockSize; | |
5918 | ||
5919 | // XOR and encrypt | |
5920 | xorBlock.call(this, words, offset, blockSize); | |
5921 | cipher.encryptBlock(words, offset); | |
5922 | ||
5923 | // Remember this block to use with next block | |
5924 | this._prevBlock = words.slice(offset, offset + blockSize); | |
5925 | } | |
5926 | }); | |
5927 | ||
5928 | /** | |
5929 | * CBC decryptor. | |
5930 | */ | |
5931 | CBC.Decryptor = CBC.extend({ | |
5932 | /** | |
5933 | * Processes the data block at offset. | |
5934 | * | |
5935 | * @param {Array} words The data words to operate on. | |
5936 | * @param {number} offset The offset where the block starts. | |
5937 | * | |
5938 | * @example | |
5939 | * | |
5940 | * mode.processBlock(data.words, offset); | |
5941 | */ | |
5942 | processBlock: function (words, offset) { | |
5943 | // Shortcuts | |
5944 | var cipher = this._cipher; | |
5945 | var blockSize = cipher.blockSize; | |
5946 | ||
5947 | // Remember this block to use with next block | |
5948 | var thisBlock = words.slice(offset, offset + blockSize); | |
5949 | ||
5950 | // Decrypt and XOR | |
5951 | cipher.decryptBlock(words, offset); | |
5952 | xorBlock.call(this, words, offset, blockSize); | |
5953 | ||
5954 | // This block becomes the previous block | |
5955 | this._prevBlock = thisBlock; | |
5956 | } | |
5957 | }); | |
5958 | ||
5959 | function xorBlock(words, offset, blockSize) { | |
5960 | // Shortcut | |
5961 | var iv = this._iv; | |
5962 | ||
5963 | // Choose mixing block | |
5964 | if (iv) { | |
5965 | var block = iv; | |
5966 | ||
5967 | // Remove IV for subsequent blocks | |
5968 | this._iv = undefined; | |
5969 | } else { | |
5970 | var block = this._prevBlock; | |
5971 | } | |
5972 | ||
5973 | // XOR blocks | |
5974 | for (var i = 0; i < blockSize; i++) { | |
5975 | words[offset + i] ^= block[i]; | |
5976 | } | |
5977 | } | |
5978 | ||
5979 | return CBC; | |
5980 | }()); | |
5981 | ||
5982 | /** | |
5983 | * Padding namespace. | |
5984 | */ | |
5985 | var C_pad = C.pad = {}; | |
5986 | ||
5987 | /** | |
5988 | * PKCS #5/7 padding strategy. | |
5989 | */ | |
5990 | var Pkcs7 = C_pad.Pkcs7 = { | |
5991 | /** | |
5992 | * Pads data using the algorithm defined in PKCS #5/7. | |
5993 | * | |
5994 | * @param {WordArray} data The data to pad. | |
5995 | * @param {number} blockSize The multiple that the data should be padded to. | |
5996 | * | |
5997 | * @static | |
5998 | * | |
5999 | * @example | |
6000 | * | |
6001 | * CryptoJS.pad.Pkcs7.pad(wordArray, 4); | |
6002 | */ | |
6003 | pad: function (data, blockSize) { | |
6004 | // Shortcut | |
6005 | var blockSizeBytes = blockSize * 4; | |
6006 | ||
6007 | // Count padding bytes | |
6008 | var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; | |
6009 | ||
6010 | // Create padding word | |
6011 | var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes; | |
6012 | ||
6013 | // Create padding | |
6014 | var paddingWords = []; | |
6015 | for (var i = 0; i < nPaddingBytes; i += 4) { | |
6016 | paddingWords.push(paddingWord); | |
6017 | } | |
6018 | var padding = WordArray.create(paddingWords, nPaddingBytes); | |
6019 | ||
6020 | // Add padding | |
6021 | data.concat(padding); | |
6022 | }, | |
6023 | ||
6024 | /** | |
6025 | * Unpads data that had been padded using the algorithm defined in PKCS #5/7. | |
6026 | * | |
6027 | * @param {WordArray} data The data to unpad. | |
6028 | * | |
6029 | * @static | |
6030 | * | |
6031 | * @example | |
6032 | * | |
6033 | * CryptoJS.pad.Pkcs7.unpad(wordArray); | |
6034 | */ | |
6035 | unpad: function (data) { | |
6036 | // Get number of padding bytes from last byte | |
6037 | var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; | |
6038 | ||
6039 | // Remove padding | |
6040 | data.sigBytes -= nPaddingBytes; | |
6041 | } | |
6042 | }; | |
6043 | ||
6044 | /** | |
6045 | * Abstract base block cipher template. | |
6046 | * | |
6047 | * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) | |
6048 | */ | |
6049 | var BlockCipher = C_lib.BlockCipher = Cipher.extend({ | |
6050 | /** | |
6051 | * Configuration options. | |
6052 | * | |
6053 | * @property {Mode} mode The block mode to use. Default: CBC | |
6054 | * @property {Padding} padding The padding strategy to use. Default: Pkcs7 | |
6055 | */ | |
6056 | cfg: Cipher.cfg.extend({ | |
6057 | mode: CBC, | |
6058 | padding: Pkcs7 | |
6059 | }), | |
6060 | ||
6061 | reset: function () { | |
6062 | // Reset cipher | |
6063 | Cipher.reset.call(this); | |
6064 | ||
6065 | // Shortcuts | |
6066 | var cfg = this.cfg; | |
6067 | var iv = cfg.iv; | |
6068 | var mode = cfg.mode; | |
6069 | ||
6070 | // Reset block mode | |
6071 | if (this._xformMode == this._ENC_XFORM_MODE) { | |
6072 | var modeCreator = mode.createEncryptor; | |
6073 | } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { | |
6074 | var modeCreator = mode.createDecryptor; | |
6075 | ||
6076 | // Keep at least one block in the buffer for unpadding | |
6077 | this._minBufferSize = 1; | |
6078 | } | |
6079 | this._mode = modeCreator.call(mode, this, iv && iv.words); | |
6080 | }, | |
6081 | ||
6082 | _doProcessBlock: function (words, offset) { | |
6083 | this._mode.processBlock(words, offset); | |
6084 | }, | |
6085 | ||
6086 | _doFinalize: function () { | |
6087 | // Shortcut | |
6088 | var padding = this.cfg.padding; | |
6089 | ||
6090 | // Finalize | |
6091 | if (this._xformMode == this._ENC_XFORM_MODE) { | |
6092 | // Pad data | |
6093 | padding.pad(this._data, this.blockSize); | |
6094 | ||
6095 | // Process final blocks | |
6096 | var finalProcessedBlocks = this._process(!!'flush'); | |
6097 | } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { | |
6098 | // Process final blocks | |
6099 | var finalProcessedBlocks = this._process(!!'flush'); | |
6100 | ||
6101 | // Unpad data | |
6102 | padding.unpad(finalProcessedBlocks); | |
6103 | } | |
6104 | ||
6105 | return finalProcessedBlocks; | |
6106 | }, | |
6107 | ||
6108 | blockSize: 128/32 | |
6109 | }); | |
6110 | ||
6111 | /** | |
6112 | * A collection of cipher parameters. | |
6113 | * | |
6114 | * @property {WordArray} ciphertext The raw ciphertext. | |
6115 | * @property {WordArray} key The key to this ciphertext. | |
6116 | * @property {WordArray} iv The IV used in the ciphering operation. | |
6117 | * @property {WordArray} salt The salt used with a key derivation function. | |
6118 | * @property {Cipher} algorithm The cipher algorithm. | |
6119 | * @property {Mode} mode The block mode used in the ciphering operation. | |
6120 | * @property {Padding} padding The padding scheme used in the ciphering operation. | |
6121 | * @property {number} blockSize The block size of the cipher. | |
6122 | * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. | |
6123 | */ | |
6124 | var CipherParams = C_lib.CipherParams = Base.extend({ | |
6125 | /** | |
6126 | * Initializes a newly created cipher params object. | |
6127 | * | |
6128 | * @param {Object} cipherParams An object with any of the possible cipher parameters. | |
6129 | * | |
6130 | * @example | |
6131 | * | |
6132 | * var cipherParams = CryptoJS.lib.CipherParams.create({ | |
6133 | * ciphertext: ciphertextWordArray, | |
6134 | * key: keyWordArray, | |
6135 | * iv: ivWordArray, | |
6136 | * salt: saltWordArray, | |
6137 | * algorithm: CryptoJS.algo.AES, | |
6138 | * mode: CryptoJS.mode.CBC, | |
6139 | * padding: CryptoJS.pad.PKCS7, | |
6140 | * blockSize: 4, | |
6141 | * formatter: CryptoJS.format.OpenSSL | |
6142 | * }); | |
6143 | */ | |
6144 | init: function (cipherParams) { | |
6145 | this.mixIn(cipherParams); | |
6146 | }, | |
6147 | ||
6148 | /** | |
6149 | * Converts this cipher params object to a string. | |
6150 | * | |
6151 | * @param {Format} formatter (Optional) The formatting strategy to use. | |
6152 | * | |
6153 | * @return {string} The stringified cipher params. | |
6154 | * | |
6155 | * @throws Error If neither the formatter nor the default formatter is set. | |
6156 | * | |
6157 | * @example | |
6158 | * | |
6159 | * var string = cipherParams + ''; | |
6160 | * var string = cipherParams.toString(); | |
6161 | * var string = cipherParams.toString(CryptoJS.format.OpenSSL); | |
6162 | */ | |
6163 | toString: function (formatter) { | |
6164 | return (formatter || this.formatter).stringify(this); | |
6165 | } | |
6166 | }); | |
6167 | ||
6168 | /** | |
6169 | * Format namespace. | |
6170 | */ | |
6171 | var C_format = C.format = {}; | |
6172 | ||
6173 | /** | |
6174 | * OpenSSL formatting strategy. | |
6175 | */ | |
6176 | var OpenSSLFormatter = C_format.OpenSSL = { | |
6177 | /** | |
6178 | * Converts a cipher params object to an OpenSSL-compatible string. | |
6179 | * | |
6180 | * @param {CipherParams} cipherParams The cipher params object. | |
6181 | * | |
6182 | * @return {string} The OpenSSL-compatible string. | |
6183 | * | |
6184 | * @static | |
6185 | * | |
6186 | * @example | |
6187 | * | |
6188 | * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); | |
6189 | */ | |
6190 | stringify: function (cipherParams) { | |
6191 | // Shortcuts | |
6192 | var ciphertext = cipherParams.ciphertext; | |
6193 | var salt = cipherParams.salt; | |
6194 | ||
6195 | // Format | |
6196 | if (salt) { | |
6197 | var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); | |
6198 | } else { | |
6199 | var wordArray = ciphertext; | |
6200 | } | |
6201 | ||
6202 | return wordArray.toString(Base64); | |
6203 | }, | |
6204 | ||
6205 | /** | |
6206 | * Converts an OpenSSL-compatible string to a cipher params object. | |
6207 | * | |
6208 | * @param {string} openSSLStr The OpenSSL-compatible string. | |
6209 | * | |
6210 | * @return {CipherParams} The cipher params object. | |
6211 | * | |
6212 | * @static | |
6213 | * | |
6214 | * @example | |
6215 | * | |
6216 | * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); | |
6217 | */ | |
6218 | parse: function (openSSLStr) { | |
6219 | // Parse base64 | |
6220 | var ciphertext = Base64.parse(openSSLStr); | |
6221 | ||
6222 | // Shortcut | |
6223 | var ciphertextWords = ciphertext.words; | |
6224 | ||
6225 | // Test for salt | |
6226 | if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { | |
6227 | // Extract salt | |
6228 | var salt = WordArray.create(ciphertextWords.slice(2, 4)); | |
6229 | ||
6230 | // Remove salt from ciphertext | |
6231 | ciphertextWords.splice(0, 4); | |
6232 | ciphertext.sigBytes -= 16; | |
6233 | } | |
6234 | ||
6235 | return CipherParams.create({ ciphertext: ciphertext, salt: salt }); | |
6236 | } | |
6237 | }; | |
6238 | ||
6239 | /** | |
6240 | * A cipher wrapper that returns ciphertext as a serializable cipher params object. | |
6241 | */ | |
6242 | var SerializableCipher = C_lib.SerializableCipher = Base.extend({ | |
6243 | /** | |
6244 | * Configuration options. | |
6245 | * | |
6246 | * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL | |
6247 | */ | |
6248 | cfg: Base.extend({ | |
6249 | format: OpenSSLFormatter | |
6250 | }), | |
6251 | ||
6252 | /** | |
6253 | * Encrypts a message. | |
6254 | * | |
6255 | * @param {Cipher} cipher The cipher algorithm to use. | |
6256 | * @param {WordArray|string} message The message to encrypt. | |
6257 | * @param {WordArray} key The key. | |
6258 | * @param {Object} cfg (Optional) The configuration options to use for this operation. | |
6259 | * | |
6260 | * @return {CipherParams} A cipher params object. | |
6261 | * | |
6262 | * @static | |
6263 | * | |
6264 | * @example | |
6265 | * | |
6266 | * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); | |
6267 | * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); | |
6268 | * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); | |
6269 | */ | |
6270 | encrypt: function (cipher, message, key, cfg) { | |
6271 | // Apply config defaults | |
6272 | cfg = this.cfg.extend(cfg); | |
6273 | ||
6274 | // Encrypt | |
6275 | var encryptor = cipher.createEncryptor(key, cfg); | |
6276 | var ciphertext = encryptor.finalize(message); | |
6277 | ||
6278 | // Shortcut | |
6279 | var cipherCfg = encryptor.cfg; | |
6280 | ||
6281 | // Create and return serializable cipher params | |
6282 | return CipherParams.create({ | |
6283 | ciphertext: ciphertext, | |
6284 | key: key, | |
6285 | iv: cipherCfg.iv, | |
6286 | algorithm: cipher, | |
6287 | mode: cipherCfg.mode, | |
6288 | padding: cipherCfg.padding, | |
6289 | blockSize: cipher.blockSize, | |
6290 | formatter: cfg.format | |
6291 | }); | |
6292 | }, | |
6293 | ||
6294 | /** | |
6295 | * Decrypts serialized ciphertext. | |
6296 | * | |
6297 | * @param {Cipher} cipher The cipher algorithm to use. | |
6298 | * @param {CipherParams|string} ciphertext The ciphertext to decrypt. | |
6299 | * @param {WordArray} key The key. | |
6300 | * @param {Object} cfg (Optional) The configuration options to use for this operation. | |
6301 | * | |
6302 | * @return {WordArray} The plaintext. | |
6303 | * | |
6304 | * @static | |
6305 | * | |
6306 | * @example | |
6307 | * | |
6308 | * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); | |
6309 | * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); | |
6310 | */ | |
6311 | decrypt: function (cipher, ciphertext, key, cfg) { | |
6312 | // Apply config defaults | |
6313 | cfg = this.cfg.extend(cfg); | |
6314 | ||
6315 | // Convert string to CipherParams | |
6316 | ciphertext = this._parse(ciphertext, cfg.format); | |
6317 | ||
6318 | // Decrypt | |
6319 | var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); | |
6320 | ||
6321 | return plaintext; | |
6322 | }, | |
6323 | ||
6324 | /** | |
6325 | * Converts serialized ciphertext to CipherParams, | |
6326 | * else assumed CipherParams already and returns ciphertext unchanged. | |
6327 | * | |
6328 | * @param {CipherParams|string} ciphertext The ciphertext. | |
6329 | * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. | |
6330 | * | |
6331 | * @return {CipherParams} The unserialized ciphertext. | |
6332 | * | |
6333 | * @static | |
6334 | * | |
6335 | * @example | |
6336 | * | |
6337 | * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); | |
6338 | */ | |
6339 | _parse: function (ciphertext, format) { | |
6340 | if (typeof ciphertext == 'string') { | |
6341 | return format.parse(ciphertext, this); | |
6342 | } else { | |
6343 | return ciphertext; | |
6344 | } | |
6345 | } | |
6346 | }); | |
6347 | ||
6348 | /** | |
6349 | * Key derivation function namespace. | |
6350 | */ | |
6351 | var C_kdf = C.kdf = {}; | |
6352 | ||
6353 | /** | |
6354 | * OpenSSL key derivation function. | |
6355 | */ | |
6356 | var OpenSSLKdf = C_kdf.OpenSSL = { | |
6357 | /** | |
6358 | * Derives a key and IV from a password. | |
6359 | * | |
6360 | * @param {string} password The password to derive from. | |
6361 | * @param {number} keySize The size in words of the key to generate. | |
6362 | * @param {number} ivSize The size in words of the IV to generate. | |
6363 | * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. | |
6364 | * | |
6365 | * @return {CipherParams} A cipher params object with the key, IV, and salt. | |
6366 | * | |
6367 | * @static | |
6368 | * | |
6369 | * @example | |
6370 | * | |
6371 | * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); | |
6372 | * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); | |
6373 | */ | |
6374 | execute: function (password, keySize, ivSize, salt) { | |
6375 | // Generate random salt | |
6376 | if (!salt) { | |
6377 | salt = WordArray.random(64/8); | |
6378 | } | |
6379 | ||
6380 | // Derive key and IV | |
6381 | var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt); | |
6382 | ||
6383 | // Separate key and IV | |
6384 | var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); | |
6385 | key.sigBytes = keySize * 4; | |
6386 | ||
6387 | // Return params | |
6388 | return CipherParams.create({ key: key, iv: iv, salt: salt }); | |
6389 | } | |
6390 | }; | |
6391 | ||
6392 | /** | |
6393 | * A serializable cipher wrapper that derives the key from a password, | |
6394 | * and returns ciphertext as a serializable cipher params object. | |
6395 | */ | |
6396 | var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ | |
6397 | /** | |
6398 | * Configuration options. | |
6399 | * | |
6400 | * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL | |
6401 | */ | |
6402 | cfg: SerializableCipher.cfg.extend({ | |
6403 | kdf: OpenSSLKdf | |
6404 | }), | |
6405 | ||
6406 | /** | |
6407 | * Encrypts a message using a password. | |
6408 | * | |
6409 | * @param {Cipher} cipher The cipher algorithm to use. | |
6410 | * @param {WordArray|string} message The message to encrypt. | |
6411 | * @param {string} password The password. | |
6412 | * @param {Object} cfg (Optional) The configuration options to use for this operation. | |
6413 | * | |
6414 | * @return {CipherParams} A cipher params object. | |
6415 | * | |
6416 | * @static | |
6417 | * | |
6418 | * @example | |
6419 | * | |
6420 | * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); | |
6421 | * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); | |
6422 | */ | |
6423 | encrypt: function (cipher, message, password, cfg) { | |
6424 | // Apply config defaults | |
6425 | cfg = this.cfg.extend(cfg); | |
6426 | ||
6427 | // Derive key and other params | |
6428 | var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); | |
6429 | ||
6430 | // Add IV to config | |
6431 | cfg.iv = derivedParams.iv; | |
6432 | ||
6433 | // Encrypt | |
6434 | var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); | |
6435 | ||
6436 | // Mix in derived params | |
6437 | ciphertext.mixIn(derivedParams); | |
6438 | ||
6439 | return ciphertext; | |
6440 | }, | |
6441 | ||
6442 | /** | |
6443 | * Decrypts serialized ciphertext using a password. | |
6444 | * | |
6445 | * @param {Cipher} cipher The cipher algorithm to use. | |
6446 | * @param {CipherParams|string} ciphertext The ciphertext to decrypt. | |
6447 | * @param {string} password The password. | |
6448 | * @param {Object} cfg (Optional) The configuration options to use for this operation. | |
6449 | * | |
6450 | * @return {WordArray} The plaintext. | |
6451 | * | |
6452 | * @static | |
6453 | * | |
6454 | * @example | |
6455 | * | |
6456 | * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); | |
6457 | * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); | |
6458 | */ | |
6459 | decrypt: function (cipher, ciphertext, password, cfg) { | |
6460 | // Apply config defaults | |
6461 | cfg = this.cfg.extend(cfg); | |
6462 | ||
6463 | // Convert string to CipherParams | |
6464 | ciphertext = this._parse(ciphertext, cfg.format); | |
6465 | ||
6466 | // Derive key and other params | |
6467 | var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); | |
6468 | ||
6469 | // Add IV to config | |
6470 | cfg.iv = derivedParams.iv; | |
6471 | ||
6472 | // Decrypt | |
6473 | var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); | |
6474 | ||
6475 | return plaintext; | |
6476 | } | |
6477 | }); | |
6478 | }()); | |
6479 | ||
6480 | ||
6481 | })); | |
6482 | },{"./core":31}],31:[function(_dereq_,module,exports){ | |
6483 | ;(function (root, factory) { | |
6484 | if (typeof exports === "object") { | |
6485 | // CommonJS | |
6486 | module.exports = exports = factory(); | |
6487 | } | |
6488 | else if (typeof define === "function" && define.amd) { | |
6489 | // AMD | |
6490 | define([], factory); | |
6491 | } | |
6492 | else { | |
6493 | // Global (browser) | |
6494 | root.CryptoJS = factory(); | |
6495 | } | |
6496 | }(this, function () { | |
6497 | ||
6498 | /** | |
6499 | * CryptoJS core components. | |
6500 | */ | |
6501 | var CryptoJS = CryptoJS || (function (Math, undefined) { | |
6502 | /** | |
6503 | * CryptoJS namespace. | |
6504 | */ | |
6505 | var C = {}; | |
6506 | ||
6507 | /** | |
6508 | * Library namespace. | |
6509 | */ | |
6510 | var C_lib = C.lib = {}; | |
6511 | ||
6512 | /** | |
6513 | * Base object for prototypal inheritance. | |
6514 | */ | |
6515 | var Base = C_lib.Base = (function () { | |
6516 | function F() {} | |
6517 | ||
6518 | return { | |
6519 | /** | |
6520 | * Creates a new object that inherits from this object. | |
6521 | * | |
6522 | * @param {Object} overrides Properties to copy into the new object. | |
6523 | * | |
6524 | * @return {Object} The new object. | |
6525 | * | |
6526 | * @static | |
6527 | * | |
6528 | * @example | |
6529 | * | |
6530 | * var MyType = CryptoJS.lib.Base.extend({ | |
6531 | * field: 'value', | |
6532 | * | |
6533 | * method: function () { | |
6534 | * } | |
6535 | * }); | |
6536 | */ | |
6537 | extend: function (overrides) { | |
6538 | // Spawn | |
6539 | F.prototype = this; | |
6540 | var subtype = new F(); | |
6541 | ||
6542 | // Augment | |
6543 | if (overrides) { | |
6544 | subtype.mixIn(overrides); | |
6545 | } | |
6546 | ||
6547 | // Create default initializer | |
6548 | if (!subtype.hasOwnProperty('init')) { | |
6549 | subtype.init = function () { | |
6550 | subtype.$super.init.apply(this, arguments); | |
6551 | }; | |
6552 | } | |
6553 | ||
6554 | // Initializer's prototype is the subtype object | |
6555 | subtype.init.prototype = subtype; | |
6556 | ||
6557 | // Reference supertype | |
6558 | subtype.$super = this; | |
6559 | ||
6560 | return subtype; | |
6561 | }, | |
6562 | ||
6563 | /** | |
6564 | * Extends this object and runs the init method. | |
6565 | * Arguments to create() will be passed to init(). | |
6566 | * | |
6567 | * @return {Object} The new object. | |
6568 | * | |
6569 | * @static | |
6570 | * | |
6571 | * @example | |
6572 | * | |
6573 | * var instance = MyType.create(); | |
6574 | */ | |
6575 | create: function () { | |
6576 | var instance = this.extend(); | |
6577 | instance.init.apply(instance, arguments); | |
6578 | ||
6579 | return instance; | |
6580 | }, | |
6581 | ||
6582 | /** | |
6583 | * Initializes a newly created object. | |
6584 | * Override this method to add some logic when your objects are created. | |
6585 | * | |
6586 | * @example | |
6587 | * | |
6588 | * var MyType = CryptoJS.lib.Base.extend({ | |
6589 | * init: function () { | |
6590 | * // ... | |
6591 | * } | |
6592 | * }); | |
6593 | */ | |
6594 | init: function () { | |
6595 | }, | |
6596 | ||
6597 | /** | |
6598 | * Copies properties into this object. | |
6599 | * | |
6600 | * @param {Object} properties The properties to mix in. | |
6601 | * | |
6602 | * @example | |
6603 | * | |
6604 | * MyType.mixIn({ | |
6605 | * field: 'value' | |
6606 | * }); | |
6607 | */ | |
6608 | mixIn: function (properties) { | |
6609 | for (var propertyName in properties) { | |
6610 | if (properties.hasOwnProperty(propertyName)) { | |
6611 | this[propertyName] = properties[propertyName]; | |
6612 | } | |
6613 | } | |
6614 | ||
6615 | // IE won't copy toString using the loop above | |
6616 | if (properties.hasOwnProperty('toString')) { | |
6617 | this.toString = properties.toString; | |
6618 | } | |
6619 | }, | |
6620 | ||
6621 | /** | |
6622 | * Creates a copy of this object. | |
6623 | * | |
6624 | * @return {Object} The clone. | |
6625 | * | |
6626 | * @example | |
6627 | * | |
6628 | * var clone = instance.clone(); | |
6629 | */ | |
6630 | clone: function () { | |
6631 | return this.init.prototype.extend(this); | |
6632 | } | |
6633 | }; | |
6634 | }()); | |
6635 | ||
6636 | /** | |
6637 | * An array of 32-bit words. | |
6638 | * | |
6639 | * @property {Array} words The array of 32-bit words. | |
6640 | * @property {number} sigBytes The number of significant bytes in this word array. | |
6641 | */ | |
6642 | var WordArray = C_lib.WordArray = Base.extend({ | |
6643 | /** | |
6644 | * Initializes a newly created word array. | |
6645 | * | |
6646 | * @param {Array} words (Optional) An array of 32-bit words. | |
6647 | * @param {number} sigBytes (Optional) The number of significant bytes in the words. | |
6648 | * | |
6649 | * @example | |
6650 | * | |
6651 | * var wordArray = CryptoJS.lib.WordArray.create(); | |
6652 | * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); | |
6653 | * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); | |
6654 | */ | |
6655 | init: function (words, sigBytes) { | |
6656 | words = this.words = words || []; | |
6657 | ||
6658 | if (sigBytes != undefined) { | |
6659 | this.sigBytes = sigBytes; | |
6660 | } else { | |
6661 | this.sigBytes = words.length * 4; | |
6662 | } | |
6663 | }, | |
6664 | ||
6665 | /** | |
6666 | * Converts this word array to a string. | |
6667 | * | |
6668 | * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex | |
6669 | * | |
6670 | * @return {string} The stringified word array. | |
6671 | * | |
6672 | * @example | |
6673 | * | |
6674 | * var string = wordArray + ''; | |
6675 | * var string = wordArray.toString(); | |
6676 | * var string = wordArray.toString(CryptoJS.enc.Utf8); | |
6677 | */ | |
6678 | toString: function (encoder) { | |
6679 | return (encoder || Hex).stringify(this); | |
6680 | }, | |
6681 | ||
6682 | /** | |
6683 | * Concatenates a word array to this word array. | |
6684 | * | |
6685 | * @param {WordArray} wordArray The word array to append. | |
6686 | * | |
6687 | * @return {WordArray} This word array. | |
6688 | * | |
6689 | * @example | |
6690 | * | |
6691 | * wordArray1.concat(wordArray2); | |
6692 | */ | |
6693 | concat: function (wordArray) { | |
6694 | // Shortcuts | |
6695 | var thisWords = this.words; | |
6696 | var thatWords = wordArray.words; | |
6697 | var thisSigBytes = this.sigBytes; | |
6698 | var thatSigBytes = wordArray.sigBytes; | |
6699 | ||
6700 | // Clamp excess bits | |
6701 | this.clamp(); | |
6702 | ||
6703 | // Concat | |
6704 | if (thisSigBytes % 4) { | |
6705 | // Copy one byte at a time | |
6706 | for (var i = 0; i < thatSigBytes; i++) { | |
6707 | var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; | |
6708 | thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); | |
6709 | } | |
6710 | } else if (thatWords.length > 0xffff) { | |
6711 | // Copy one word at a time | |
6712 | for (var i = 0; i < thatSigBytes; i += 4) { | |
6713 | thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2]; | |
6714 | } | |
6715 | } else { | |
6716 | // Copy all words at once | |
6717 | thisWords.push.apply(thisWords, thatWords); | |
6718 | } | |
6719 | this.sigBytes += thatSigBytes; | |
6720 | ||
6721 | // Chainable | |
6722 | return this; | |
6723 | }, | |
6724 | ||
6725 | /** | |
6726 | * Removes insignificant bits. | |
6727 | * | |
6728 | * @example | |
6729 | * | |
6730 | * wordArray.clamp(); | |
6731 | */ | |
6732 | clamp: function () { | |
6733 | // Shortcuts | |
6734 | var words = this.words; | |
6735 | var sigBytes = this.sigBytes; | |
6736 | ||
6737 | // Clamp | |
6738 | words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); | |
6739 | words.length = Math.ceil(sigBytes / 4); | |
6740 | }, | |
6741 | ||
6742 | /** | |
6743 | * Creates a copy of this word array. | |
6744 | * | |
6745 | * @return {WordArray} The clone. | |
6746 | * | |
6747 | * @example | |
6748 | * | |
6749 | * var clone = wordArray.clone(); | |
6750 | */ | |
6751 | clone: function () { | |
6752 | var clone = Base.clone.call(this); | |
6753 | clone.words = this.words.slice(0); | |
6754 | ||
6755 | return clone; | |
6756 | }, | |
6757 | ||
6758 | /** | |
6759 | * Creates a word array filled with random bytes. | |
6760 | * | |
6761 | * @param {number} nBytes The number of random bytes to generate. | |
6762 | * | |
6763 | * @return {WordArray} The random word array. | |
6764 | * | |
6765 | * @static | |
6766 | * | |
6767 | * @example | |
6768 | * | |
6769 | * var wordArray = CryptoJS.lib.WordArray.random(16); | |
6770 | */ | |
6771 | random: function (nBytes) { | |
6772 | var words = []; | |
6773 | for (var i = 0; i < nBytes; i += 4) { | |
6774 | words.push((Math.random() * 0x100000000) | 0); | |
6775 | } | |
6776 | ||
6777 | return new WordArray.init(words, nBytes); | |
6778 | } | |
6779 | }); | |
6780 | ||
6781 | /** | |
6782 | * Encoder namespace. | |
6783 | */ | |
6784 | var C_enc = C.enc = {}; | |
6785 | ||
6786 | /** | |
6787 | * Hex encoding strategy. | |
6788 | */ | |
6789 | var Hex = C_enc.Hex = { | |
6790 | /** | |
6791 | * Converts a word array to a hex string. | |
6792 | * | |
6793 | * @param {WordArray} wordArray The word array. | |
6794 | * | |
6795 | * @return {string} The hex string. | |
6796 | * | |
6797 | * @static | |
6798 | * | |
6799 | * @example | |
6800 | * | |
6801 | * var hexString = CryptoJS.enc.Hex.stringify(wordArray); | |
6802 | */ | |
6803 | stringify: function (wordArray) { | |
6804 | // Shortcuts | |
6805 | var words = wordArray.words; | |
6806 | var sigBytes = wordArray.sigBytes; | |
6807 | ||
6808 | // Convert | |
6809 | var hexChars = []; | |
6810 | for (var i = 0; i < sigBytes; i++) { | |
6811 | var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; | |
6812 | hexChars.push((bite >>> 4).toString(16)); | |
6813 | hexChars.push((bite & 0x0f).toString(16)); | |
6814 | } | |
6815 | ||
6816 | return hexChars.join(''); | |
6817 | }, | |
6818 | ||
6819 | /** | |
6820 | * Converts a hex string to a word array. | |
6821 | * | |
6822 | * @param {string} hexStr The hex string. | |
6823 | * | |
6824 | * @return {WordArray} The word array. | |
6825 | * | |
6826 | * @static | |
6827 | * | |
6828 | * @example | |
6829 | * | |
6830 | * var wordArray = CryptoJS.enc.Hex.parse(hexString); | |
6831 | */ | |
6832 | parse: function (hexStr) { | |
6833 | // Shortcut | |
6834 | var hexStrLength = hexStr.length; | |
6835 | ||
6836 | // Convert | |
6837 | var words = []; | |
6838 | for (var i = 0; i < hexStrLength; i += 2) { | |
6839 | words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); | |
6840 | } | |
6841 | ||
6842 | return new WordArray.init(words, hexStrLength / 2); | |
6843 | } | |
6844 | }; | |
6845 | ||
6846 | /** | |
6847 | * Latin1 encoding strategy. | |
6848 | */ | |
6849 | var Latin1 = C_enc.Latin1 = { | |
6850 | /** | |
6851 | * Converts a word array to a Latin1 string. | |
6852 | * | |
6853 | * @param {WordArray} wordArray The word array. | |
6854 | * | |
6855 | * @return {string} The Latin1 string. | |
6856 | * | |
6857 | * @static | |
6858 | * | |
6859 | * @example | |
6860 | * | |
6861 | * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); | |
6862 | */ | |
6863 | stringify: function (wordArray) { | |
6864 | // Shortcuts | |
6865 | var words = wordArray.words; | |
6866 | var sigBytes = wordArray.sigBytes; | |
6867 | ||
6868 | // Convert | |
6869 | var latin1Chars = []; | |
6870 | for (var i = 0; i < sigBytes; i++) { | |
6871 | var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; | |
6872 | latin1Chars.push(String.fromCharCode(bite)); | |
6873 | } | |
6874 | ||
6875 | return latin1Chars.join(''); | |
6876 | }, | |
6877 | ||
6878 | /** | |
6879 | * Converts a Latin1 string to a word array. | |
6880 | * | |
6881 | * @param {string} latin1Str The Latin1 string. | |
6882 | * | |
6883 | * @return {WordArray} The word array. | |
6884 | * | |
6885 | * @static | |
6886 | * | |
6887 | * @example | |
6888 | * | |
6889 | * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); | |
6890 | */ | |
6891 | parse: function (latin1Str) { | |
6892 | // Shortcut | |
6893 | var latin1StrLength = latin1Str.length; | |
6894 | ||
6895 | // Convert | |
6896 | var words = []; | |
6897 | for (var i = 0; i < latin1StrLength; i++) { | |
6898 | words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); | |
6899 | } | |
6900 | ||
6901 | return new WordArray.init(words, latin1StrLength); | |
6902 | } | |
6903 | }; | |
6904 | ||
6905 | /** | |
6906 | * UTF-8 encoding strategy. | |
6907 | */ | |
6908 | var Utf8 = C_enc.Utf8 = { | |
6909 | /** | |
6910 | * Converts a word array to a UTF-8 string. | |
6911 | * | |
6912 | * @param {WordArray} wordArray The word array. | |
6913 | * | |
6914 | * @return {string} The UTF-8 string. | |
6915 | * | |
6916 | * @static | |
6917 | * | |
6918 | * @example | |
6919 | * | |
6920 | * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); | |
6921 | */ | |
6922 | stringify: function (wordArray) { | |
6923 | try { | |
6924 | return decodeURIComponent(escape(Latin1.stringify(wordArray))); | |
6925 | } catch (e) { | |
6926 | throw new Error('Malformed UTF-8 data'); | |
6927 | } | |
6928 | }, | |
6929 | ||
6930 | /** | |
6931 | * Converts a UTF-8 string to a word array. | |
6932 | * | |
6933 | * @param {string} utf8Str The UTF-8 string. | |
6934 | * | |
6935 | * @return {WordArray} The word array. | |
6936 | * | |
6937 | * @static | |
6938 | * | |
6939 | * @example | |
6940 | * | |
6941 | * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); | |
6942 | */ | |
6943 | parse: function (utf8Str) { | |
6944 | return Latin1.parse(unescape(encodeURIComponent(utf8Str))); | |
6945 | } | |
6946 | }; | |
6947 | ||
6948 | /** | |
6949 | * Abstract buffered block algorithm template. | |
6950 | * | |
6951 | * The property blockSize must be implemented in a concrete subtype. | |
6952 | * | |
6953 | * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 | |
6954 | */ | |
6955 | var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ | |
6956 | /** | |
6957 | * Resets this block algorithm's data buffer to its initial state. | |
6958 | * | |
6959 | * @example | |
6960 | * | |
6961 | * bufferedBlockAlgorithm.reset(); | |
6962 | */ | |
6963 | reset: function () { | |
6964 | // Initial values | |
6965 | this._data = new WordArray.init(); | |
6966 | this._nDataBytes = 0; | |
6967 | }, | |
6968 | ||
6969 | /** | |
6970 | * Adds new data to this block algorithm's buffer. | |
6971 | * | |
6972 | * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. | |
6973 | * | |
6974 | * @example | |
6975 | * | |
6976 | * bufferedBlockAlgorithm._append('data'); | |
6977 | * bufferedBlockAlgorithm._append(wordArray); | |
6978 | */ | |
6979 | _append: function (data) { | |
6980 | // Convert string to WordArray, else assume WordArray already | |
6981 | if (typeof data == 'string') { | |
6982 | data = Utf8.parse(data); | |
6983 | } | |
6984 | ||
6985 | // Append | |
6986 | this._data.concat(data); | |
6987 | this._nDataBytes += data.sigBytes; | |
6988 | }, | |
6989 | ||
6990 | /** | |
6991 | * Processes available data blocks. | |
6992 | * | |
6993 | * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. | |
6994 | * | |
6995 | * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. | |
6996 | * | |
6997 | * @return {WordArray} The processed data. | |
6998 | * | |
6999 | * @example | |
7000 | * | |
7001 | * var processedData = bufferedBlockAlgorithm._process(); | |
7002 | * var processedData = bufferedBlockAlgorithm._process(!!'flush'); | |
7003 | */ | |
7004 | _process: function (doFlush) { | |
7005 | // Shortcuts | |
7006 | var data = this._data; | |
7007 | var dataWords = data.words; | |
7008 | var dataSigBytes = data.sigBytes; | |
7009 | var blockSize = this.blockSize; | |
7010 | var blockSizeBytes = blockSize * 4; | |
7011 | ||
7012 | // Count blocks ready | |
7013 | var nBlocksReady = dataSigBytes / blockSizeBytes; | |
7014 | if (doFlush) { | |
7015 | // Round up to include partial blocks | |
7016 | nBlocksReady = Math.ceil(nBlocksReady); | |
7017 | } else { | |
7018 | // Round down to include only full blocks, | |
7019 | // less the number of blocks that must remain in the buffer | |
7020 | nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); | |
7021 | } | |
7022 | ||
7023 | // Count words ready | |
7024 | var nWordsReady = nBlocksReady * blockSize; | |
7025 | ||
7026 | // Count bytes ready | |
7027 | var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); | |
7028 | ||
7029 | // Process blocks | |
7030 | if (nWordsReady) { | |
7031 | for (var offset = 0; offset < nWordsReady; offset += blockSize) { | |
7032 | // Perform concrete-algorithm logic | |
7033 | this._doProcessBlock(dataWords, offset); | |
7034 | } | |
7035 | ||
7036 | // Remove processed words | |
7037 | var processedWords = dataWords.splice(0, nWordsReady); | |
7038 | data.sigBytes -= nBytesReady; | |
7039 | } | |
7040 | ||
7041 | // Return processed words | |
7042 | return new WordArray.init(processedWords, nBytesReady); | |
7043 | }, | |
7044 | ||
7045 | /** | |
7046 | * Creates a copy of this object. | |
7047 | * | |
7048 | * @return {Object} The clone. | |
7049 | * | |
7050 | * @example | |
7051 | * | |
7052 | * var clone = bufferedBlockAlgorithm.clone(); | |
7053 | */ | |
7054 | clone: function () { | |
7055 | var clone = Base.clone.call(this); | |
7056 | clone._data = this._data.clone(); | |
7057 | ||
7058 | return clone; | |
7059 | }, | |
7060 | ||
7061 | _minBufferSize: 0 | |
7062 | }); | |
7063 | ||
7064 | /** | |
7065 | * Abstract hasher template. | |
7066 | * | |
7067 | * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) | |
7068 | */ | |
7069 | var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ | |
7070 | /** | |
7071 | * Configuration options. | |
7072 | */ | |
7073 | cfg: Base.extend(), | |
7074 | ||
7075 | /** | |
7076 | * Initializes a newly created hasher. | |
7077 | * | |
7078 | * @param {Object} cfg (Optional) The configuration options to use for this hash computation. | |
7079 | * | |
7080 | * @example | |
7081 | * | |
7082 | * var hasher = CryptoJS.algo.SHA256.create(); | |
7083 | */ | |
7084 | init: function (cfg) { | |
7085 | // Apply config defaults | |
7086 | this.cfg = this.cfg.extend(cfg); | |
7087 | ||
7088 | // Set initial values | |
7089 | this.reset(); | |
7090 | }, | |
7091 | ||
7092 | /** | |
7093 | * Resets this hasher to its initial state. | |
7094 | * | |
7095 | * @example | |
7096 | * | |
7097 | * hasher.reset(); | |
7098 | */ | |
7099 | reset: function () { | |
7100 | // Reset data buffer | |
7101 | BufferedBlockAlgorithm.reset.call(this); | |
7102 | ||
7103 | // Perform concrete-hasher logic | |
7104 | this._doReset(); | |
7105 | }, | |
7106 | ||
7107 | /** | |
7108 | * Updates this hasher with a message. | |
7109 | * | |
7110 | * @param {WordArray|string} messageUpdate The message to append. | |
7111 | * | |
7112 | * @return {Hasher} This hasher. | |
7113 | * | |
7114 | * @example | |
7115 | * | |
7116 | * hasher.update('message'); | |
7117 | * hasher.update(wordArray); | |
7118 | */ | |
7119 | update: function (messageUpdate) { | |
7120 | // Append | |
7121 | this._append(messageUpdate); | |
7122 | ||
7123 | // Update the hash | |
7124 | this._process(); | |
7125 | ||
7126 | // Chainable | |
7127 | return this; | |
7128 | }, | |
7129 | ||
7130 | /** | |
7131 | * Finalizes the hash computation. | |
7132 | * Note that the finalize operation is effectively a destructive, read-once operation. | |
7133 | * | |
7134 | * @param {WordArray|string} messageUpdate (Optional) A final message update. | |
7135 | * | |
7136 | * @return {WordArray} The hash. | |
7137 | * | |
7138 | * @example | |
7139 | * | |
7140 | * var hash = hasher.finalize(); | |
7141 | * var hash = hasher.finalize('message'); | |
7142 | * var hash = hasher.finalize(wordArray); | |
7143 | */ | |
7144 | finalize: function (messageUpdate) { | |
7145 | // Final message update | |
7146 | if (messageUpdate) { | |
7147 | this._append(messageUpdate); | |
7148 | } | |
7149 | ||
7150 | // Perform concrete-hasher logic | |
7151 | var hash = this._doFinalize(); | |
7152 | ||
7153 | return hash; | |
7154 | }, | |
7155 | ||
7156 | blockSize: 512/32, | |
7157 | ||
7158 | /** | |
7159 | * Creates a shortcut function to a hasher's object interface. | |
7160 | * | |
7161 | * @param {Hasher} hasher The hasher to create a helper for. | |
7162 | * | |
7163 | * @return {Function} The shortcut function. | |
7164 | * | |
7165 | * @static | |
7166 | * | |
7167 | * @example | |
7168 | * | |
7169 | * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); | |
7170 | */ | |
7171 | _createHelper: function (hasher) { | |
7172 | return function (message, cfg) { | |
7173 | return new hasher.init(cfg).finalize(message); | |
7174 | }; | |
7175 | }, | |
7176 | ||
7177 | /** | |
7178 | * Creates a shortcut function to the HMAC's object interface. | |
7179 | * | |
7180 | * @param {Hasher} hasher The hasher to use in this HMAC helper. | |
7181 | * | |
7182 | * @return {Function} The shortcut function. | |
7183 | * | |
7184 | * @static | |
7185 | * | |
7186 | * @example | |
7187 | * | |
7188 | * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); | |
7189 | */ | |
7190 | _createHmacHelper: function (hasher) { | |
7191 | return function (message, key) { | |
7192 | return new C_algo.HMAC.init(hasher, key).finalize(message); | |
7193 | }; | |
7194 | } | |
7195 | }); | |
7196 | ||
7197 | /** | |
7198 | * Algorithm namespace. | |
7199 | */ | |
7200 | var C_algo = C.algo = {}; | |
7201 | ||
7202 | return C; | |
7203 | }(Math)); | |
7204 | ||
7205 | ||
7206 | return CryptoJS; | |
7207 | ||
7208 | })); | |
7209 | },{}],32:[function(_dereq_,module,exports){ | |
7210 | ;(function (root, factory) { | |
7211 | if (typeof exports === "object") { | |
7212 | // CommonJS | |
7213 | module.exports = exports = factory(_dereq_("./core")); | |
7214 | } | |
7215 | else if (typeof define === "function" && define.amd) { | |
7216 | // AMD | |
7217 | define(["./core"], factory); | |
7218 | } | |
7219 | else { | |
7220 | // Global (browser) | |
7221 | factory(root.CryptoJS); | |
7222 | } | |
7223 | }(this, function (CryptoJS) { | |
7224 | ||
7225 | (function () { | |
7226 | // Shortcuts | |
7227 | var C = CryptoJS; | |
7228 | var C_lib = C.lib; | |
7229 | var WordArray = C_lib.WordArray; | |
7230 | var C_enc = C.enc; | |
7231 | ||
7232 | /** | |
7233 | * Base64 encoding strategy. | |
7234 | */ | |
7235 | var Base64 = C_enc.Base64 = { | |
7236 | /** | |
7237 | * Converts a word array to a Base64 string. | |
7238 | * | |
7239 | * @param {WordArray} wordArray The word array. | |
7240 | * | |
7241 | * @return {string} The Base64 string. | |
7242 | * | |
7243 | * @static | |
7244 | * | |
7245 | * @example | |
7246 | * | |
7247 | * var base64String = CryptoJS.enc.Base64.stringify(wordArray); | |
7248 | */ | |
7249 | stringify: function (wordArray) { | |
7250 | // Shortcuts | |
7251 | var words = wordArray.words; | |
7252 | var sigBytes = wordArray.sigBytes; | |
7253 | var map = this._map; | |
7254 | ||
7255 | // Clamp excess bits | |
7256 | wordArray.clamp(); | |
7257 | ||
7258 | // Convert | |
7259 | var base64Chars = []; | |
7260 | for (var i = 0; i < sigBytes; i += 3) { | |
7261 | var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; | |
7262 | var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; | |
7263 | var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; | |
7264 | ||
7265 | var triplet = (byte1 << 16) | (byte2 << 8) | byte3; | |
7266 | ||
7267 | for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { | |
7268 | base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); | |
7269 | } | |
7270 | } | |
7271 | ||
7272 | // Add padding | |
7273 | var paddingChar = map.charAt(64); | |
7274 | if (paddingChar) { | |
7275 | while (base64Chars.length % 4) { | |
7276 | base64Chars.push(paddingChar); | |
7277 | } | |
7278 | } | |
7279 | ||
7280 | return base64Chars.join(''); | |
7281 | }, | |
7282 | ||
7283 | /** | |
7284 | * Converts a Base64 string to a word array. | |
7285 | * | |
7286 | * @param {string} base64Str The Base64 string. | |
7287 | * | |
7288 | * @return {WordArray} The word array. | |
7289 | * | |
7290 | * @static | |
7291 | * | |
7292 | * @example | |
7293 | * | |
7294 | * var wordArray = CryptoJS.enc.Base64.parse(base64String); | |
7295 | */ | |
7296 | parse: function (base64Str) { | |
7297 | // Shortcuts | |
7298 | var base64StrLength = base64Str.length; | |
7299 | var map = this._map; | |
7300 | ||
7301 | // Ignore padding | |
7302 | var paddingChar = map.charAt(64); | |
7303 | if (paddingChar) { | |
7304 | var paddingIndex = base64Str.indexOf(paddingChar); | |
7305 | if (paddingIndex != -1) { | |
7306 | base64StrLength = paddingIndex; | |
7307 | } | |
7308 | } | |
7309 | ||
7310 | // Convert | |
7311 | var words = []; | |
7312 | var nBytes = 0; | |
7313 | for (var i = 0; i < base64StrLength; i++) { | |
7314 | if (i % 4) { | |
7315 | var bits1 = map.indexOf(base64Str.charAt(i - 1)) << ((i % 4) * 2); | |
7316 | var bits2 = map.indexOf(base64Str.charAt(i)) >>> (6 - (i % 4) * 2); | |
7317 | words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8); | |
7318 | nBytes++; | |
7319 | } | |
7320 | } | |
7321 | ||
7322 | return WordArray.create(words, nBytes); | |
7323 | }, | |
7324 | ||
7325 | _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' | |
7326 | }; | |
7327 | }()); | |
7328 | ||
7329 | ||
7330 | return CryptoJS.enc.Base64; | |
7331 | ||
7332 | })); | |
7333 | },{"./core":31}],33:[function(_dereq_,module,exports){ | |
7334 | ;(function (root, factory) { | |
7335 | if (typeof exports === "object") { | |
7336 | // CommonJS | |
7337 | module.exports = exports = factory(_dereq_("./core")); | |
7338 | } | |
7339 | else if (typeof define === "function" && define.amd) { | |
7340 | // AMD | |
7341 | define(["./core"], factory); | |
7342 | } | |
7343 | else { | |
7344 | // Global (browser) | |
7345 | factory(root.CryptoJS); | |
7346 | } | |
7347 | }(this, function (CryptoJS) { | |
7348 | ||
7349 | (function () { | |
7350 | // Shortcuts | |
7351 | var C = CryptoJS; | |
7352 | var C_lib = C.lib; | |
7353 | var WordArray = C_lib.WordArray; | |
7354 | var C_enc = C.enc; | |
7355 | ||
7356 | /** | |
7357 | * UTF-16 BE encoding strategy. | |
7358 | */ | |
7359 | var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = { | |
7360 | /** | |
7361 | * Converts a word array to a UTF-16 BE string. | |
7362 | * | |
7363 | * @param {WordArray} wordArray The word array. | |
7364 | * | |
7365 | * @return {string} The UTF-16 BE string. | |
7366 | * | |
7367 | * @static | |
7368 | * | |
7369 | * @example | |
7370 | * | |
7371 | * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray); | |
7372 | */ | |
7373 | stringify: function (wordArray) { | |
7374 | // Shortcuts | |
7375 | var words = wordArray.words; | |
7376 | var sigBytes = wordArray.sigBytes; | |
7377 | ||
7378 | // Convert | |
7379 | var utf16Chars = []; | |
7380 | for (var i = 0; i < sigBytes; i += 2) { | |
7381 | var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff; | |
7382 | utf16Chars.push(String.fromCharCode(codePoint)); | |
7383 | } | |
7384 | ||
7385 | return utf16Chars.join(''); | |
7386 | }, | |
7387 | ||
7388 | /** | |
7389 | * Converts a UTF-16 BE string to a word array. | |
7390 | * | |
7391 | * @param {string} utf16Str The UTF-16 BE string. | |
7392 | * | |
7393 | * @return {WordArray} The word array. | |
7394 | * | |
7395 | * @static | |
7396 | * | |
7397 | * @example | |
7398 | * | |
7399 | * var wordArray = CryptoJS.enc.Utf16.parse(utf16String); | |
7400 | */ | |
7401 | parse: function (utf16Str) { | |
7402 | // Shortcut | |
7403 | var utf16StrLength = utf16Str.length; | |
7404 | ||
7405 | // Convert | |
7406 | var words = []; | |
7407 | for (var i = 0; i < utf16StrLength; i++) { | |
7408 | words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16); | |
7409 | } | |
7410 | ||
7411 | return WordArray.create(words, utf16StrLength * 2); | |
7412 | } | |
7413 | }; | |
7414 | ||
7415 | /** | |
7416 | * UTF-16 LE encoding strategy. | |
7417 | */ | |
7418 | C_enc.Utf16LE = { | |
7419 | /** | |
7420 | * Converts a word array to a UTF-16 LE string. | |
7421 | * | |
7422 | * @param {WordArray} wordArray The word array. | |
7423 | * | |
7424 | * @return {string} The UTF-16 LE string. | |
7425 | * | |
7426 | * @static | |
7427 | * | |
7428 | * @example | |
7429 | * | |
7430 | * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray); | |
7431 | */ | |
7432 | stringify: function (wordArray) { | |
7433 | // Shortcuts | |
7434 | var words = wordArray.words; | |
7435 | var sigBytes = wordArray.sigBytes; | |
7436 | ||
7437 | // Convert | |
7438 | var utf16Chars = []; | |
7439 | for (var i = 0; i < sigBytes; i += 2) { | |
7440 | var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff); | |
7441 | utf16Chars.push(String.fromCharCode(codePoint)); | |
7442 | } | |
7443 | ||
7444 | return utf16Chars.join(''); | |
7445 | }, | |
7446 | ||
7447 | /** | |
7448 | * Converts a UTF-16 LE string to a word array. | |
7449 | * | |
7450 | * @param {string} utf16Str The UTF-16 LE string. | |
7451 | * | |
7452 | * @return {WordArray} The word array. | |
7453 | * | |
7454 | * @static | |
7455 | * | |
7456 | * @example | |
7457 | * | |
7458 | * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str); | |
7459 | */ | |
7460 | parse: function (utf16Str) { | |
7461 | // Shortcut | |
7462 | var utf16StrLength = utf16Str.length; | |
7463 | ||
7464 | // Convert | |
7465 | var words = []; | |
7466 | for (var i = 0; i < utf16StrLength; i++) { | |
7467 | words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16)); | |
7468 | } | |
7469 | ||
7470 | return WordArray.create(words, utf16StrLength * 2); | |
7471 | } | |
7472 | }; | |
7473 | ||
7474 | function swapEndian(word) { | |
7475 | return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff); | |
7476 | } | |
7477 | }()); | |
7478 | ||
7479 | ||
7480 | return CryptoJS.enc.Utf16; | |
7481 | ||
7482 | })); | |
7483 | },{"./core":31}],34:[function(_dereq_,module,exports){ | |
7484 | ;(function (root, factory, undef) { | |
7485 | if (typeof exports === "object") { | |
7486 | // CommonJS | |
7487 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha1"), _dereq_("./hmac")); | |
7488 | } | |
7489 | else if (typeof define === "function" && define.amd) { | |
7490 | // AMD | |
7491 | define(["./core", "./sha1", "./hmac"], factory); | |
7492 | } | |
7493 | else { | |
7494 | // Global (browser) | |
7495 | factory(root.CryptoJS); | |
7496 | } | |
7497 | }(this, function (CryptoJS) { | |
7498 | ||
7499 | (function () { | |
7500 | // Shortcuts | |
7501 | var C = CryptoJS; | |
7502 | var C_lib = C.lib; | |
7503 | var Base = C_lib.Base; | |
7504 | var WordArray = C_lib.WordArray; | |
7505 | var C_algo = C.algo; | |
7506 | var MD5 = C_algo.MD5; | |
7507 | ||
7508 | /** | |
7509 | * This key derivation function is meant to conform with EVP_BytesToKey. | |
7510 | * www.openssl.org/docs/crypto/EVP_BytesToKey.html | |
7511 | */ | |
7512 | var EvpKDF = C_algo.EvpKDF = Base.extend({ | |
7513 | /** | |
7514 | * Configuration options. | |
7515 | * | |
7516 | * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) | |
7517 | * @property {Hasher} hasher The hash algorithm to use. Default: MD5 | |
7518 | * @property {number} iterations The number of iterations to perform. Default: 1 | |
7519 | */ | |
7520 | cfg: Base.extend({ | |
7521 | keySize: 128/32, | |
7522 | hasher: MD5, | |
7523 | iterations: 1 | |
7524 | }), | |
7525 | ||
7526 | /** | |
7527 | * Initializes a newly created key derivation function. | |
7528 | * | |
7529 | * @param {Object} cfg (Optional) The configuration options to use for the derivation. | |
7530 | * | |
7531 | * @example | |
7532 | * | |
7533 | * var kdf = CryptoJS.algo.EvpKDF.create(); | |
7534 | * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); | |
7535 | * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); | |
7536 | */ | |
7537 | init: function (cfg) { | |
7538 | this.cfg = this.cfg.extend(cfg); | |
7539 | }, | |
7540 | ||
7541 | /** | |
7542 | * Derives a key from a password. | |
7543 | * | |
7544 | * @param {WordArray|string} password The password. | |
7545 | * @param {WordArray|string} salt A salt. | |
7546 | * | |
7547 | * @return {WordArray} The derived key. | |
7548 | * | |
7549 | * @example | |
7550 | * | |
7551 | * var key = kdf.compute(password, salt); | |
7552 | */ | |
7553 | compute: function (password, salt) { | |
7554 | // Shortcut | |
7555 | var cfg = this.cfg; | |
7556 | ||
7557 | // Init hasher | |
7558 | var hasher = cfg.hasher.create(); | |
7559 | ||
7560 | // Initial values | |
7561 | var derivedKey = WordArray.create(); | |
7562 | ||
7563 | // Shortcuts | |
7564 | var derivedKeyWords = derivedKey.words; | |
7565 | var keySize = cfg.keySize; | |
7566 | var iterations = cfg.iterations; | |
7567 | ||
7568 | // Generate key | |
7569 | while (derivedKeyWords.length < keySize) { | |
7570 | if (block) { | |
7571 | hasher.update(block); | |
7572 | } | |
7573 | var block = hasher.update(password).finalize(salt); | |
7574 | hasher.reset(); | |
7575 | ||
7576 | // Iterations | |
7577 | for (var i = 1; i < iterations; i++) { | |
7578 | block = hasher.finalize(block); | |
7579 | hasher.reset(); | |
7580 | } | |
7581 | ||
7582 | derivedKey.concat(block); | |
7583 | } | |
7584 | derivedKey.sigBytes = keySize * 4; | |
7585 | ||
7586 | return derivedKey; | |
7587 | } | |
7588 | }); | |
7589 | ||
7590 | /** | |
7591 | * Derives a key from a password. | |
7592 | * | |
7593 | * @param {WordArray|string} password The password. | |
7594 | * @param {WordArray|string} salt A salt. | |
7595 | * @param {Object} cfg (Optional) The configuration options to use for this computation. | |
7596 | * | |
7597 | * @return {WordArray} The derived key. | |
7598 | * | |
7599 | * @static | |
7600 | * | |
7601 | * @example | |
7602 | * | |
7603 | * var key = CryptoJS.EvpKDF(password, salt); | |
7604 | * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); | |
7605 | * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); | |
7606 | */ | |
7607 | C.EvpKDF = function (password, salt, cfg) { | |
7608 | return EvpKDF.create(cfg).compute(password, salt); | |
7609 | }; | |
7610 | }()); | |
7611 | ||
7612 | ||
7613 | return CryptoJS.EvpKDF; | |
7614 | ||
7615 | })); | |
7616 | },{"./core":31,"./hmac":36,"./sha1":55}],35:[function(_dereq_,module,exports){ | |
7617 | ;(function (root, factory, undef) { | |
7618 | if (typeof exports === "object") { | |
7619 | // CommonJS | |
7620 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
7621 | } | |
7622 | else if (typeof define === "function" && define.amd) { | |
7623 | // AMD | |
7624 | define(["./core", "./cipher-core"], factory); | |
7625 | } | |
7626 | else { | |
7627 | // Global (browser) | |
7628 | factory(root.CryptoJS); | |
7629 | } | |
7630 | }(this, function (CryptoJS) { | |
7631 | ||
7632 | (function (undefined) { | |
7633 | // Shortcuts | |
7634 | var C = CryptoJS; | |
7635 | var C_lib = C.lib; | |
7636 | var CipherParams = C_lib.CipherParams; | |
7637 | var C_enc = C.enc; | |
7638 | var Hex = C_enc.Hex; | |
7639 | var C_format = C.format; | |
7640 | ||
7641 | var HexFormatter = C_format.Hex = { | |
7642 | /** | |
7643 | * Converts the ciphertext of a cipher params object to a hexadecimally encoded string. | |
7644 | * | |
7645 | * @param {CipherParams} cipherParams The cipher params object. | |
7646 | * | |
7647 | * @return {string} The hexadecimally encoded string. | |
7648 | * | |
7649 | * @static | |
7650 | * | |
7651 | * @example | |
7652 | * | |
7653 | * var hexString = CryptoJS.format.Hex.stringify(cipherParams); | |
7654 | */ | |
7655 | stringify: function (cipherParams) { | |
7656 | return cipherParams.ciphertext.toString(Hex); | |
7657 | }, | |
7658 | ||
7659 | /** | |
7660 | * Converts a hexadecimally encoded ciphertext string to a cipher params object. | |
7661 | * | |
7662 | * @param {string} input The hexadecimally encoded string. | |
7663 | * | |
7664 | * @return {CipherParams} The cipher params object. | |
7665 | * | |
7666 | * @static | |
7667 | * | |
7668 | * @example | |
7669 | * | |
7670 | * var cipherParams = CryptoJS.format.Hex.parse(hexString); | |
7671 | */ | |
7672 | parse: function (input) { | |
7673 | var ciphertext = Hex.parse(input); | |
7674 | return CipherParams.create({ ciphertext: ciphertext }); | |
7675 | } | |
7676 | }; | |
7677 | }()); | |
7678 | ||
7679 | ||
7680 | return CryptoJS.format.Hex; | |
7681 | ||
7682 | })); | |
7683 | },{"./cipher-core":30,"./core":31}],36:[function(_dereq_,module,exports){ | |
7684 | ;(function (root, factory) { | |
7685 | if (typeof exports === "object") { | |
7686 | // CommonJS | |
7687 | module.exports = exports = factory(_dereq_("./core")); | |
7688 | } | |
7689 | else if (typeof define === "function" && define.amd) { | |
7690 | // AMD | |
7691 | define(["./core"], factory); | |
7692 | } | |
7693 | else { | |
7694 | // Global (browser) | |
7695 | factory(root.CryptoJS); | |
7696 | } | |
7697 | }(this, function (CryptoJS) { | |
7698 | ||
7699 | (function () { | |
7700 | // Shortcuts | |
7701 | var C = CryptoJS; | |
7702 | var C_lib = C.lib; | |
7703 | var Base = C_lib.Base; | |
7704 | var C_enc = C.enc; | |
7705 | var Utf8 = C_enc.Utf8; | |
7706 | var C_algo = C.algo; | |
7707 | ||
7708 | /** | |
7709 | * HMAC algorithm. | |
7710 | */ | |
7711 | var HMAC = C_algo.HMAC = Base.extend({ | |
7712 | /** | |
7713 | * Initializes a newly created HMAC. | |
7714 | * | |
7715 | * @param {Hasher} hasher The hash algorithm to use. | |
7716 | * @param {WordArray|string} key The secret key. | |
7717 | * | |
7718 | * @example | |
7719 | * | |
7720 | * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); | |
7721 | */ | |
7722 | init: function (hasher, key) { | |
7723 | // Init hasher | |
7724 | hasher = this._hasher = new hasher.init(); | |
7725 | ||
7726 | // Convert string to WordArray, else assume WordArray already | |
7727 | if (typeof key == 'string') { | |
7728 | key = Utf8.parse(key); | |
7729 | } | |
7730 | ||
7731 | // Shortcuts | |
7732 | var hasherBlockSize = hasher.blockSize; | |
7733 | var hasherBlockSizeBytes = hasherBlockSize * 4; | |
7734 | ||
7735 | // Allow arbitrary length keys | |
7736 | if (key.sigBytes > hasherBlockSizeBytes) { | |
7737 | key = hasher.finalize(key); | |
7738 | } | |
7739 | ||
7740 | // Clamp excess bits | |
7741 | key.clamp(); | |
7742 | ||
7743 | // Clone key for inner and outer pads | |
7744 | var oKey = this._oKey = key.clone(); | |
7745 | var iKey = this._iKey = key.clone(); | |
7746 | ||
7747 | // Shortcuts | |
7748 | var oKeyWords = oKey.words; | |
7749 | var iKeyWords = iKey.words; | |
7750 | ||
7751 | // XOR keys with pad constants | |
7752 | for (var i = 0; i < hasherBlockSize; i++) { | |
7753 | oKeyWords[i] ^= 0x5c5c5c5c; | |
7754 | iKeyWords[i] ^= 0x36363636; | |
7755 | } | |
7756 | oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; | |
7757 | ||
7758 | // Set initial values | |
7759 | this.reset(); | |
7760 | }, | |
7761 | ||
7762 | /** | |
7763 | * Resets this HMAC to its initial state. | |
7764 | * | |
7765 | * @example | |
7766 | * | |
7767 | * hmacHasher.reset(); | |
7768 | */ | |
7769 | reset: function () { | |
7770 | // Shortcut | |
7771 | var hasher = this._hasher; | |
7772 | ||
7773 | // Reset | |
7774 | hasher.reset(); | |
7775 | hasher.update(this._iKey); | |
7776 | }, | |
7777 | ||
7778 | /** | |
7779 | * Updates this HMAC with a message. | |
7780 | * | |
7781 | * @param {WordArray|string} messageUpdate The message to append. | |
7782 | * | |
7783 | * @return {HMAC} This HMAC instance. | |
7784 | * | |
7785 | * @example | |
7786 | * | |
7787 | * hmacHasher.update('message'); | |
7788 | * hmacHasher.update(wordArray); | |
7789 | */ | |
7790 | update: function (messageUpdate) { | |
7791 | this._hasher.update(messageUpdate); | |
7792 | ||
7793 | // Chainable | |
7794 | return this; | |
7795 | }, | |
7796 | ||
7797 | /** | |
7798 | * Finalizes the HMAC computation. | |
7799 | * Note that the finalize operation is effectively a destructive, read-once operation. | |
7800 | * | |
7801 | * @param {WordArray|string} messageUpdate (Optional) A final message update. | |
7802 | * | |
7803 | * @return {WordArray} The HMAC. | |
7804 | * | |
7805 | * @example | |
7806 | * | |
7807 | * var hmac = hmacHasher.finalize(); | |
7808 | * var hmac = hmacHasher.finalize('message'); | |
7809 | * var hmac = hmacHasher.finalize(wordArray); | |
7810 | */ | |
7811 | finalize: function (messageUpdate) { | |
7812 | // Shortcut | |
7813 | var hasher = this._hasher; | |
7814 | ||
7815 | // Compute HMAC | |
7816 | var innerHash = hasher.finalize(messageUpdate); | |
7817 | hasher.reset(); | |
7818 | var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); | |
7819 | ||
7820 | return hmac; | |
7821 | } | |
7822 | }); | |
7823 | }()); | |
7824 | ||
7825 | ||
7826 | })); | |
7827 | },{"./core":31}],37:[function(_dereq_,module,exports){ | |
7828 | ;(function (root, factory, undef) { | |
7829 | if (typeof exports === "object") { | |
7830 | // CommonJS | |
7831 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core"), _dereq_("./lib-typedarrays"), _dereq_("./enc-utf16"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./sha1"), _dereq_("./sha256"), _dereq_("./sha224"), _dereq_("./sha512"), _dereq_("./sha384"), _dereq_("./sha3"), _dereq_("./ripemd160"), _dereq_("./hmac"), _dereq_("./pbkdf2"), _dereq_("./evpkdf"), _dereq_("./cipher-core"), _dereq_("./mode-cfb"), _dereq_("./mode-ctr"), _dereq_("./mode-ctr-gladman"), _dereq_("./mode-ofb"), _dereq_("./mode-ecb"), _dereq_("./pad-ansix923"), _dereq_("./pad-iso10126"), _dereq_("./pad-iso97971"), _dereq_("./pad-zeropadding"), _dereq_("./pad-nopadding"), _dereq_("./format-hex"), _dereq_("./aes"), _dereq_("./tripledes"), _dereq_("./rc4"), _dereq_("./rabbit"), _dereq_("./rabbit-legacy")); | |
7832 | } | |
7833 | else if (typeof define === "function" && define.amd) { | |
7834 | // AMD | |
7835 | define(["./core", "./x64-core", "./lib-typedarrays", "./enc-utf16", "./enc-base64", "./md5", "./sha1", "./sha256", "./sha224", "./sha512", "./sha384", "./sha3", "./ripemd160", "./hmac", "./pbkdf2", "./evpkdf", "./cipher-core", "./mode-cfb", "./mode-ctr", "./mode-ctr-gladman", "./mode-ofb", "./mode-ecb", "./pad-ansix923", "./pad-iso10126", "./pad-iso97971", "./pad-zeropadding", "./pad-nopadding", "./format-hex", "./aes", "./tripledes", "./rc4", "./rabbit", "./rabbit-legacy"], factory); | |
7836 | } | |
7837 | else { | |
7838 | // Global (browser) | |
7839 | factory(root.CryptoJS); | |
7840 | } | |
7841 | }(this, function (CryptoJS) { | |
7842 | ||
7843 | return CryptoJS; | |
7844 | ||
7845 | })); | |
7846 | },{"./aes":29,"./cipher-core":30,"./core":31,"./enc-base64":32,"./enc-utf16":33,"./evpkdf":34,"./format-hex":35,"./hmac":36,"./lib-typedarrays":38,"./md5":39,"./mode-cfb":40,"./mode-ctr":42,"./mode-ctr-gladman":41,"./mode-ecb":43,"./mode-ofb":44,"./pad-ansix923":45,"./pad-iso10126":46,"./pad-iso97971":47,"./pad-nopadding":48,"./pad-zeropadding":49,"./pbkdf2":50,"./rabbit":52,"./rabbit-legacy":51,"./rc4":53,"./ripemd160":54,"./sha1":55,"./sha224":56,"./sha256":57,"./sha3":58,"./sha384":59,"./sha512":60,"./tripledes":61,"./x64-core":62}],38:[function(_dereq_,module,exports){ | |
7847 | ;(function (root, factory) { | |
7848 | if (typeof exports === "object") { | |
7849 | // CommonJS | |
7850 | module.exports = exports = factory(_dereq_("./core")); | |
7851 | } | |
7852 | else if (typeof define === "function" && define.amd) { | |
7853 | // AMD | |
7854 | define(["./core"], factory); | |
7855 | } | |
7856 | else { | |
7857 | // Global (browser) | |
7858 | factory(root.CryptoJS); | |
7859 | } | |
7860 | }(this, function (CryptoJS) { | |
7861 | ||
7862 | (function () { | |
7863 | // Check if typed arrays are supported | |
7864 | if (typeof ArrayBuffer != 'function') { | |
7865 | return; | |
7866 | } | |
7867 | ||
7868 | // Shortcuts | |
7869 | var C = CryptoJS; | |
7870 | var C_lib = C.lib; | |
7871 | var WordArray = C_lib.WordArray; | |
7872 | ||
7873 | // Reference original init | |
7874 | var superInit = WordArray.init; | |
7875 | ||
7876 | // Augment WordArray.init to handle typed arrays | |
7877 | var subInit = WordArray.init = function (typedArray) { | |
7878 | // Convert buffers to uint8 | |
7879 | if (typedArray instanceof ArrayBuffer) { | |
7880 | typedArray = new Uint8Array(typedArray); | |
7881 | } | |
7882 | ||
7883 | // Convert other array views to uint8 | |
7884 | if ( | |
7885 | typedArray instanceof Int8Array || | |
7886 | typedArray instanceof Uint8ClampedArray || | |
7887 | typedArray instanceof Int16Array || | |
7888 | typedArray instanceof Uint16Array || | |
7889 | typedArray instanceof Int32Array || | |
7890 | typedArray instanceof Uint32Array || | |
7891 | typedArray instanceof Float32Array || | |
7892 | typedArray instanceof Float64Array | |
7893 | ) { | |
7894 | typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength); | |
7895 | } | |
7896 | ||
7897 | // Handle Uint8Array | |
7898 | if (typedArray instanceof Uint8Array) { | |
7899 | // Shortcut | |
7900 | var typedArrayByteLength = typedArray.byteLength; | |
7901 | ||
7902 | // Extract bytes | |
7903 | var words = []; | |
7904 | for (var i = 0; i < typedArrayByteLength; i++) { | |
7905 | words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8); | |
7906 | } | |
7907 | ||
7908 | // Initialize this word array | |
7909 | superInit.call(this, words, typedArrayByteLength); | |
7910 | } else { | |
7911 | // Else call normal init | |
7912 | superInit.apply(this, arguments); | |
7913 | } | |
7914 | }; | |
7915 | ||
7916 | subInit.prototype = WordArray; | |
7917 | }()); | |
7918 | ||
7919 | ||
7920 | return CryptoJS.lib.WordArray; | |
7921 | ||
7922 | })); | |
7923 | },{"./core":31}],39:[function(_dereq_,module,exports){ | |
7924 | ;(function (root, factory) { | |
7925 | if (typeof exports === "object") { | |
7926 | // CommonJS | |
7927 | module.exports = exports = factory(_dereq_("./core")); | |
7928 | } | |
7929 | else if (typeof define === "function" && define.amd) { | |
7930 | // AMD | |
7931 | define(["./core"], factory); | |
7932 | } | |
7933 | else { | |
7934 | // Global (browser) | |
7935 | factory(root.CryptoJS); | |
7936 | } | |
7937 | }(this, function (CryptoJS) { | |
7938 | ||
7939 | (function (Math) { | |
7940 | // Shortcuts | |
7941 | var C = CryptoJS; | |
7942 | var C_lib = C.lib; | |
7943 | var WordArray = C_lib.WordArray; | |
7944 | var Hasher = C_lib.Hasher; | |
7945 | var C_algo = C.algo; | |
7946 | ||
7947 | // Constants table | |
7948 | var T = []; | |
7949 | ||
7950 | // Compute constants | |
7951 | (function () { | |
7952 | for (var i = 0; i < 64; i++) { | |
7953 | T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0; | |
7954 | } | |
7955 | }()); | |
7956 | ||
7957 | /** | |
7958 | * MD5 hash algorithm. | |
7959 | */ | |
7960 | var MD5 = C_algo.MD5 = Hasher.extend({ | |
7961 | _doReset: function () { | |
7962 | this._hash = new WordArray.init([ | |
7963 | 0x67452301, 0xefcdab89, | |
7964 | 0x98badcfe, 0x10325476 | |
7965 | ]); | |
7966 | }, | |
7967 | ||
7968 | _doProcessBlock: function (M, offset) { | |
7969 | // Swap endian | |
7970 | for (var i = 0; i < 16; i++) { | |
7971 | // Shortcuts | |
7972 | var offset_i = offset + i; | |
7973 | var M_offset_i = M[offset_i]; | |
7974 | ||
7975 | M[offset_i] = ( | |
7976 | (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | | |
7977 | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) | |
7978 | ); | |
7979 | } | |
7980 | ||
7981 | // Shortcuts | |
7982 | var H = this._hash.words; | |
7983 | ||
7984 | var M_offset_0 = M[offset + 0]; | |
7985 | var M_offset_1 = M[offset + 1]; | |
7986 | var M_offset_2 = M[offset + 2]; | |
7987 | var M_offset_3 = M[offset + 3]; | |
7988 | var M_offset_4 = M[offset + 4]; | |
7989 | var M_offset_5 = M[offset + 5]; | |
7990 | var M_offset_6 = M[offset + 6]; | |
7991 | var M_offset_7 = M[offset + 7]; | |
7992 | var M_offset_8 = M[offset + 8]; | |
7993 | var M_offset_9 = M[offset + 9]; | |
7994 | var M_offset_10 = M[offset + 10]; | |
7995 | var M_offset_11 = M[offset + 11]; | |
7996 | var M_offset_12 = M[offset + 12]; | |
7997 | var M_offset_13 = M[offset + 13]; | |
7998 | var M_offset_14 = M[offset + 14]; | |
7999 | var M_offset_15 = M[offset + 15]; | |
8000 | ||
8001 | // Working varialbes | |
8002 | var a = H[0]; | |
8003 | var b = H[1]; | |
8004 | var c = H[2]; | |
8005 | var d = H[3]; | |
8006 | ||
8007 | // Computation | |
8008 | a = FF(a, b, c, d, M_offset_0, 7, T[0]); | |
8009 | d = FF(d, a, b, c, M_offset_1, 12, T[1]); | |
8010 | c = FF(c, d, a, b, M_offset_2, 17, T[2]); | |
8011 | b = FF(b, c, d, a, M_offset_3, 22, T[3]); | |
8012 | a = FF(a, b, c, d, M_offset_4, 7, T[4]); | |
8013 | d = FF(d, a, b, c, M_offset_5, 12, T[5]); | |
8014 | c = FF(c, d, a, b, M_offset_6, 17, T[6]); | |
8015 | b = FF(b, c, d, a, M_offset_7, 22, T[7]); | |
8016 | a = FF(a, b, c, d, M_offset_8, 7, T[8]); | |
8017 | d = FF(d, a, b, c, M_offset_9, 12, T[9]); | |
8018 | c = FF(c, d, a, b, M_offset_10, 17, T[10]); | |
8019 | b = FF(b, c, d, a, M_offset_11, 22, T[11]); | |
8020 | a = FF(a, b, c, d, M_offset_12, 7, T[12]); | |
8021 | d = FF(d, a, b, c, M_offset_13, 12, T[13]); | |
8022 | c = FF(c, d, a, b, M_offset_14, 17, T[14]); | |
8023 | b = FF(b, c, d, a, M_offset_15, 22, T[15]); | |
8024 | ||
8025 | a = GG(a, b, c, d, M_offset_1, 5, T[16]); | |
8026 | d = GG(d, a, b, c, M_offset_6, 9, T[17]); | |
8027 | c = GG(c, d, a, b, M_offset_11, 14, T[18]); | |
8028 | b = GG(b, c, d, a, M_offset_0, 20, T[19]); | |
8029 | a = GG(a, b, c, d, M_offset_5, 5, T[20]); | |
8030 | d = GG(d, a, b, c, M_offset_10, 9, T[21]); | |
8031 | c = GG(c, d, a, b, M_offset_15, 14, T[22]); | |
8032 | b = GG(b, c, d, a, M_offset_4, 20, T[23]); | |
8033 | a = GG(a, b, c, d, M_offset_9, 5, T[24]); | |
8034 | d = GG(d, a, b, c, M_offset_14, 9, T[25]); | |
8035 | c = GG(c, d, a, b, M_offset_3, 14, T[26]); | |
8036 | b = GG(b, c, d, a, M_offset_8, 20, T[27]); | |
8037 | a = GG(a, b, c, d, M_offset_13, 5, T[28]); | |
8038 | d = GG(d, a, b, c, M_offset_2, 9, T[29]); | |
8039 | c = GG(c, d, a, b, M_offset_7, 14, T[30]); | |
8040 | b = GG(b, c, d, a, M_offset_12, 20, T[31]); | |
8041 | ||
8042 | a = HH(a, b, c, d, M_offset_5, 4, T[32]); | |
8043 | d = HH(d, a, b, c, M_offset_8, 11, T[33]); | |
8044 | c = HH(c, d, a, b, M_offset_11, 16, T[34]); | |
8045 | b = HH(b, c, d, a, M_offset_14, 23, T[35]); | |
8046 | a = HH(a, b, c, d, M_offset_1, 4, T[36]); | |
8047 | d = HH(d, a, b, c, M_offset_4, 11, T[37]); | |
8048 | c = HH(c, d, a, b, M_offset_7, 16, T[38]); | |
8049 | b = HH(b, c, d, a, M_offset_10, 23, T[39]); | |
8050 | a = HH(a, b, c, d, M_offset_13, 4, T[40]); | |
8051 | d = HH(d, a, b, c, M_offset_0, 11, T[41]); | |
8052 | c = HH(c, d, a, b, M_offset_3, 16, T[42]); | |
8053 | b = HH(b, c, d, a, M_offset_6, 23, T[43]); | |
8054 | a = HH(a, b, c, d, M_offset_9, 4, T[44]); | |
8055 | d = HH(d, a, b, c, M_offset_12, 11, T[45]); | |
8056 | c = HH(c, d, a, b, M_offset_15, 16, T[46]); | |
8057 | b = HH(b, c, d, a, M_offset_2, 23, T[47]); | |
8058 | ||
8059 | a = II(a, b, c, d, M_offset_0, 6, T[48]); | |
8060 | d = II(d, a, b, c, M_offset_7, 10, T[49]); | |
8061 | c = II(c, d, a, b, M_offset_14, 15, T[50]); | |
8062 | b = II(b, c, d, a, M_offset_5, 21, T[51]); | |
8063 | a = II(a, b, c, d, M_offset_12, 6, T[52]); | |
8064 | d = II(d, a, b, c, M_offset_3, 10, T[53]); | |
8065 | c = II(c, d, a, b, M_offset_10, 15, T[54]); | |
8066 | b = II(b, c, d, a, M_offset_1, 21, T[55]); | |
8067 | a = II(a, b, c, d, M_offset_8, 6, T[56]); | |
8068 | d = II(d, a, b, c, M_offset_15, 10, T[57]); | |
8069 | c = II(c, d, a, b, M_offset_6, 15, T[58]); | |
8070 | b = II(b, c, d, a, M_offset_13, 21, T[59]); | |
8071 | a = II(a, b, c, d, M_offset_4, 6, T[60]); | |
8072 | d = II(d, a, b, c, M_offset_11, 10, T[61]); | |
8073 | c = II(c, d, a, b, M_offset_2, 15, T[62]); | |
8074 | b = II(b, c, d, a, M_offset_9, 21, T[63]); | |
8075 | ||
8076 | // Intermediate hash value | |
8077 | H[0] = (H[0] + a) | 0; | |
8078 | H[1] = (H[1] + b) | 0; | |
8079 | H[2] = (H[2] + c) | 0; | |
8080 | H[3] = (H[3] + d) | 0; | |
8081 | }, | |
8082 | ||
8083 | _doFinalize: function () { | |
8084 | // Shortcuts | |
8085 | var data = this._data; | |
8086 | var dataWords = data.words; | |
8087 | ||
8088 | var nBitsTotal = this._nDataBytes * 8; | |
8089 | var nBitsLeft = data.sigBytes * 8; | |
8090 | ||
8091 | // Add padding | |
8092 | dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); | |
8093 | ||
8094 | var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); | |
8095 | var nBitsTotalL = nBitsTotal; | |
8096 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = ( | |
8097 | (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | | |
8098 | (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00) | |
8099 | ); | |
8100 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( | |
8101 | (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | | |
8102 | (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00) | |
8103 | ); | |
8104 | ||
8105 | data.sigBytes = (dataWords.length + 1) * 4; | |
8106 | ||
8107 | // Hash final blocks | |
8108 | this._process(); | |
8109 | ||
8110 | // Shortcuts | |
8111 | var hash = this._hash; | |
8112 | var H = hash.words; | |
8113 | ||
8114 | // Swap endian | |
8115 | for (var i = 0; i < 4; i++) { | |
8116 | // Shortcut | |
8117 | var H_i = H[i]; | |
8118 | ||
8119 | H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | | |
8120 | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); | |
8121 | } | |
8122 | ||
8123 | // Return final computed hash | |
8124 | return hash; | |
8125 | }, | |
8126 | ||
8127 | clone: function () { | |
8128 | var clone = Hasher.clone.call(this); | |
8129 | clone._hash = this._hash.clone(); | |
8130 | ||
8131 | return clone; | |
8132 | } | |
8133 | }); | |
8134 | ||
8135 | function FF(a, b, c, d, x, s, t) { | |
8136 | var n = a + ((b & c) | (~b & d)) + x + t; | |
8137 | return ((n << s) | (n >>> (32 - s))) + b; | |
8138 | } | |
8139 | ||
8140 | function GG(a, b, c, d, x, s, t) { | |
8141 | var n = a + ((b & d) | (c & ~d)) + x + t; | |
8142 | return ((n << s) | (n >>> (32 - s))) + b; | |
8143 | } | |
8144 | ||
8145 | function HH(a, b, c, d, x, s, t) { | |
8146 | var n = a + (b ^ c ^ d) + x + t; | |
8147 | return ((n << s) | (n >>> (32 - s))) + b; | |
8148 | } | |
8149 | ||
8150 | function II(a, b, c, d, x, s, t) { | |
8151 | var n = a + (c ^ (b | ~d)) + x + t; | |
8152 | return ((n << s) | (n >>> (32 - s))) + b; | |
8153 | } | |
8154 | ||
8155 | /** | |
8156 | * Shortcut function to the hasher's object interface. | |
8157 | * | |
8158 | * @param {WordArray|string} message The message to hash. | |
8159 | * | |
8160 | * @return {WordArray} The hash. | |
8161 | * | |
8162 | * @static | |
8163 | * | |
8164 | * @example | |
8165 | * | |
8166 | * var hash = CryptoJS.MD5('message'); | |
8167 | * var hash = CryptoJS.MD5(wordArray); | |
8168 | */ | |
8169 | C.MD5 = Hasher._createHelper(MD5); | |
8170 | ||
8171 | /** | |
8172 | * Shortcut function to the HMAC's object interface. | |
8173 | * | |
8174 | * @param {WordArray|string} message The message to hash. | |
8175 | * @param {WordArray|string} key The secret key. | |
8176 | * | |
8177 | * @return {WordArray} The HMAC. | |
8178 | * | |
8179 | * @static | |
8180 | * | |
8181 | * @example | |
8182 | * | |
8183 | * var hmac = CryptoJS.HmacMD5(message, key); | |
8184 | */ | |
8185 | C.HmacMD5 = Hasher._createHmacHelper(MD5); | |
8186 | }(Math)); | |
8187 | ||
8188 | ||
8189 | return CryptoJS.MD5; | |
8190 | ||
8191 | })); | |
8192 | },{"./core":31}],40:[function(_dereq_,module,exports){ | |
8193 | ;(function (root, factory, undef) { | |
8194 | if (typeof exports === "object") { | |
8195 | // CommonJS | |
8196 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8197 | } | |
8198 | else if (typeof define === "function" && define.amd) { | |
8199 | // AMD | |
8200 | define(["./core", "./cipher-core"], factory); | |
8201 | } | |
8202 | else { | |
8203 | // Global (browser) | |
8204 | factory(root.CryptoJS); | |
8205 | } | |
8206 | }(this, function (CryptoJS) { | |
8207 | ||
8208 | /** | |
8209 | * Cipher Feedback block mode. | |
8210 | */ | |
8211 | CryptoJS.mode.CFB = (function () { | |
8212 | var CFB = CryptoJS.lib.BlockCipherMode.extend(); | |
8213 | ||
8214 | CFB.Encryptor = CFB.extend({ | |
8215 | processBlock: function (words, offset) { | |
8216 | // Shortcuts | |
8217 | var cipher = this._cipher; | |
8218 | var blockSize = cipher.blockSize; | |
8219 | ||
8220 | generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); | |
8221 | ||
8222 | // Remember this block to use with next block | |
8223 | this._prevBlock = words.slice(offset, offset + blockSize); | |
8224 | } | |
8225 | }); | |
8226 | ||
8227 | CFB.Decryptor = CFB.extend({ | |
8228 | processBlock: function (words, offset) { | |
8229 | // Shortcuts | |
8230 | var cipher = this._cipher; | |
8231 | var blockSize = cipher.blockSize; | |
8232 | ||
8233 | // Remember this block to use with next block | |
8234 | var thisBlock = words.slice(offset, offset + blockSize); | |
8235 | ||
8236 | generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); | |
8237 | ||
8238 | // This block becomes the previous block | |
8239 | this._prevBlock = thisBlock; | |
8240 | } | |
8241 | }); | |
8242 | ||
8243 | function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) { | |
8244 | // Shortcut | |
8245 | var iv = this._iv; | |
8246 | ||
8247 | // Generate keystream | |
8248 | if (iv) { | |
8249 | var keystream = iv.slice(0); | |
8250 | ||
8251 | // Remove IV for subsequent blocks | |
8252 | this._iv = undefined; | |
8253 | } else { | |
8254 | var keystream = this._prevBlock; | |
8255 | } | |
8256 | cipher.encryptBlock(keystream, 0); | |
8257 | ||
8258 | // Encrypt | |
8259 | for (var i = 0; i < blockSize; i++) { | |
8260 | words[offset + i] ^= keystream[i]; | |
8261 | } | |
8262 | } | |
8263 | ||
8264 | return CFB; | |
8265 | }()); | |
8266 | ||
8267 | ||
8268 | return CryptoJS.mode.CFB; | |
8269 | ||
8270 | })); | |
8271 | },{"./cipher-core":30,"./core":31}],41:[function(_dereq_,module,exports){ | |
8272 | ;(function (root, factory, undef) { | |
8273 | if (typeof exports === "object") { | |
8274 | // CommonJS | |
8275 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8276 | } | |
8277 | else if (typeof define === "function" && define.amd) { | |
8278 | // AMD | |
8279 | define(["./core", "./cipher-core"], factory); | |
8280 | } | |
8281 | else { | |
8282 | // Global (browser) | |
8283 | factory(root.CryptoJS); | |
8284 | } | |
8285 | }(this, function (CryptoJS) { | |
8286 | ||
8287 | /** @preserve | |
8288 | * Counter block mode compatible with Dr Brian Gladman fileenc.c | |
8289 | * derived from CryptoJS.mode.CTR | |
8290 | * Jan Hruby jhruby.web@gmail.com | |
8291 | */ | |
8292 | CryptoJS.mode.CTRGladman = (function () { | |
8293 | var CTRGladman = CryptoJS.lib.BlockCipherMode.extend(); | |
8294 | ||
8295 | function incWord(word) | |
8296 | { | |
8297 | if (((word >> 24) & 0xff) === 0xff) { //overflow | |
8298 | var b1 = (word >> 16)&0xff; | |
8299 | var b2 = (word >> 8)&0xff; | |
8300 | var b3 = word & 0xff; | |
8301 | ||
8302 | if (b1 === 0xff) // overflow b1 | |
8303 | { | |
8304 | b1 = 0; | |
8305 | if (b2 === 0xff) | |
8306 | { | |
8307 | b2 = 0; | |
8308 | if (b3 === 0xff) | |
8309 | { | |
8310 | b3 = 0; | |
8311 | } | |
8312 | else | |
8313 | { | |
8314 | ++b3; | |
8315 | } | |
8316 | } | |
8317 | else | |
8318 | { | |
8319 | ++b2; | |
8320 | } | |
8321 | } | |
8322 | else | |
8323 | { | |
8324 | ++b1; | |
8325 | } | |
8326 | ||
8327 | word = 0; | |
8328 | word += (b1 << 16); | |
8329 | word += (b2 << 8); | |
8330 | word += b3; | |
8331 | } | |
8332 | else | |
8333 | { | |
8334 | word += (0x01 << 24); | |
8335 | } | |
8336 | return word; | |
8337 | } | |
8338 | ||
8339 | function incCounter(counter) | |
8340 | { | |
8341 | if ((counter[0] = incWord(counter[0])) === 0) | |
8342 | { | |
8343 | // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8 | |
8344 | counter[1] = incWord(counter[1]); | |
8345 | } | |
8346 | return counter; | |
8347 | } | |
8348 | ||
8349 | var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({ | |
8350 | processBlock: function (words, offset) { | |
8351 | // Shortcuts | |
8352 | var cipher = this._cipher | |
8353 | var blockSize = cipher.blockSize; | |
8354 | var iv = this._iv; | |
8355 | var counter = this._counter; | |
8356 | ||
8357 | // Generate keystream | |
8358 | if (iv) { | |
8359 | counter = this._counter = iv.slice(0); | |
8360 | ||
8361 | // Remove IV for subsequent blocks | |
8362 | this._iv = undefined; | |
8363 | } | |
8364 | ||
8365 | incCounter(counter); | |
8366 | ||
8367 | var keystream = counter.slice(0); | |
8368 | cipher.encryptBlock(keystream, 0); | |
8369 | ||
8370 | // Encrypt | |
8371 | for (var i = 0; i < blockSize; i++) { | |
8372 | words[offset + i] ^= keystream[i]; | |
8373 | } | |
8374 | } | |
8375 | }); | |
8376 | ||
8377 | CTRGladman.Decryptor = Encryptor; | |
8378 | ||
8379 | return CTRGladman; | |
8380 | }()); | |
8381 | ||
8382 | ||
8383 | ||
8384 | ||
8385 | return CryptoJS.mode.CTRGladman; | |
8386 | ||
8387 | })); | |
8388 | },{"./cipher-core":30,"./core":31}],42:[function(_dereq_,module,exports){ | |
8389 | ;(function (root, factory, undef) { | |
8390 | if (typeof exports === "object") { | |
8391 | // CommonJS | |
8392 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8393 | } | |
8394 | else if (typeof define === "function" && define.amd) { | |
8395 | // AMD | |
8396 | define(["./core", "./cipher-core"], factory); | |
8397 | } | |
8398 | else { | |
8399 | // Global (browser) | |
8400 | factory(root.CryptoJS); | |
8401 | } | |
8402 | }(this, function (CryptoJS) { | |
8403 | ||
8404 | /** | |
8405 | * Counter block mode. | |
8406 | */ | |
8407 | CryptoJS.mode.CTR = (function () { | |
8408 | var CTR = CryptoJS.lib.BlockCipherMode.extend(); | |
8409 | ||
8410 | var Encryptor = CTR.Encryptor = CTR.extend({ | |
8411 | processBlock: function (words, offset) { | |
8412 | // Shortcuts | |
8413 | var cipher = this._cipher | |
8414 | var blockSize = cipher.blockSize; | |
8415 | var iv = this._iv; | |
8416 | var counter = this._counter; | |
8417 | ||
8418 | // Generate keystream | |
8419 | if (iv) { | |
8420 | counter = this._counter = iv.slice(0); | |
8421 | ||
8422 | // Remove IV for subsequent blocks | |
8423 | this._iv = undefined; | |
8424 | } | |
8425 | var keystream = counter.slice(0); | |
8426 | cipher.encryptBlock(keystream, 0); | |
8427 | ||
8428 | // Increment counter | |
8429 | counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0 | |
8430 | ||
8431 | // Encrypt | |
8432 | for (var i = 0; i < blockSize; i++) { | |
8433 | words[offset + i] ^= keystream[i]; | |
8434 | } | |
8435 | } | |
8436 | }); | |
8437 | ||
8438 | CTR.Decryptor = Encryptor; | |
8439 | ||
8440 | return CTR; | |
8441 | }()); | |
8442 | ||
8443 | ||
8444 | return CryptoJS.mode.CTR; | |
8445 | ||
8446 | })); | |
8447 | },{"./cipher-core":30,"./core":31}],43:[function(_dereq_,module,exports){ | |
8448 | ;(function (root, factory, undef) { | |
8449 | if (typeof exports === "object") { | |
8450 | // CommonJS | |
8451 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8452 | } | |
8453 | else if (typeof define === "function" && define.amd) { | |
8454 | // AMD | |
8455 | define(["./core", "./cipher-core"], factory); | |
8456 | } | |
8457 | else { | |
8458 | // Global (browser) | |
8459 | factory(root.CryptoJS); | |
8460 | } | |
8461 | }(this, function (CryptoJS) { | |
8462 | ||
8463 | /** | |
8464 | * Electronic Codebook block mode. | |
8465 | */ | |
8466 | CryptoJS.mode.ECB = (function () { | |
8467 | var ECB = CryptoJS.lib.BlockCipherMode.extend(); | |
8468 | ||
8469 | ECB.Encryptor = ECB.extend({ | |
8470 | processBlock: function (words, offset) { | |
8471 | this._cipher.encryptBlock(words, offset); | |
8472 | } | |
8473 | }); | |
8474 | ||
8475 | ECB.Decryptor = ECB.extend({ | |
8476 | processBlock: function (words, offset) { | |
8477 | this._cipher.decryptBlock(words, offset); | |
8478 | } | |
8479 | }); | |
8480 | ||
8481 | return ECB; | |
8482 | }()); | |
8483 | ||
8484 | ||
8485 | return CryptoJS.mode.ECB; | |
8486 | ||
8487 | })); | |
8488 | },{"./cipher-core":30,"./core":31}],44:[function(_dereq_,module,exports){ | |
8489 | ;(function (root, factory, undef) { | |
8490 | if (typeof exports === "object") { | |
8491 | // CommonJS | |
8492 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8493 | } | |
8494 | else if (typeof define === "function" && define.amd) { | |
8495 | // AMD | |
8496 | define(["./core", "./cipher-core"], factory); | |
8497 | } | |
8498 | else { | |
8499 | // Global (browser) | |
8500 | factory(root.CryptoJS); | |
8501 | } | |
8502 | }(this, function (CryptoJS) { | |
8503 | ||
8504 | /** | |
8505 | * Output Feedback block mode. | |
8506 | */ | |
8507 | CryptoJS.mode.OFB = (function () { | |
8508 | var OFB = CryptoJS.lib.BlockCipherMode.extend(); | |
8509 | ||
8510 | var Encryptor = OFB.Encryptor = OFB.extend({ | |
8511 | processBlock: function (words, offset) { | |
8512 | // Shortcuts | |
8513 | var cipher = this._cipher | |
8514 | var blockSize = cipher.blockSize; | |
8515 | var iv = this._iv; | |
8516 | var keystream = this._keystream; | |
8517 | ||
8518 | // Generate keystream | |
8519 | if (iv) { | |
8520 | keystream = this._keystream = iv.slice(0); | |
8521 | ||
8522 | // Remove IV for subsequent blocks | |
8523 | this._iv = undefined; | |
8524 | } | |
8525 | cipher.encryptBlock(keystream, 0); | |
8526 | ||
8527 | // Encrypt | |
8528 | for (var i = 0; i < blockSize; i++) { | |
8529 | words[offset + i] ^= keystream[i]; | |
8530 | } | |
8531 | } | |
8532 | }); | |
8533 | ||
8534 | OFB.Decryptor = Encryptor; | |
8535 | ||
8536 | return OFB; | |
8537 | }()); | |
8538 | ||
8539 | ||
8540 | return CryptoJS.mode.OFB; | |
8541 | ||
8542 | })); | |
8543 | },{"./cipher-core":30,"./core":31}],45:[function(_dereq_,module,exports){ | |
8544 | ;(function (root, factory, undef) { | |
8545 | if (typeof exports === "object") { | |
8546 | // CommonJS | |
8547 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8548 | } | |
8549 | else if (typeof define === "function" && define.amd) { | |
8550 | // AMD | |
8551 | define(["./core", "./cipher-core"], factory); | |
8552 | } | |
8553 | else { | |
8554 | // Global (browser) | |
8555 | factory(root.CryptoJS); | |
8556 | } | |
8557 | }(this, function (CryptoJS) { | |
8558 | ||
8559 | /** | |
8560 | * ANSI X.923 padding strategy. | |
8561 | */ | |
8562 | CryptoJS.pad.AnsiX923 = { | |
8563 | pad: function (data, blockSize) { | |
8564 | // Shortcuts | |
8565 | var dataSigBytes = data.sigBytes; | |
8566 | var blockSizeBytes = blockSize * 4; | |
8567 | ||
8568 | // Count padding bytes | |
8569 | var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes; | |
8570 | ||
8571 | // Compute last byte position | |
8572 | var lastBytePos = dataSigBytes + nPaddingBytes - 1; | |
8573 | ||
8574 | // Pad | |
8575 | data.clamp(); | |
8576 | data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8); | |
8577 | data.sigBytes += nPaddingBytes; | |
8578 | }, | |
8579 | ||
8580 | unpad: function (data) { | |
8581 | // Get number of padding bytes from last byte | |
8582 | var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; | |
8583 | ||
8584 | // Remove padding | |
8585 | data.sigBytes -= nPaddingBytes; | |
8586 | } | |
8587 | }; | |
8588 | ||
8589 | ||
8590 | return CryptoJS.pad.Ansix923; | |
8591 | ||
8592 | })); | |
8593 | },{"./cipher-core":30,"./core":31}],46:[function(_dereq_,module,exports){ | |
8594 | ;(function (root, factory, undef) { | |
8595 | if (typeof exports === "object") { | |
8596 | // CommonJS | |
8597 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8598 | } | |
8599 | else if (typeof define === "function" && define.amd) { | |
8600 | // AMD | |
8601 | define(["./core", "./cipher-core"], factory); | |
8602 | } | |
8603 | else { | |
8604 | // Global (browser) | |
8605 | factory(root.CryptoJS); | |
8606 | } | |
8607 | }(this, function (CryptoJS) { | |
8608 | ||
8609 | /** | |
8610 | * ISO 10126 padding strategy. | |
8611 | */ | |
8612 | CryptoJS.pad.Iso10126 = { | |
8613 | pad: function (data, blockSize) { | |
8614 | // Shortcut | |
8615 | var blockSizeBytes = blockSize * 4; | |
8616 | ||
8617 | // Count padding bytes | |
8618 | var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; | |
8619 | ||
8620 | // Pad | |
8621 | data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)). | |
8622 | concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1)); | |
8623 | }, | |
8624 | ||
8625 | unpad: function (data) { | |
8626 | // Get number of padding bytes from last byte | |
8627 | var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; | |
8628 | ||
8629 | // Remove padding | |
8630 | data.sigBytes -= nPaddingBytes; | |
8631 | } | |
8632 | }; | |
8633 | ||
8634 | ||
8635 | return CryptoJS.pad.Iso10126; | |
8636 | ||
8637 | })); | |
8638 | },{"./cipher-core":30,"./core":31}],47:[function(_dereq_,module,exports){ | |
8639 | ;(function (root, factory, undef) { | |
8640 | if (typeof exports === "object") { | |
8641 | // CommonJS | |
8642 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8643 | } | |
8644 | else if (typeof define === "function" && define.amd) { | |
8645 | // AMD | |
8646 | define(["./core", "./cipher-core"], factory); | |
8647 | } | |
8648 | else { | |
8649 | // Global (browser) | |
8650 | factory(root.CryptoJS); | |
8651 | } | |
8652 | }(this, function (CryptoJS) { | |
8653 | ||
8654 | /** | |
8655 | * ISO/IEC 9797-1 Padding Method 2. | |
8656 | */ | |
8657 | CryptoJS.pad.Iso97971 = { | |
8658 | pad: function (data, blockSize) { | |
8659 | // Add 0x80 byte | |
8660 | data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1)); | |
8661 | ||
8662 | // Zero pad the rest | |
8663 | CryptoJS.pad.ZeroPadding.pad(data, blockSize); | |
8664 | }, | |
8665 | ||
8666 | unpad: function (data) { | |
8667 | // Remove zero padding | |
8668 | CryptoJS.pad.ZeroPadding.unpad(data); | |
8669 | ||
8670 | // Remove one more byte -- the 0x80 byte | |
8671 | data.sigBytes--; | |
8672 | } | |
8673 | }; | |
8674 | ||
8675 | ||
8676 | return CryptoJS.pad.Iso97971; | |
8677 | ||
8678 | })); | |
8679 | },{"./cipher-core":30,"./core":31}],48:[function(_dereq_,module,exports){ | |
8680 | ;(function (root, factory, undef) { | |
8681 | if (typeof exports === "object") { | |
8682 | // CommonJS | |
8683 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8684 | } | |
8685 | else if (typeof define === "function" && define.amd) { | |
8686 | // AMD | |
8687 | define(["./core", "./cipher-core"], factory); | |
8688 | } | |
8689 | else { | |
8690 | // Global (browser) | |
8691 | factory(root.CryptoJS); | |
8692 | } | |
8693 | }(this, function (CryptoJS) { | |
8694 | ||
8695 | /** | |
8696 | * A noop padding strategy. | |
8697 | */ | |
8698 | CryptoJS.pad.NoPadding = { | |
8699 | pad: function () { | |
8700 | }, | |
8701 | ||
8702 | unpad: function () { | |
8703 | } | |
8704 | }; | |
8705 | ||
8706 | ||
8707 | return CryptoJS.pad.NoPadding; | |
8708 | ||
8709 | })); | |
8710 | },{"./cipher-core":30,"./core":31}],49:[function(_dereq_,module,exports){ | |
8711 | ;(function (root, factory, undef) { | |
8712 | if (typeof exports === "object") { | |
8713 | // CommonJS | |
8714 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8715 | } | |
8716 | else if (typeof define === "function" && define.amd) { | |
8717 | // AMD | |
8718 | define(["./core", "./cipher-core"], factory); | |
8719 | } | |
8720 | else { | |
8721 | // Global (browser) | |
8722 | factory(root.CryptoJS); | |
8723 | } | |
8724 | }(this, function (CryptoJS) { | |
8725 | ||
8726 | /** | |
8727 | * Zero padding strategy. | |
8728 | */ | |
8729 | CryptoJS.pad.ZeroPadding = { | |
8730 | pad: function (data, blockSize) { | |
8731 | // Shortcut | |
8732 | var blockSizeBytes = blockSize * 4; | |
8733 | ||
8734 | // Pad | |
8735 | data.clamp(); | |
8736 | data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes); | |
8737 | }, | |
8738 | ||
8739 | unpad: function (data) { | |
8740 | // Shortcut | |
8741 | var dataWords = data.words; | |
8742 | ||
8743 | // Unpad | |
8744 | var i = data.sigBytes - 1; | |
8745 | while (!((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) { | |
8746 | i--; | |
8747 | } | |
8748 | data.sigBytes = i + 1; | |
8749 | } | |
8750 | }; | |
8751 | ||
8752 | ||
8753 | return CryptoJS.pad.ZeroPadding; | |
8754 | ||
8755 | })); | |
8756 | },{"./cipher-core":30,"./core":31}],50:[function(_dereq_,module,exports){ | |
8757 | ;(function (root, factory, undef) { | |
8758 | if (typeof exports === "object") { | |
8759 | // CommonJS | |
8760 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha1"), _dereq_("./hmac")); | |
8761 | } | |
8762 | else if (typeof define === "function" && define.amd) { | |
8763 | // AMD | |
8764 | define(["./core", "./sha1", "./hmac"], factory); | |
8765 | } | |
8766 | else { | |
8767 | // Global (browser) | |
8768 | factory(root.CryptoJS); | |
8769 | } | |
8770 | }(this, function (CryptoJS) { | |
8771 | ||
8772 | (function () { | |
8773 | // Shortcuts | |
8774 | var C = CryptoJS; | |
8775 | var C_lib = C.lib; | |
8776 | var Base = C_lib.Base; | |
8777 | var WordArray = C_lib.WordArray; | |
8778 | var C_algo = C.algo; | |
8779 | var SHA1 = C_algo.SHA1; | |
8780 | var HMAC = C_algo.HMAC; | |
8781 | ||
8782 | /** | |
8783 | * Password-Based Key Derivation Function 2 algorithm. | |
8784 | */ | |
8785 | var PBKDF2 = C_algo.PBKDF2 = Base.extend({ | |
8786 | /** | |
8787 | * Configuration options. | |
8788 | * | |
8789 | * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) | |
8790 | * @property {Hasher} hasher The hasher to use. Default: SHA1 | |
8791 | * @property {number} iterations The number of iterations to perform. Default: 1 | |
8792 | */ | |
8793 | cfg: Base.extend({ | |
8794 | keySize: 128/32, | |
8795 | hasher: SHA1, | |
8796 | iterations: 1 | |
8797 | }), | |
8798 | ||
8799 | /** | |
8800 | * Initializes a newly created key derivation function. | |
8801 | * | |
8802 | * @param {Object} cfg (Optional) The configuration options to use for the derivation. | |
8803 | * | |
8804 | * @example | |
8805 | * | |
8806 | * var kdf = CryptoJS.algo.PBKDF2.create(); | |
8807 | * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 }); | |
8808 | * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 }); | |
8809 | */ | |
8810 | init: function (cfg) { | |
8811 | this.cfg = this.cfg.extend(cfg); | |
8812 | }, | |
8813 | ||
8814 | /** | |
8815 | * Computes the Password-Based Key Derivation Function 2. | |
8816 | * | |
8817 | * @param {WordArray|string} password The password. | |
8818 | * @param {WordArray|string} salt A salt. | |
8819 | * | |
8820 | * @return {WordArray} The derived key. | |
8821 | * | |
8822 | * @example | |
8823 | * | |
8824 | * var key = kdf.compute(password, salt); | |
8825 | */ | |
8826 | compute: function (password, salt) { | |
8827 | // Shortcut | |
8828 | var cfg = this.cfg; | |
8829 | ||
8830 | // Init HMAC | |
8831 | var hmac = HMAC.create(cfg.hasher, password); | |
8832 | ||
8833 | // Initial values | |
8834 | var derivedKey = WordArray.create(); | |
8835 | var blockIndex = WordArray.create([0x00000001]); | |
8836 | ||
8837 | // Shortcuts | |
8838 | var derivedKeyWords = derivedKey.words; | |
8839 | var blockIndexWords = blockIndex.words; | |
8840 | var keySize = cfg.keySize; | |
8841 | var iterations = cfg.iterations; | |
8842 | ||
8843 | // Generate key | |
8844 | while (derivedKeyWords.length < keySize) { | |
8845 | var block = hmac.update(salt).finalize(blockIndex); | |
8846 | hmac.reset(); | |
8847 | ||
8848 | // Shortcuts | |
8849 | var blockWords = block.words; | |
8850 | var blockWordsLength = blockWords.length; | |
8851 | ||
8852 | // Iterations | |
8853 | var intermediate = block; | |
8854 | for (var i = 1; i < iterations; i++) { | |
8855 | intermediate = hmac.finalize(intermediate); | |
8856 | hmac.reset(); | |
8857 | ||
8858 | // Shortcut | |
8859 | var intermediateWords = intermediate.words; | |
8860 | ||
8861 | // XOR intermediate with block | |
8862 | for (var j = 0; j < blockWordsLength; j++) { | |
8863 | blockWords[j] ^= intermediateWords[j]; | |
8864 | } | |
8865 | } | |
8866 | ||
8867 | derivedKey.concat(block); | |
8868 | blockIndexWords[0]++; | |
8869 | } | |
8870 | derivedKey.sigBytes = keySize * 4; | |
8871 | ||
8872 | return derivedKey; | |
8873 | } | |
8874 | }); | |
8875 | ||
8876 | /** | |
8877 | * Computes the Password-Based Key Derivation Function 2. | |
8878 | * | |
8879 | * @param {WordArray|string} password The password. | |
8880 | * @param {WordArray|string} salt A salt. | |
8881 | * @param {Object} cfg (Optional) The configuration options to use for this computation. | |
8882 | * | |
8883 | * @return {WordArray} The derived key. | |
8884 | * | |
8885 | * @static | |
8886 | * | |
8887 | * @example | |
8888 | * | |
8889 | * var key = CryptoJS.PBKDF2(password, salt); | |
8890 | * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 }); | |
8891 | * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 }); | |
8892 | */ | |
8893 | C.PBKDF2 = function (password, salt, cfg) { | |
8894 | return PBKDF2.create(cfg).compute(password, salt); | |
8895 | }; | |
8896 | }()); | |
8897 | ||
8898 | ||
8899 | return CryptoJS.PBKDF2; | |
8900 | ||
8901 | })); | |
8902 | },{"./core":31,"./hmac":36,"./sha1":55}],51:[function(_dereq_,module,exports){ | |
8903 | ;(function (root, factory, undef) { | |
8904 | if (typeof exports === "object") { | |
8905 | // CommonJS | |
8906 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); | |
8907 | } | |
8908 | else if (typeof define === "function" && define.amd) { | |
8909 | // AMD | |
8910 | define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); | |
8911 | } | |
8912 | else { | |
8913 | // Global (browser) | |
8914 | factory(root.CryptoJS); | |
8915 | } | |
8916 | }(this, function (CryptoJS) { | |
8917 | ||
8918 | (function () { | |
8919 | // Shortcuts | |
8920 | var C = CryptoJS; | |
8921 | var C_lib = C.lib; | |
8922 | var StreamCipher = C_lib.StreamCipher; | |
8923 | var C_algo = C.algo; | |
8924 | ||
8925 | // Reusable objects | |
8926 | var S = []; | |
8927 | var C_ = []; | |
8928 | var G = []; | |
8929 | ||
8930 | /** | |
8931 | * Rabbit stream cipher algorithm. | |
8932 | * | |
8933 | * This is a legacy version that neglected to convert the key to little-endian. | |
8934 | * This error doesn't affect the cipher's security, | |
8935 | * but it does affect its compatibility with other implementations. | |
8936 | */ | |
8937 | var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({ | |
8938 | _doReset: function () { | |
8939 | // Shortcuts | |
8940 | var K = this._key.words; | |
8941 | var iv = this.cfg.iv; | |
8942 | ||
8943 | // Generate initial state values | |
8944 | var X = this._X = [ | |
8945 | K[0], (K[3] << 16) | (K[2] >>> 16), | |
8946 | K[1], (K[0] << 16) | (K[3] >>> 16), | |
8947 | K[2], (K[1] << 16) | (K[0] >>> 16), | |
8948 | K[3], (K[2] << 16) | (K[1] >>> 16) | |
8949 | ]; | |
8950 | ||
8951 | // Generate initial counter values | |
8952 | var C = this._C = [ | |
8953 | (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), | |
8954 | (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), | |
8955 | (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), | |
8956 | (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) | |
8957 | ]; | |
8958 | ||
8959 | // Carry bit | |
8960 | this._b = 0; | |
8961 | ||
8962 | // Iterate the system four times | |
8963 | for (var i = 0; i < 4; i++) { | |
8964 | nextState.call(this); | |
8965 | } | |
8966 | ||
8967 | // Modify the counters | |
8968 | for (var i = 0; i < 8; i++) { | |
8969 | C[i] ^= X[(i + 4) & 7]; | |
8970 | } | |
8971 | ||
8972 | // IV setup | |
8973 | if (iv) { | |
8974 | // Shortcuts | |
8975 | var IV = iv.words; | |
8976 | var IV_0 = IV[0]; | |
8977 | var IV_1 = IV[1]; | |
8978 | ||
8979 | // Generate four subvectors | |
8980 | var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); | |
8981 | var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); | |
8982 | var i1 = (i0 >>> 16) | (i2 & 0xffff0000); | |
8983 | var i3 = (i2 << 16) | (i0 & 0x0000ffff); | |
8984 | ||
8985 | // Modify counter values | |
8986 | C[0] ^= i0; | |
8987 | C[1] ^= i1; | |
8988 | C[2] ^= i2; | |
8989 | C[3] ^= i3; | |
8990 | C[4] ^= i0; | |
8991 | C[5] ^= i1; | |
8992 | C[6] ^= i2; | |
8993 | C[7] ^= i3; | |
8994 | ||
8995 | // Iterate the system four times | |
8996 | for (var i = 0; i < 4; i++) { | |
8997 | nextState.call(this); | |
8998 | } | |
8999 | } | |
9000 | }, | |
9001 | ||
9002 | _doProcessBlock: function (M, offset) { | |
9003 | // Shortcut | |
9004 | var X = this._X; | |
9005 | ||
9006 | // Iterate the system | |
9007 | nextState.call(this); | |
9008 | ||
9009 | // Generate four keystream words | |
9010 | S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); | |
9011 | S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); | |
9012 | S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); | |
9013 | S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); | |
9014 | ||
9015 | for (var i = 0; i < 4; i++) { | |
9016 | // Swap endian | |
9017 | S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | | |
9018 | (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); | |
9019 | ||
9020 | // Encrypt | |
9021 | M[offset + i] ^= S[i]; | |
9022 | } | |
9023 | }, | |
9024 | ||
9025 | blockSize: 128/32, | |
9026 | ||
9027 | ivSize: 64/32 | |
9028 | }); | |
9029 | ||
9030 | function nextState() { | |
9031 | // Shortcuts | |
9032 | var X = this._X; | |
9033 | var C = this._C; | |
9034 | ||
9035 | // Save old counter values | |
9036 | for (var i = 0; i < 8; i++) { | |
9037 | C_[i] = C[i]; | |
9038 | } | |
9039 | ||
9040 | // Calculate new counter values | |
9041 | C[0] = (C[0] + 0x4d34d34d + this._b) | 0; | |
9042 | C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; | |
9043 | C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; | |
9044 | C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; | |
9045 | C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; | |
9046 | C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; | |
9047 | C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; | |
9048 | C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; | |
9049 | this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; | |
9050 | ||
9051 | // Calculate the g-values | |
9052 | for (var i = 0; i < 8; i++) { | |
9053 | var gx = X[i] + C[i]; | |
9054 | ||
9055 | // Construct high and low argument for squaring | |
9056 | var ga = gx & 0xffff; | |
9057 | var gb = gx >>> 16; | |
9058 | ||
9059 | // Calculate high and low result of squaring | |
9060 | var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; | |
9061 | var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); | |
9062 | ||
9063 | // High XOR low | |
9064 | G[i] = gh ^ gl; | |
9065 | } | |
9066 | ||
9067 | // Calculate new state values | |
9068 | X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; | |
9069 | X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; | |
9070 | X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; | |
9071 | X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; | |
9072 | X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; | |
9073 | X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; | |
9074 | X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; | |
9075 | X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; | |
9076 | } | |
9077 | ||
9078 | /** | |
9079 | * Shortcut functions to the cipher's object interface. | |
9080 | * | |
9081 | * @example | |
9082 | * | |
9083 | * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg); | |
9084 | * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg); | |
9085 | */ | |
9086 | C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy); | |
9087 | }()); | |
9088 | ||
9089 | ||
9090 | return CryptoJS.RabbitLegacy; | |
9091 | ||
9092 | })); | |
9093 | },{"./cipher-core":30,"./core":31,"./enc-base64":32,"./evpkdf":34,"./md5":39}],52:[function(_dereq_,module,exports){ | |
9094 | ;(function (root, factory, undef) { | |
9095 | if (typeof exports === "object") { | |
9096 | // CommonJS | |
9097 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); | |
9098 | } | |
9099 | else if (typeof define === "function" && define.amd) { | |
9100 | // AMD | |
9101 | define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); | |
9102 | } | |
9103 | else { | |
9104 | // Global (browser) | |
9105 | factory(root.CryptoJS); | |
9106 | } | |
9107 | }(this, function (CryptoJS) { | |
9108 | ||
9109 | (function () { | |
9110 | // Shortcuts | |
9111 | var C = CryptoJS; | |
9112 | var C_lib = C.lib; | |
9113 | var StreamCipher = C_lib.StreamCipher; | |
9114 | var C_algo = C.algo; | |
9115 | ||
9116 | // Reusable objects | |
9117 | var S = []; | |
9118 | var C_ = []; | |
9119 | var G = []; | |
9120 | ||
9121 | /** | |
9122 | * Rabbit stream cipher algorithm | |
9123 | */ | |
9124 | var Rabbit = C_algo.Rabbit = StreamCipher.extend({ | |
9125 | _doReset: function () { | |
9126 | // Shortcuts | |
9127 | var K = this._key.words; | |
9128 | var iv = this.cfg.iv; | |
9129 | ||
9130 | // Swap endian | |
9131 | for (var i = 0; i < 4; i++) { | |
9132 | K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) | | |
9133 | (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00); | |
9134 | } | |
9135 | ||
9136 | // Generate initial state values | |
9137 | var X = this._X = [ | |
9138 | K[0], (K[3] << 16) | (K[2] >>> 16), | |
9139 | K[1], (K[0] << 16) | (K[3] >>> 16), | |
9140 | K[2], (K[1] << 16) | (K[0] >>> 16), | |
9141 | K[3], (K[2] << 16) | (K[1] >>> 16) | |
9142 | ]; | |
9143 | ||
9144 | // Generate initial counter values | |
9145 | var C = this._C = [ | |
9146 | (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), | |
9147 | (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), | |
9148 | (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), | |
9149 | (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) | |
9150 | ]; | |
9151 | ||
9152 | // Carry bit | |
9153 | this._b = 0; | |
9154 | ||
9155 | // Iterate the system four times | |
9156 | for (var i = 0; i < 4; i++) { | |
9157 | nextState.call(this); | |
9158 | } | |
9159 | ||
9160 | // Modify the counters | |
9161 | for (var i = 0; i < 8; i++) { | |
9162 | C[i] ^= X[(i + 4) & 7]; | |
9163 | } | |
9164 | ||
9165 | // IV setup | |
9166 | if (iv) { | |
9167 | // Shortcuts | |
9168 | var IV = iv.words; | |
9169 | var IV_0 = IV[0]; | |
9170 | var IV_1 = IV[1]; | |
9171 | ||
9172 | // Generate four subvectors | |
9173 | var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); | |
9174 | var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); | |
9175 | var i1 = (i0 >>> 16) | (i2 & 0xffff0000); | |
9176 | var i3 = (i2 << 16) | (i0 & 0x0000ffff); | |
9177 | ||
9178 | // Modify counter values | |
9179 | C[0] ^= i0; | |
9180 | C[1] ^= i1; | |
9181 | C[2] ^= i2; | |
9182 | C[3] ^= i3; | |
9183 | C[4] ^= i0; | |
9184 | C[5] ^= i1; | |
9185 | C[6] ^= i2; | |
9186 | C[7] ^= i3; | |
9187 | ||
9188 | // Iterate the system four times | |
9189 | for (var i = 0; i < 4; i++) { | |
9190 | nextState.call(this); | |
9191 | } | |
9192 | } | |
9193 | }, | |
9194 | ||
9195 | _doProcessBlock: function (M, offset) { | |
9196 | // Shortcut | |
9197 | var X = this._X; | |
9198 | ||
9199 | // Iterate the system | |
9200 | nextState.call(this); | |
9201 | ||
9202 | // Generate four keystream words | |
9203 | S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); | |
9204 | S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); | |
9205 | S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); | |
9206 | S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); | |
9207 | ||
9208 | for (var i = 0; i < 4; i++) { | |
9209 | // Swap endian | |
9210 | S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | | |
9211 | (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); | |
9212 | ||
9213 | // Encrypt | |
9214 | M[offset + i] ^= S[i]; | |
9215 | } | |
9216 | }, | |
9217 | ||
9218 | blockSize: 128/32, | |
9219 | ||
9220 | ivSize: 64/32 | |
9221 | }); | |
9222 | ||
9223 | function nextState() { | |
9224 | // Shortcuts | |
9225 | var X = this._X; | |
9226 | var C = this._C; | |
9227 | ||
9228 | // Save old counter values | |
9229 | for (var i = 0; i < 8; i++) { | |
9230 | C_[i] = C[i]; | |
9231 | } | |
9232 | ||
9233 | // Calculate new counter values | |
9234 | C[0] = (C[0] + 0x4d34d34d + this._b) | 0; | |
9235 | C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; | |
9236 | C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; | |
9237 | C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; | |
9238 | C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; | |
9239 | C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; | |
9240 | C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; | |
9241 | C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; | |
9242 | this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; | |
9243 | ||
9244 | // Calculate the g-values | |
9245 | for (var i = 0; i < 8; i++) { | |
9246 | var gx = X[i] + C[i]; | |
9247 | ||
9248 | // Construct high and low argument for squaring | |
9249 | var ga = gx & 0xffff; | |
9250 | var gb = gx >>> 16; | |
9251 | ||
9252 | // Calculate high and low result of squaring | |
9253 | var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; | |
9254 | var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); | |
9255 | ||
9256 | // High XOR low | |
9257 | G[i] = gh ^ gl; | |
9258 | } | |
9259 | ||
9260 | // Calculate new state values | |
9261 | X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; | |
9262 | X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; | |
9263 | X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; | |
9264 | X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; | |
9265 | X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; | |
9266 | X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; | |
9267 | X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; | |
9268 | X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; | |
9269 | } | |
9270 | ||
9271 | /** | |
9272 | * Shortcut functions to the cipher's object interface. | |
9273 | * | |
9274 | * @example | |
9275 | * | |
9276 | * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg); | |
9277 | * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg); | |
9278 | */ | |
9279 | C.Rabbit = StreamCipher._createHelper(Rabbit); | |
9280 | }()); | |
9281 | ||
9282 | ||
9283 | return CryptoJS.Rabbit; | |
9284 | ||
9285 | })); | |
9286 | },{"./cipher-core":30,"./core":31,"./enc-base64":32,"./evpkdf":34,"./md5":39}],53:[function(_dereq_,module,exports){ | |
9287 | ;(function (root, factory, undef) { | |
9288 | if (typeof exports === "object") { | |
9289 | // CommonJS | |
9290 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); | |
9291 | } | |
9292 | else if (typeof define === "function" && define.amd) { | |
9293 | // AMD | |
9294 | define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); | |
9295 | } | |
9296 | else { | |
9297 | // Global (browser) | |
9298 | factory(root.CryptoJS); | |
9299 | } | |
9300 | }(this, function (CryptoJS) { | |
9301 | ||
9302 | (function () { | |
9303 | // Shortcuts | |
9304 | var C = CryptoJS; | |
9305 | var C_lib = C.lib; | |
9306 | var StreamCipher = C_lib.StreamCipher; | |
9307 | var C_algo = C.algo; | |
9308 | ||
9309 | /** | |
9310 | * RC4 stream cipher algorithm. | |
9311 | */ | |
9312 | var RC4 = C_algo.RC4 = StreamCipher.extend({ | |
9313 | _doReset: function () { | |
9314 | // Shortcuts | |
9315 | var key = this._key; | |
9316 | var keyWords = key.words; | |
9317 | var keySigBytes = key.sigBytes; | |
9318 | ||
9319 | // Init sbox | |
9320 | var S = this._S = []; | |
9321 | for (var i = 0; i < 256; i++) { | |
9322 | S[i] = i; | |
9323 | } | |
9324 | ||
9325 | // Key setup | |
9326 | for (var i = 0, j = 0; i < 256; i++) { | |
9327 | var keyByteIndex = i % keySigBytes; | |
9328 | var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff; | |
9329 | ||
9330 | j = (j + S[i] + keyByte) % 256; | |
9331 | ||
9332 | // Swap | |
9333 | var t = S[i]; | |
9334 | S[i] = S[j]; | |
9335 | S[j] = t; | |
9336 | } | |
9337 | ||
9338 | // Counters | |
9339 | this._i = this._j = 0; | |
9340 | }, | |
9341 | ||
9342 | _doProcessBlock: function (M, offset) { | |
9343 | M[offset] ^= generateKeystreamWord.call(this); | |
9344 | }, | |
9345 | ||
9346 | keySize: 256/32, | |
9347 | ||
9348 | ivSize: 0 | |
9349 | }); | |
9350 | ||
9351 | function generateKeystreamWord() { | |
9352 | // Shortcuts | |
9353 | var S = this._S; | |
9354 | var i = this._i; | |
9355 | var j = this._j; | |
9356 | ||
9357 | // Generate keystream word | |
9358 | var keystreamWord = 0; | |
9359 | for (var n = 0; n < 4; n++) { | |
9360 | i = (i + 1) % 256; | |
9361 | j = (j + S[i]) % 256; | |
9362 | ||
9363 | // Swap | |
9364 | var t = S[i]; | |
9365 | S[i] = S[j]; | |
9366 | S[j] = t; | |
9367 | ||
9368 | keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8); | |
9369 | } | |
9370 | ||
9371 | // Update counters | |
9372 | this._i = i; | |
9373 | this._j = j; | |
9374 | ||
9375 | return keystreamWord; | |
9376 | } | |
9377 | ||
9378 | /** | |
9379 | * Shortcut functions to the cipher's object interface. | |
9380 | * | |
9381 | * @example | |
9382 | * | |
9383 | * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg); | |
9384 | * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg); | |
9385 | */ | |
9386 | C.RC4 = StreamCipher._createHelper(RC4); | |
9387 | ||
9388 | /** | |
9389 | * Modified RC4 stream cipher algorithm. | |
9390 | */ | |
9391 | var RC4Drop = C_algo.RC4Drop = RC4.extend({ | |
9392 | /** | |
9393 | * Configuration options. | |
9394 | * | |
9395 | * @property {number} drop The number of keystream words to drop. Default 192 | |
9396 | */ | |
9397 | cfg: RC4.cfg.extend({ | |
9398 | drop: 192 | |
9399 | }), | |
9400 | ||
9401 | _doReset: function () { | |
9402 | RC4._doReset.call(this); | |
9403 | ||
9404 | // Drop | |
9405 | for (var i = this.cfg.drop; i > 0; i--) { | |
9406 | generateKeystreamWord.call(this); | |
9407 | } | |
9408 | } | |
9409 | }); | |
9410 | ||
9411 | /** | |
9412 | * Shortcut functions to the cipher's object interface. | |
9413 | * | |
9414 | * @example | |
9415 | * | |
9416 | * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg); | |
9417 | * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg); | |
9418 | */ | |
9419 | C.RC4Drop = StreamCipher._createHelper(RC4Drop); | |
9420 | }()); | |
9421 | ||
9422 | ||
9423 | return CryptoJS.RC4; | |
9424 | ||
9425 | })); | |
9426 | },{"./cipher-core":30,"./core":31,"./enc-base64":32,"./evpkdf":34,"./md5":39}],54:[function(_dereq_,module,exports){ | |
9427 | ;(function (root, factory) { | |
9428 | if (typeof exports === "object") { | |
9429 | // CommonJS | |
9430 | module.exports = exports = factory(_dereq_("./core")); | |
9431 | } | |
9432 | else if (typeof define === "function" && define.amd) { | |
9433 | // AMD | |
9434 | define(["./core"], factory); | |
9435 | } | |
9436 | else { | |
9437 | // Global (browser) | |
9438 | factory(root.CryptoJS); | |
9439 | } | |
9440 | }(this, function (CryptoJS) { | |
9441 | ||
9442 | /** @preserve | |
9443 | (c) 2012 by Cédric Mesnil. All rights reserved. | |
9444 | ||
9445 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |
9446 | ||
9447 | - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |
9448 | - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | |
9449 | ||
9450 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
9451 | */ | |
9452 | ||
9453 | (function (Math) { | |
9454 | // Shortcuts | |
9455 | var C = CryptoJS; | |
9456 | var C_lib = C.lib; | |
9457 | var WordArray = C_lib.WordArray; | |
9458 | var Hasher = C_lib.Hasher; | |
9459 | var C_algo = C.algo; | |
9460 | ||
9461 | // Constants table | |
9462 | var _zl = WordArray.create([ | |
9463 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | |
9464 | 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, | |
9465 | 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, | |
9466 | 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, | |
9467 | 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]); | |
9468 | var _zr = WordArray.create([ | |
9469 | 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, | |
9470 | 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, | |
9471 | 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, | |
9472 | 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, | |
9473 | 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]); | |
9474 | var _sl = WordArray.create([ | |
9475 | 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, | |
9476 | 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, | |
9477 | 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, | |
9478 | 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, | |
9479 | 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]); | |
9480 | var _sr = WordArray.create([ | |
9481 | 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, | |
9482 | 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, | |
9483 | 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, | |
9484 | 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, | |
9485 | 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]); | |
9486 | ||
9487 | var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]); | |
9488 | var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]); | |
9489 | ||
9490 | /** | |
9491 | * RIPEMD160 hash algorithm. | |
9492 | */ | |
9493 | var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({ | |
9494 | _doReset: function () { | |
9495 | this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]); | |
9496 | }, | |
9497 | ||
9498 | _doProcessBlock: function (M, offset) { | |
9499 | ||
9500 | // Swap endian | |
9501 | for (var i = 0; i < 16; i++) { | |
9502 | // Shortcuts | |
9503 | var offset_i = offset + i; | |
9504 | var M_offset_i = M[offset_i]; | |
9505 | ||
9506 | // Swap | |
9507 | M[offset_i] = ( | |
9508 | (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | | |
9509 | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) | |
9510 | ); | |
9511 | } | |
9512 | // Shortcut | |
9513 | var H = this._hash.words; | |
9514 | var hl = _hl.words; | |
9515 | var hr = _hr.words; | |
9516 | var zl = _zl.words; | |
9517 | var zr = _zr.words; | |
9518 | var sl = _sl.words; | |
9519 | var sr = _sr.words; | |
9520 | ||
9521 | // Working variables | |
9522 | var al, bl, cl, dl, el; | |
9523 | var ar, br, cr, dr, er; | |
9524 | ||
9525 | ar = al = H[0]; | |
9526 | br = bl = H[1]; | |
9527 | cr = cl = H[2]; | |
9528 | dr = dl = H[3]; | |
9529 | er = el = H[4]; | |
9530 | // Computation | |
9531 | var t; | |
9532 | for (var i = 0; i < 80; i += 1) { | |
9533 | t = (al + M[offset+zl[i]])|0; | |
9534 | if (i<16){ | |
9535 | t += f1(bl,cl,dl) + hl[0]; | |
9536 | } else if (i<32) { | |
9537 | t += f2(bl,cl,dl) + hl[1]; | |
9538 | } else if (i<48) { | |
9539 | t += f3(bl,cl,dl) + hl[2]; | |
9540 | } else if (i<64) { | |
9541 | t += f4(bl,cl,dl) + hl[3]; | |
9542 | } else {// if (i<80) { | |
9543 | t += f5(bl,cl,dl) + hl[4]; | |
9544 | } | |
9545 | t = t|0; | |
9546 | t = rotl(t,sl[i]); | |
9547 | t = (t+el)|0; | |
9548 | al = el; | |
9549 | el = dl; | |
9550 | dl = rotl(cl, 10); | |
9551 | cl = bl; | |
9552 | bl = t; | |
9553 | ||
9554 | t = (ar + M[offset+zr[i]])|0; | |
9555 | if (i<16){ | |
9556 | t += f5(br,cr,dr) + hr[0]; | |
9557 | } else if (i<32) { | |
9558 | t += f4(br,cr,dr) + hr[1]; | |
9559 | } else if (i<48) { | |
9560 | t += f3(br,cr,dr) + hr[2]; | |
9561 | } else if (i<64) { | |
9562 | t += f2(br,cr,dr) + hr[3]; | |
9563 | } else {// if (i<80) { | |
9564 | t += f1(br,cr,dr) + hr[4]; | |
9565 | } | |
9566 | t = t|0; | |
9567 | t = rotl(t,sr[i]) ; | |
9568 | t = (t+er)|0; | |
9569 | ar = er; | |
9570 | er = dr; | |
9571 | dr = rotl(cr, 10); | |
9572 | cr = br; | |
9573 | br = t; | |
9574 | } | |
9575 | // Intermediate hash value | |
9576 | t = (H[1] + cl + dr)|0; | |
9577 | H[1] = (H[2] + dl + er)|0; | |
9578 | H[2] = (H[3] + el + ar)|0; | |
9579 | H[3] = (H[4] + al + br)|0; | |
9580 | H[4] = (H[0] + bl + cr)|0; | |
9581 | H[0] = t; | |
9582 | }, | |
9583 | ||
9584 | _doFinalize: function () { | |
9585 | // Shortcuts | |
9586 | var data = this._data; | |
9587 | var dataWords = data.words; | |
9588 | ||
9589 | var nBitsTotal = this._nDataBytes * 8; | |
9590 | var nBitsLeft = data.sigBytes * 8; | |
9591 | ||
9592 | // Add padding | |
9593 | dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); | |
9594 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( | |
9595 | (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | | |
9596 | (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) | |
9597 | ); | |
9598 | data.sigBytes = (dataWords.length + 1) * 4; | |
9599 | ||
9600 | // Hash final blocks | |
9601 | this._process(); | |
9602 | ||
9603 | // Shortcuts | |
9604 | var hash = this._hash; | |
9605 | var H = hash.words; | |
9606 | ||
9607 | // Swap endian | |
9608 | for (var i = 0; i < 5; i++) { | |
9609 | // Shortcut | |
9610 | var H_i = H[i]; | |
9611 | ||
9612 | // Swap | |
9613 | H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | | |
9614 | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); | |
9615 | } | |
9616 | ||
9617 | // Return final computed hash | |
9618 | return hash; | |
9619 | }, | |
9620 | ||
9621 | clone: function () { | |
9622 | var clone = Hasher.clone.call(this); | |
9623 | clone._hash = this._hash.clone(); | |
9624 | ||
9625 | return clone; | |
9626 | } | |
9627 | }); | |
9628 | ||
9629 | ||
9630 | function f1(x, y, z) { | |
9631 | return ((x) ^ (y) ^ (z)); | |
9632 | ||
9633 | } | |
9634 | ||
9635 | function f2(x, y, z) { | |
9636 | return (((x)&(y)) | ((~x)&(z))); | |
9637 | } | |
9638 | ||
9639 | function f3(x, y, z) { | |
9640 | return (((x) | (~(y))) ^ (z)); | |
9641 | } | |
9642 | ||
9643 | function f4(x, y, z) { | |
9644 | return (((x) & (z)) | ((y)&(~(z)))); | |
9645 | } | |
9646 | ||
9647 | function f5(x, y, z) { | |
9648 | return ((x) ^ ((y) |(~(z)))); | |
9649 | ||
9650 | } | |
9651 | ||
9652 | function rotl(x,n) { | |
9653 | return (x<<n) | (x>>>(32-n)); | |
9654 | } | |
9655 | ||
9656 | ||
9657 | /** | |
9658 | * Shortcut function to the hasher's object interface. | |
9659 | * | |
9660 | * @param {WordArray|string} message The message to hash. | |
9661 | * | |
9662 | * @return {WordArray} The hash. | |
9663 | * | |
9664 | * @static | |
9665 | * | |
9666 | * @example | |
9667 | * | |
9668 | * var hash = CryptoJS.RIPEMD160('message'); | |
9669 | * var hash = CryptoJS.RIPEMD160(wordArray); | |
9670 | */ | |
9671 | C.RIPEMD160 = Hasher._createHelper(RIPEMD160); | |
9672 | ||
9673 | /** | |
9674 | * Shortcut function to the HMAC's object interface. | |
9675 | * | |
9676 | * @param {WordArray|string} message The message to hash. | |
9677 | * @param {WordArray|string} key The secret key. | |
9678 | * | |
9679 | * @return {WordArray} The HMAC. | |
9680 | * | |
9681 | * @static | |
9682 | * | |
9683 | * @example | |
9684 | * | |
9685 | * var hmac = CryptoJS.HmacRIPEMD160(message, key); | |
9686 | */ | |
9687 | C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160); | |
9688 | }(Math)); | |
9689 | ||
9690 | ||
9691 | return CryptoJS.RIPEMD160; | |
9692 | ||
9693 | })); | |
9694 | },{"./core":31}],55:[function(_dereq_,module,exports){ | |
9695 | ;(function (root, factory) { | |
9696 | if (typeof exports === "object") { | |
9697 | // CommonJS | |
9698 | module.exports = exports = factory(_dereq_("./core")); | |
9699 | } | |
9700 | else if (typeof define === "function" && define.amd) { | |
9701 | // AMD | |
9702 | define(["./core"], factory); | |
9703 | } | |
9704 | else { | |
9705 | // Global (browser) | |
9706 | factory(root.CryptoJS); | |
9707 | } | |
9708 | }(this, function (CryptoJS) { | |
9709 | ||
9710 | (function () { | |
9711 | // Shortcuts | |
9712 | var C = CryptoJS; | |
9713 | var C_lib = C.lib; | |
9714 | var WordArray = C_lib.WordArray; | |
9715 | var Hasher = C_lib.Hasher; | |
9716 | var C_algo = C.algo; | |
9717 | ||
9718 | // Reusable object | |
9719 | var W = []; | |
9720 | ||
9721 | /** | |
9722 | * SHA-1 hash algorithm. | |
9723 | */ | |
9724 | var SHA1 = C_algo.SHA1 = Hasher.extend({ | |
9725 | _doReset: function () { | |
9726 | this._hash = new WordArray.init([ | |
9727 | 0x67452301, 0xefcdab89, | |
9728 | 0x98badcfe, 0x10325476, | |
9729 | 0xc3d2e1f0 | |
9730 | ]); | |
9731 | }, | |
9732 | ||
9733 | _doProcessBlock: function (M, offset) { | |
9734 | // Shortcut | |
9735 | var H = this._hash.words; | |
9736 | ||
9737 | // Working variables | |
9738 | var a = H[0]; | |
9739 | var b = H[1]; | |
9740 | var c = H[2]; | |
9741 | var d = H[3]; | |
9742 | var e = H[4]; | |
9743 | ||
9744 | // Computation | |
9745 | for (var i = 0; i < 80; i++) { | |
9746 | if (i < 16) { | |
9747 | W[i] = M[offset + i] | 0; | |
9748 | } else { | |
9749 | var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; | |
9750 | W[i] = (n << 1) | (n >>> 31); | |
9751 | } | |
9752 | ||
9753 | var t = ((a << 5) | (a >>> 27)) + e + W[i]; | |
9754 | if (i < 20) { | |
9755 | t += ((b & c) | (~b & d)) + 0x5a827999; | |
9756 | } else if (i < 40) { | |
9757 | t += (b ^ c ^ d) + 0x6ed9eba1; | |
9758 | } else if (i < 60) { | |
9759 | t += ((b & c) | (b & d) | (c & d)) - 0x70e44324; | |
9760 | } else /* if (i < 80) */ { | |
9761 | t += (b ^ c ^ d) - 0x359d3e2a; | |
9762 | } | |
9763 | ||
9764 | e = d; | |
9765 | d = c; | |
9766 | c = (b << 30) | (b >>> 2); | |
9767 | b = a; | |
9768 | a = t; | |
9769 | } | |
9770 | ||
9771 | // Intermediate hash value | |
9772 | H[0] = (H[0] + a) | 0; | |
9773 | H[1] = (H[1] + b) | 0; | |
9774 | H[2] = (H[2] + c) | 0; | |
9775 | H[3] = (H[3] + d) | 0; | |
9776 | H[4] = (H[4] + e) | 0; | |
9777 | }, | |
9778 | ||
9779 | _doFinalize: function () { | |
9780 | // Shortcuts | |
9781 | var data = this._data; | |
9782 | var dataWords = data.words; | |
9783 | ||
9784 | var nBitsTotal = this._nDataBytes * 8; | |
9785 | var nBitsLeft = data.sigBytes * 8; | |
9786 | ||
9787 | // Add padding | |
9788 | dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); | |
9789 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); | |
9790 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; | |
9791 | data.sigBytes = dataWords.length * 4; | |
9792 | ||
9793 | // Hash final blocks | |
9794 | this._process(); | |
9795 | ||
9796 | // Return final computed hash | |
9797 | return this._hash; | |
9798 | }, | |
9799 | ||
9800 | clone: function () { | |
9801 | var clone = Hasher.clone.call(this); | |
9802 | clone._hash = this._hash.clone(); | |
9803 | ||
9804 | return clone; | |
9805 | } | |
9806 | }); | |
9807 | ||
9808 | /** | |
9809 | * Shortcut function to the hasher's object interface. | |
9810 | * | |
9811 | * @param {WordArray|string} message The message to hash. | |
9812 | * | |
9813 | * @return {WordArray} The hash. | |
9814 | * | |
9815 | * @static | |
9816 | * | |
9817 | * @example | |
9818 | * | |
9819 | * var hash = CryptoJS.SHA1('message'); | |
9820 | * var hash = CryptoJS.SHA1(wordArray); | |
9821 | */ | |
9822 | C.SHA1 = Hasher._createHelper(SHA1); | |
9823 | ||
9824 | /** | |
9825 | * Shortcut function to the HMAC's object interface. | |
9826 | * | |
9827 | * @param {WordArray|string} message The message to hash. | |
9828 | * @param {WordArray|string} key The secret key. | |
9829 | * | |
9830 | * @return {WordArray} The HMAC. | |
9831 | * | |
9832 | * @static | |
9833 | * | |
9834 | * @example | |
9835 | * | |
9836 | * var hmac = CryptoJS.HmacSHA1(message, key); | |
9837 | */ | |
9838 | C.HmacSHA1 = Hasher._createHmacHelper(SHA1); | |
9839 | }()); | |
9840 | ||
9841 | ||
9842 | return CryptoJS.SHA1; | |
9843 | ||
9844 | })); | |
9845 | },{"./core":31}],56:[function(_dereq_,module,exports){ | |
9846 | ;(function (root, factory, undef) { | |
9847 | if (typeof exports === "object") { | |
9848 | // CommonJS | |
9849 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha256")); | |
9850 | } | |
9851 | else if (typeof define === "function" && define.amd) { | |
9852 | // AMD | |
9853 | define(["./core", "./sha256"], factory); | |
9854 | } | |
9855 | else { | |
9856 | // Global (browser) | |
9857 | factory(root.CryptoJS); | |
9858 | } | |
9859 | }(this, function (CryptoJS) { | |
9860 | ||
9861 | (function () { | |
9862 | // Shortcuts | |
9863 | var C = CryptoJS; | |
9864 | var C_lib = C.lib; | |
9865 | var WordArray = C_lib.WordArray; | |
9866 | var C_algo = C.algo; | |
9867 | var SHA256 = C_algo.SHA256; | |
9868 | ||
9869 | /** | |
9870 | * SHA-224 hash algorithm. | |
9871 | */ | |
9872 | var SHA224 = C_algo.SHA224 = SHA256.extend({ | |
9873 | _doReset: function () { | |
9874 | this._hash = new WordArray.init([ | |
9875 | 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, | |
9876 | 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 | |
9877 | ]); | |
9878 | }, | |
9879 | ||
9880 | _doFinalize: function () { | |
9881 | var hash = SHA256._doFinalize.call(this); | |
9882 | ||
9883 | hash.sigBytes -= 4; | |
9884 | ||
9885 | return hash; | |
9886 | } | |
9887 | }); | |
9888 | ||
9889 | /** | |
9890 | * Shortcut function to the hasher's object interface. | |
9891 | * | |
9892 | * @param {WordArray|string} message The message to hash. | |
9893 | * | |
9894 | * @return {WordArray} The hash. | |
9895 | * | |
9896 | * @static | |
9897 | * | |
9898 | * @example | |
9899 | * | |
9900 | * var hash = CryptoJS.SHA224('message'); | |
9901 | * var hash = CryptoJS.SHA224(wordArray); | |
9902 | */ | |
9903 | C.SHA224 = SHA256._createHelper(SHA224); | |
9904 | ||
9905 | /** | |
9906 | * Shortcut function to the HMAC's object interface. | |
9907 | * | |
9908 | * @param {WordArray|string} message The message to hash. | |
9909 | * @param {WordArray|string} key The secret key. | |
9910 | * | |
9911 | * @return {WordArray} The HMAC. | |
9912 | * | |
9913 | * @static | |
9914 | * | |
9915 | * @example | |
9916 | * | |
9917 | * var hmac = CryptoJS.HmacSHA224(message, key); | |
9918 | */ | |
9919 | C.HmacSHA224 = SHA256._createHmacHelper(SHA224); | |
9920 | }()); | |
9921 | ||
9922 | ||
9923 | return CryptoJS.SHA224; | |
9924 | ||
9925 | })); | |
9926 | },{"./core":31,"./sha256":57}],57:[function(_dereq_,module,exports){ | |
9927 | ;(function (root, factory) { | |
9928 | if (typeof exports === "object") { | |
9929 | // CommonJS | |
9930 | module.exports = exports = factory(_dereq_("./core")); | |
9931 | } | |
9932 | else if (typeof define === "function" && define.amd) { | |
9933 | // AMD | |
9934 | define(["./core"], factory); | |
9935 | } | |
9936 | else { | |
9937 | // Global (browser) | |
9938 | factory(root.CryptoJS); | |
9939 | } | |
9940 | }(this, function (CryptoJS) { | |
9941 | ||
9942 | (function (Math) { | |
9943 | // Shortcuts | |
9944 | var C = CryptoJS; | |
9945 | var C_lib = C.lib; | |
9946 | var WordArray = C_lib.WordArray; | |
9947 | var Hasher = C_lib.Hasher; | |
9948 | var C_algo = C.algo; | |
9949 | ||
9950 | // Initialization and round constants tables | |
9951 | var H = []; | |
9952 | var K = []; | |
9953 | ||
9954 | // Compute constants | |
9955 | (function () { | |
9956 | function isPrime(n) { | |
9957 | var sqrtN = Math.sqrt(n); | |
9958 | for (var factor = 2; factor <= sqrtN; factor++) { | |
9959 | if (!(n % factor)) { | |
9960 | return false; | |
9961 | } | |
9962 | } | |
9963 | ||
9964 | return true; | |
9965 | } | |
9966 | ||
9967 | function getFractionalBits(n) { | |
9968 | return ((n - (n | 0)) * 0x100000000) | 0; | |
9969 | } | |
9970 | ||
9971 | var n = 2; | |
9972 | var nPrime = 0; | |
9973 | while (nPrime < 64) { | |
9974 | if (isPrime(n)) { | |
9975 | if (nPrime < 8) { | |
9976 | H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2)); | |
9977 | } | |
9978 | K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3)); | |
9979 | ||
9980 | nPrime++; | |
9981 | } | |
9982 | ||
9983 | n++; | |
9984 | } | |
9985 | }()); | |
9986 | ||
9987 | // Reusable object | |
9988 | var W = []; | |
9989 | ||
9990 | /** | |
9991 | * SHA-256 hash algorithm. | |
9992 | */ | |
9993 | var SHA256 = C_algo.SHA256 = Hasher.extend({ | |
9994 | _doReset: function () { | |
9995 | this._hash = new WordArray.init(H.slice(0)); | |
9996 | }, | |
9997 | ||
9998 | _doProcessBlock: function (M, offset) { | |
9999 | // Shortcut | |
10000 | var H = this._hash.words; | |
10001 | ||
10002 | // Working variables | |
10003 | var a = H[0]; | |
10004 | var b = H[1]; | |
10005 | var c = H[2]; | |
10006 | var d = H[3]; | |
10007 | var e = H[4]; | |
10008 | var f = H[5]; | |
10009 | var g = H[6]; | |
10010 | var h = H[7]; | |
10011 | ||
10012 | // Computation | |
10013 | for (var i = 0; i < 64; i++) { | |
10014 | if (i < 16) { | |
10015 | W[i] = M[offset + i] | 0; | |
10016 | } else { | |
10017 | var gamma0x = W[i - 15]; | |
10018 | var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ | |
10019 | ((gamma0x << 14) | (gamma0x >>> 18)) ^ | |
10020 | (gamma0x >>> 3); | |
10021 | ||
10022 | var gamma1x = W[i - 2]; | |
10023 | var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ | |
10024 | ((gamma1x << 13) | (gamma1x >>> 19)) ^ | |
10025 | (gamma1x >>> 10); | |
10026 | ||
10027 | W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]; | |
10028 | } | |
10029 | ||
10030 | var ch = (e & f) ^ (~e & g); | |
10031 | var maj = (a & b) ^ (a & c) ^ (b & c); | |
10032 | ||
10033 | var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22)); | |
10034 | var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25)); | |
10035 | ||
10036 | var t1 = h + sigma1 + ch + K[i] + W[i]; | |
10037 | var t2 = sigma0 + maj; | |
10038 | ||
10039 | h = g; | |
10040 | g = f; | |
10041 | f = e; | |
10042 | e = (d + t1) | 0; | |
10043 | d = c; | |
10044 | c = b; | |
10045 | b = a; | |
10046 | a = (t1 + t2) | 0; | |
10047 | } | |
10048 | ||
10049 | // Intermediate hash value | |
10050 | H[0] = (H[0] + a) | 0; | |
10051 | H[1] = (H[1] + b) | 0; | |
10052 | H[2] = (H[2] + c) | 0; | |
10053 | H[3] = (H[3] + d) | 0; | |
10054 | H[4] = (H[4] + e) | 0; | |
10055 | H[5] = (H[5] + f) | 0; | |
10056 | H[6] = (H[6] + g) | 0; | |
10057 | H[7] = (H[7] + h) | 0; | |
10058 | }, | |
10059 | ||
10060 | _doFinalize: function () { | |
10061 | // Shortcuts | |
10062 | var data = this._data; | |
10063 | var dataWords = data.words; | |
10064 | ||
10065 | var nBitsTotal = this._nDataBytes * 8; | |
10066 | var nBitsLeft = data.sigBytes * 8; | |
10067 | ||
10068 | // Add padding | |
10069 | dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); | |
10070 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); | |
10071 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; | |
10072 | data.sigBytes = dataWords.length * 4; | |
10073 | ||
10074 | // Hash final blocks | |
10075 | this._process(); | |
10076 | ||
10077 | // Return final computed hash | |
10078 | return this._hash; | |
10079 | }, | |
10080 | ||
10081 | clone: function () { | |
10082 | var clone = Hasher.clone.call(this); | |
10083 | clone._hash = this._hash.clone(); | |
10084 | ||
10085 | return clone; | |
10086 | } | |
10087 | }); | |
10088 | ||
10089 | /** | |
10090 | * Shortcut function to the hasher's object interface. | |
10091 | * | |
10092 | * @param {WordArray|string} message The message to hash. | |
10093 | * | |
10094 | * @return {WordArray} The hash. | |
10095 | * | |
10096 | * @static | |
10097 | * | |
10098 | * @example | |
10099 | * | |
10100 | * var hash = CryptoJS.SHA256('message'); | |
10101 | * var hash = CryptoJS.SHA256(wordArray); | |
10102 | */ | |
10103 | C.SHA256 = Hasher._createHelper(SHA256); | |
10104 | ||
10105 | /** | |
10106 | * Shortcut function to the HMAC's object interface. | |
10107 | * | |
10108 | * @param {WordArray|string} message The message to hash. | |
10109 | * @param {WordArray|string} key The secret key. | |
10110 | * | |
10111 | * @return {WordArray} The HMAC. | |
10112 | * | |
10113 | * @static | |
10114 | * | |
10115 | * @example | |
10116 | * | |
10117 | * var hmac = CryptoJS.HmacSHA256(message, key); | |
10118 | */ | |
10119 | C.HmacSHA256 = Hasher._createHmacHelper(SHA256); | |
10120 | }(Math)); | |
10121 | ||
10122 | ||
10123 | return CryptoJS.SHA256; | |
10124 | ||
10125 | })); | |
10126 | },{"./core":31}],58:[function(_dereq_,module,exports){ | |
10127 | ;(function (root, factory, undef) { | |
10128 | if (typeof exports === "object") { | |
10129 | // CommonJS | |
10130 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core")); | |
10131 | } | |
10132 | else if (typeof define === "function" && define.amd) { | |
10133 | // AMD | |
10134 | define(["./core", "./x64-core"], factory); | |
10135 | } | |
10136 | else { | |
10137 | // Global (browser) | |
10138 | factory(root.CryptoJS); | |
10139 | } | |
10140 | }(this, function (CryptoJS) { | |
10141 | ||
10142 | (function (Math) { | |
10143 | // Shortcuts | |
10144 | var C = CryptoJS; | |
10145 | var C_lib = C.lib; | |
10146 | var WordArray = C_lib.WordArray; | |
10147 | var Hasher = C_lib.Hasher; | |
10148 | var C_x64 = C.x64; | |
10149 | var X64Word = C_x64.Word; | |
10150 | var C_algo = C.algo; | |
10151 | ||
10152 | // Constants tables | |
10153 | var RHO_OFFSETS = []; | |
10154 | var PI_INDEXES = []; | |
10155 | var ROUND_CONSTANTS = []; | |
10156 | ||
10157 | // Compute Constants | |
10158 | (function () { | |
10159 | // Compute rho offset constants | |
10160 | var x = 1, y = 0; | |
10161 | for (var t = 0; t < 24; t++) { | |
10162 | RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64; | |
10163 | ||
10164 | var newX = y % 5; | |
10165 | var newY = (2 * x + 3 * y) % 5; | |
10166 | x = newX; | |
10167 | y = newY; | |
10168 | } | |
10169 | ||
10170 | // Compute pi index constants | |
10171 | for (var x = 0; x < 5; x++) { | |
10172 | for (var y = 0; y < 5; y++) { | |
10173 | PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5; | |
10174 | } | |
10175 | } | |
10176 | ||
10177 | // Compute round constants | |
10178 | var LFSR = 0x01; | |
10179 | for (var i = 0; i < 24; i++) { | |
10180 | var roundConstantMsw = 0; | |
10181 | var roundConstantLsw = 0; | |
10182 | ||
10183 | for (var j = 0; j < 7; j++) { | |
10184 | if (LFSR & 0x01) { | |
10185 | var bitPosition = (1 << j) - 1; | |
10186 | if (bitPosition < 32) { | |
10187 | roundConstantLsw ^= 1 << bitPosition; | |
10188 | } else /* if (bitPosition >= 32) */ { | |
10189 | roundConstantMsw ^= 1 << (bitPosition - 32); | |
10190 | } | |
10191 | } | |
10192 | ||
10193 | // Compute next LFSR | |
10194 | if (LFSR & 0x80) { | |
10195 | // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1 | |
10196 | LFSR = (LFSR << 1) ^ 0x71; | |
10197 | } else { | |
10198 | LFSR <<= 1; | |
10199 | } | |
10200 | } | |
10201 | ||
10202 | ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw); | |
10203 | } | |
10204 | }()); | |
10205 | ||
10206 | // Reusable objects for temporary values | |
10207 | var T = []; | |
10208 | (function () { | |
10209 | for (var i = 0; i < 25; i++) { | |
10210 | T[i] = X64Word.create(); | |
10211 | } | |
10212 | }()); | |
10213 | ||
10214 | /** | |
10215 | * SHA-3 hash algorithm. | |
10216 | */ | |
10217 | var SHA3 = C_algo.SHA3 = Hasher.extend({ | |
10218 | /** | |
10219 | * Configuration options. | |
10220 | * | |
10221 | * @property {number} outputLength | |
10222 | * The desired number of bits in the output hash. | |
10223 | * Only values permitted are: 224, 256, 384, 512. | |
10224 | * Default: 512 | |
10225 | */ | |
10226 | cfg: Hasher.cfg.extend({ | |
10227 | outputLength: 512 | |
10228 | }), | |
10229 | ||
10230 | _doReset: function () { | |
10231 | var state = this._state = [] | |
10232 | for (var i = 0; i < 25; i++) { | |
10233 | state[i] = new X64Word.init(); | |
10234 | } | |
10235 | ||
10236 | this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32; | |
10237 | }, | |
10238 | ||
10239 | _doProcessBlock: function (M, offset) { | |
10240 | // Shortcuts | |
10241 | var state = this._state; | |
10242 | var nBlockSizeLanes = this.blockSize / 2; | |
10243 | ||
10244 | // Absorb | |
10245 | for (var i = 0; i < nBlockSizeLanes; i++) { | |
10246 | // Shortcuts | |
10247 | var M2i = M[offset + 2 * i]; | |
10248 | var M2i1 = M[offset + 2 * i + 1]; | |
10249 | ||
10250 | // Swap endian | |
10251 | M2i = ( | |
10252 | (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) | | |
10253 | (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00) | |
10254 | ); | |
10255 | M2i1 = ( | |
10256 | (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) | | |
10257 | (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00) | |
10258 | ); | |
10259 | ||
10260 | // Absorb message into state | |
10261 | var lane = state[i]; | |
10262 | lane.high ^= M2i1; | |
10263 | lane.low ^= M2i; | |
10264 | } | |
10265 | ||
10266 | // Rounds | |
10267 | for (var round = 0; round < 24; round++) { | |
10268 | // Theta | |
10269 | for (var x = 0; x < 5; x++) { | |
10270 | // Mix column lanes | |
10271 | var tMsw = 0, tLsw = 0; | |
10272 | for (var y = 0; y < 5; y++) { | |
10273 | var lane = state[x + 5 * y]; | |
10274 | tMsw ^= lane.high; | |
10275 | tLsw ^= lane.low; | |
10276 | } | |
10277 | ||
10278 | // Temporary values | |
10279 | var Tx = T[x]; | |
10280 | Tx.high = tMsw; | |
10281 | Tx.low = tLsw; | |
10282 | } | |
10283 | for (var x = 0; x < 5; x++) { | |
10284 | // Shortcuts | |
10285 | var Tx4 = T[(x + 4) % 5]; | |
10286 | var Tx1 = T[(x + 1) % 5]; | |
10287 | var Tx1Msw = Tx1.high; | |
10288 | var Tx1Lsw = Tx1.low; | |
10289 | ||
10290 | // Mix surrounding columns | |
10291 | var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31)); | |
10292 | var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31)); | |
10293 | for (var y = 0; y < 5; y++) { | |
10294 | var lane = state[x + 5 * y]; | |
10295 | lane.high ^= tMsw; | |
10296 | lane.low ^= tLsw; | |
10297 | } | |
10298 | } | |
10299 | ||
10300 | // Rho Pi | |
10301 | for (var laneIndex = 1; laneIndex < 25; laneIndex++) { | |
10302 | // Shortcuts | |
10303 | var lane = state[laneIndex]; | |
10304 | var laneMsw = lane.high; | |
10305 | var laneLsw = lane.low; | |
10306 | var rhoOffset = RHO_OFFSETS[laneIndex]; | |
10307 | ||
10308 | // Rotate lanes | |
10309 | if (rhoOffset < 32) { | |
10310 | var tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset)); | |
10311 | var tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset)); | |
10312 | } else /* if (rhoOffset >= 32) */ { | |
10313 | var tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset)); | |
10314 | var tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset)); | |
10315 | } | |
10316 | ||
10317 | // Transpose lanes | |
10318 | var TPiLane = T[PI_INDEXES[laneIndex]]; | |
10319 | TPiLane.high = tMsw; | |
10320 | TPiLane.low = tLsw; | |
10321 | } | |
10322 | ||
10323 | // Rho pi at x = y = 0 | |
10324 | var T0 = T[0]; | |
10325 | var state0 = state[0]; | |
10326 | T0.high = state0.high; | |
10327 | T0.low = state0.low; | |
10328 | ||
10329 | // Chi | |
10330 | for (var x = 0; x < 5; x++) { | |
10331 | for (var y = 0; y < 5; y++) { | |
10332 | // Shortcuts | |
10333 | var laneIndex = x + 5 * y; | |
10334 | var lane = state[laneIndex]; | |
10335 | var TLane = T[laneIndex]; | |
10336 | var Tx1Lane = T[((x + 1) % 5) + 5 * y]; | |
10337 | var Tx2Lane = T[((x + 2) % 5) + 5 * y]; | |
10338 | ||
10339 | // Mix rows | |
10340 | lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high); | |
10341 | lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low); | |
10342 | } | |
10343 | } | |
10344 | ||
10345 | // Iota | |
10346 | var lane = state[0]; | |
10347 | var roundConstant = ROUND_CONSTANTS[round]; | |
10348 | lane.high ^= roundConstant.high; | |
10349 | lane.low ^= roundConstant.low;; | |
10350 | } | |
10351 | }, | |
10352 | ||
10353 | _doFinalize: function () { | |
10354 | // Shortcuts | |
10355 | var data = this._data; | |
10356 | var dataWords = data.words; | |
10357 | var nBitsTotal = this._nDataBytes * 8; | |
10358 | var nBitsLeft = data.sigBytes * 8; | |
10359 | var blockSizeBits = this.blockSize * 32; | |
10360 | ||
10361 | // Add padding | |
10362 | dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32); | |
10363 | dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80; | |
10364 | data.sigBytes = dataWords.length * 4; | |
10365 | ||
10366 | // Hash final blocks | |
10367 | this._process(); | |
10368 | ||
10369 | // Shortcuts | |
10370 | var state = this._state; | |
10371 | var outputLengthBytes = this.cfg.outputLength / 8; | |
10372 | var outputLengthLanes = outputLengthBytes / 8; | |
10373 | ||
10374 | // Squeeze | |
10375 | var hashWords = []; | |
10376 | for (var i = 0; i < outputLengthLanes; i++) { | |
10377 | // Shortcuts | |
10378 | var lane = state[i]; | |
10379 | var laneMsw = lane.high; | |
10380 | var laneLsw = lane.low; | |
10381 | ||
10382 | // Swap endian | |
10383 | laneMsw = ( | |
10384 | (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) | | |
10385 | (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00) | |
10386 | ); | |
10387 | laneLsw = ( | |
10388 | (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) | | |
10389 | (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00) | |
10390 | ); | |
10391 | ||
10392 | // Squeeze state to retrieve hash | |
10393 | hashWords.push(laneLsw); | |
10394 | hashWords.push(laneMsw); | |
10395 | } | |
10396 | ||
10397 | // Return final computed hash | |
10398 | return new WordArray.init(hashWords, outputLengthBytes); | |
10399 | }, | |
10400 | ||
10401 | clone: function () { | |
10402 | var clone = Hasher.clone.call(this); | |
10403 | ||
10404 | var state = clone._state = this._state.slice(0); | |
10405 | for (var i = 0; i < 25; i++) { | |
10406 | state[i] = state[i].clone(); | |
10407 | } | |
10408 | ||
10409 | return clone; | |
10410 | } | |
10411 | }); | |
10412 | ||
10413 | /** | |
10414 | * Shortcut function to the hasher's object interface. | |
10415 | * | |
10416 | * @param {WordArray|string} message The message to hash. | |
10417 | * | |
10418 | * @return {WordArray} The hash. | |
10419 | * | |
10420 | * @static | |
10421 | * | |
10422 | * @example | |
10423 | * | |
10424 | * var hash = CryptoJS.SHA3('message'); | |
10425 | * var hash = CryptoJS.SHA3(wordArray); | |
10426 | */ | |
10427 | C.SHA3 = Hasher._createHelper(SHA3); | |
10428 | ||
10429 | /** | |
10430 | * Shortcut function to the HMAC's object interface. | |
10431 | * | |
10432 | * @param {WordArray|string} message The message to hash. | |
10433 | * @param {WordArray|string} key The secret key. | |
10434 | * | |
10435 | * @return {WordArray} The HMAC. | |
10436 | * | |
10437 | * @static | |
10438 | * | |
10439 | * @example | |
10440 | * | |
10441 | * var hmac = CryptoJS.HmacSHA3(message, key); | |
10442 | */ | |
10443 | C.HmacSHA3 = Hasher._createHmacHelper(SHA3); | |
10444 | }(Math)); | |
10445 | ||
10446 | ||
10447 | return CryptoJS.SHA3; | |
10448 | ||
10449 | })); | |
10450 | },{"./core":31,"./x64-core":62}],59:[function(_dereq_,module,exports){ | |
10451 | ;(function (root, factory, undef) { | |
10452 | if (typeof exports === "object") { | |
10453 | // CommonJS | |
10454 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core"), _dereq_("./sha512")); | |
10455 | } | |
10456 | else if (typeof define === "function" && define.amd) { | |
10457 | // AMD | |
10458 | define(["./core", "./x64-core", "./sha512"], factory); | |
10459 | } | |
10460 | else { | |
10461 | // Global (browser) | |
10462 | factory(root.CryptoJS); | |
10463 | } | |
10464 | }(this, function (CryptoJS) { | |
10465 | ||
10466 | (function () { | |
10467 | // Shortcuts | |
10468 | var C = CryptoJS; | |
10469 | var C_x64 = C.x64; | |
10470 | var X64Word = C_x64.Word; | |
10471 | var X64WordArray = C_x64.WordArray; | |
10472 | var C_algo = C.algo; | |
10473 | var SHA512 = C_algo.SHA512; | |
10474 | ||
10475 | /** | |
10476 | * SHA-384 hash algorithm. | |
10477 | */ | |
10478 | var SHA384 = C_algo.SHA384 = SHA512.extend({ | |
10479 | _doReset: function () { | |
10480 | this._hash = new X64WordArray.init([ | |
10481 | new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), | |
10482 | new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), | |
10483 | new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), | |
10484 | new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4) | |
10485 | ]); | |
10486 | }, | |
10487 | ||
10488 | _doFinalize: function () { | |
10489 | var hash = SHA512._doFinalize.call(this); | |
10490 | ||
10491 | hash.sigBytes -= 16; | |
10492 | ||
10493 | return hash; | |
10494 | } | |
10495 | }); | |
10496 | ||
10497 | /** | |
10498 | * Shortcut function to the hasher's object interface. | |
10499 | * | |
10500 | * @param {WordArray|string} message The message to hash. | |
10501 | * | |
10502 | * @return {WordArray} The hash. | |
10503 | * | |
10504 | * @static | |
10505 | * | |
10506 | * @example | |
10507 | * | |
10508 | * var hash = CryptoJS.SHA384('message'); | |
10509 | * var hash = CryptoJS.SHA384(wordArray); | |
10510 | */ | |
10511 | C.SHA384 = SHA512._createHelper(SHA384); | |
10512 | ||
10513 | /** | |
10514 | * Shortcut function to the HMAC's object interface. | |
10515 | * | |
10516 | * @param {WordArray|string} message The message to hash. | |
10517 | * @param {WordArray|string} key The secret key. | |
10518 | * | |
10519 | * @return {WordArray} The HMAC. | |
10520 | * | |
10521 | * @static | |
10522 | * | |
10523 | * @example | |
10524 | * | |
10525 | * var hmac = CryptoJS.HmacSHA384(message, key); | |
10526 | */ | |
10527 | C.HmacSHA384 = SHA512._createHmacHelper(SHA384); | |
10528 | }()); | |
10529 | ||
10530 | ||
10531 | return CryptoJS.SHA384; | |
10532 | ||
10533 | })); | |
10534 | },{"./core":31,"./sha512":60,"./x64-core":62}],60:[function(_dereq_,module,exports){ | |
10535 | ;(function (root, factory, undef) { | |
10536 | if (typeof exports === "object") { | |
10537 | // CommonJS | |
10538 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core")); | |
10539 | } | |
10540 | else if (typeof define === "function" && define.amd) { | |
10541 | // AMD | |
10542 | define(["./core", "./x64-core"], factory); | |
10543 | } | |
10544 | else { | |
10545 | // Global (browser) | |
10546 | factory(root.CryptoJS); | |
10547 | } | |
10548 | }(this, function (CryptoJS) { | |
10549 | ||
10550 | (function () { | |
10551 | // Shortcuts | |
10552 | var C = CryptoJS; | |
10553 | var C_lib = C.lib; | |
10554 | var Hasher = C_lib.Hasher; | |
10555 | var C_x64 = C.x64; | |
10556 | var X64Word = C_x64.Word; | |
10557 | var X64WordArray = C_x64.WordArray; | |
10558 | var C_algo = C.algo; | |
10559 | ||
10560 | function X64Word_create() { | |
10561 | return X64Word.create.apply(X64Word, arguments); | |
10562 | } | |
10563 | ||
10564 | // Constants | |
10565 | var K = [ | |
10566 | X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd), | |
10567 | X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc), | |
10568 | X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019), | |
10569 | X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118), | |
10570 | X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe), | |
10571 | X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2), | |
10572 | X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1), | |
10573 | X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694), | |
10574 | X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3), | |
10575 | X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65), | |
10576 | X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483), | |
10577 | X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5), | |
10578 | X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210), | |
10579 | X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4), | |
10580 | X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725), | |
10581 | X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70), | |
10582 | X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926), | |
10583 | X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df), | |
10584 | X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8), | |
10585 | X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b), | |
10586 | X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001), | |
10587 | X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30), | |
10588 | X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910), | |
10589 | X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8), | |
10590 | X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53), | |
10591 | X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8), | |
10592 | X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb), | |
10593 | X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3), | |
10594 | X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60), | |
10595 | X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec), | |
10596 | X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9), | |
10597 | X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b), | |
10598 | X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207), | |
10599 | X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178), | |
10600 | X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6), | |
10601 | X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b), | |
10602 | X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493), | |
10603 | X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c), | |
10604 | X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a), | |
10605 | X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817) | |
10606 | ]; | |
10607 | ||
10608 | // Reusable objects | |
10609 | var W = []; | |
10610 | (function () { | |
10611 | for (var i = 0; i < 80; i++) { | |
10612 | W[i] = X64Word_create(); | |
10613 | } | |
10614 | }()); | |
10615 | ||
10616 | /** | |
10617 | * SHA-512 hash algorithm. | |
10618 | */ | |
10619 | var SHA512 = C_algo.SHA512 = Hasher.extend({ | |
10620 | _doReset: function () { | |
10621 | this._hash = new X64WordArray.init([ | |
10622 | new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b), | |
10623 | new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1), | |
10624 | new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f), | |
10625 | new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179) | |
10626 | ]); | |
10627 | }, | |
10628 | ||
10629 | _doProcessBlock: function (M, offset) { | |
10630 | // Shortcuts | |
10631 | var H = this._hash.words; | |
10632 | ||
10633 | var H0 = H[0]; | |
10634 | var H1 = H[1]; | |
10635 | var H2 = H[2]; | |
10636 | var H3 = H[3]; | |
10637 | var H4 = H[4]; | |
10638 | var H5 = H[5]; | |
10639 | var H6 = H[6]; | |
10640 | var H7 = H[7]; | |
10641 | ||
10642 | var H0h = H0.high; | |
10643 | var H0l = H0.low; | |
10644 | var H1h = H1.high; | |
10645 | var H1l = H1.low; | |
10646 | var H2h = H2.high; | |
10647 | var H2l = H2.low; | |
10648 | var H3h = H3.high; | |
10649 | var H3l = H3.low; | |
10650 | var H4h = H4.high; | |
10651 | var H4l = H4.low; | |
10652 | var H5h = H5.high; | |
10653 | var H5l = H5.low; | |
10654 | var H6h = H6.high; | |
10655 | var H6l = H6.low; | |
10656 | var H7h = H7.high; | |
10657 | var H7l = H7.low; | |
10658 | ||
10659 | // Working variables | |
10660 | var ah = H0h; | |
10661 | var al = H0l; | |
10662 | var bh = H1h; | |
10663 | var bl = H1l; | |
10664 | var ch = H2h; | |
10665 | var cl = H2l; | |
10666 | var dh = H3h; | |
10667 | var dl = H3l; | |
10668 | var eh = H4h; | |
10669 | var el = H4l; | |
10670 | var fh = H5h; | |
10671 | var fl = H5l; | |
10672 | var gh = H6h; | |
10673 | var gl = H6l; | |
10674 | var hh = H7h; | |
10675 | var hl = H7l; | |
10676 | ||
10677 | // Rounds | |
10678 | for (var i = 0; i < 80; i++) { | |
10679 | // Shortcut | |
10680 | var Wi = W[i]; | |
10681 | ||
10682 | // Extend message | |
10683 | if (i < 16) { | |
10684 | var Wih = Wi.high = M[offset + i * 2] | 0; | |
10685 | var Wil = Wi.low = M[offset + i * 2 + 1] | 0; | |
10686 | } else { | |
10687 | // Gamma0 | |
10688 | var gamma0x = W[i - 15]; | |
10689 | var gamma0xh = gamma0x.high; | |
10690 | var gamma0xl = gamma0x.low; | |
10691 | var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7); | |
10692 | var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25)); | |
10693 | ||
10694 | // Gamma1 | |
10695 | var gamma1x = W[i - 2]; | |
10696 | var gamma1xh = gamma1x.high; | |
10697 | var gamma1xl = gamma1x.low; | |
10698 | var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6); | |
10699 | var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26)); | |
10700 | ||
10701 | // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] | |
10702 | var Wi7 = W[i - 7]; | |
10703 | var Wi7h = Wi7.high; | |
10704 | var Wi7l = Wi7.low; | |
10705 | ||
10706 | var Wi16 = W[i - 16]; | |
10707 | var Wi16h = Wi16.high; | |
10708 | var Wi16l = Wi16.low; | |
10709 | ||
10710 | var Wil = gamma0l + Wi7l; | |
10711 | var Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0); | |
10712 | var Wil = Wil + gamma1l; | |
10713 | var Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0); | |
10714 | var Wil = Wil + Wi16l; | |
10715 | var Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0); | |
10716 | ||
10717 | Wi.high = Wih; | |
10718 | Wi.low = Wil; | |
10719 | } | |
10720 | ||
10721 | var chh = (eh & fh) ^ (~eh & gh); | |
10722 | var chl = (el & fl) ^ (~el & gl); | |
10723 | var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch); | |
10724 | var majl = (al & bl) ^ (al & cl) ^ (bl & cl); | |
10725 | ||
10726 | var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7)); | |
10727 | var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7)); | |
10728 | var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9)); | |
10729 | var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9)); | |
10730 | ||
10731 | // t1 = h + sigma1 + ch + K[i] + W[i] | |
10732 | var Ki = K[i]; | |
10733 | var Kih = Ki.high; | |
10734 | var Kil = Ki.low; | |
10735 | ||
10736 | var t1l = hl + sigma1l; | |
10737 | var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0); | |
10738 | var t1l = t1l + chl; | |
10739 | var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0); | |
10740 | var t1l = t1l + Kil; | |
10741 | var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0); | |
10742 | var t1l = t1l + Wil; | |
10743 | var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0); | |
10744 | ||
10745 | // t2 = sigma0 + maj | |
10746 | var t2l = sigma0l + majl; | |
10747 | var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0); | |
10748 | ||
10749 | // Update working variables | |
10750 | hh = gh; | |
10751 | hl = gl; | |
10752 | gh = fh; | |
10753 | gl = fl; | |
10754 | fh = eh; | |
10755 | fl = el; | |
10756 | el = (dl + t1l) | 0; | |
10757 | eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0; | |
10758 | dh = ch; | |
10759 | dl = cl; | |
10760 | ch = bh; | |
10761 | cl = bl; | |
10762 | bh = ah; | |
10763 | bl = al; | |
10764 | al = (t1l + t2l) | 0; | |
10765 | ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0; | |
10766 | } | |
10767 | ||
10768 | // Intermediate hash value | |
10769 | H0l = H0.low = (H0l + al); | |
10770 | H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0)); | |
10771 | H1l = H1.low = (H1l + bl); | |
10772 | H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0)); | |
10773 | H2l = H2.low = (H2l + cl); | |
10774 | H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0)); | |
10775 | H3l = H3.low = (H3l + dl); | |
10776 | H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0)); | |
10777 | H4l = H4.low = (H4l + el); | |
10778 | H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0)); | |
10779 | H5l = H5.low = (H5l + fl); | |
10780 | H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0)); | |
10781 | H6l = H6.low = (H6l + gl); | |
10782 | H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0)); | |
10783 | H7l = H7.low = (H7l + hl); | |
10784 | H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0)); | |
10785 | }, | |
10786 | ||
10787 | _doFinalize: function () { | |
10788 | // Shortcuts | |
10789 | var data = this._data; | |
10790 | var dataWords = data.words; | |
10791 | ||
10792 | var nBitsTotal = this._nDataBytes * 8; | |
10793 | var nBitsLeft = data.sigBytes * 8; | |
10794 | ||
10795 | // Add padding | |
10796 | dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); | |
10797 | dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000); | |
10798 | dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal; | |
10799 | data.sigBytes = dataWords.length * 4; | |
10800 | ||
10801 | // Hash final blocks | |
10802 | this._process(); | |
10803 | ||
10804 | // Convert hash to 32-bit word array before returning | |
10805 | var hash = this._hash.toX32(); | |
10806 | ||
10807 | // Return final computed hash | |
10808 | return hash; | |
10809 | }, | |
10810 | ||
10811 | clone: function () { | |
10812 | var clone = Hasher.clone.call(this); | |
10813 | clone._hash = this._hash.clone(); | |
10814 | ||
10815 | return clone; | |
10816 | }, | |
10817 | ||
10818 | blockSize: 1024/32 | |
10819 | }); | |
10820 | ||
10821 | /** | |
10822 | * Shortcut function to the hasher's object interface. | |
10823 | * | |
10824 | * @param {WordArray|string} message The message to hash. | |
10825 | * | |
10826 | * @return {WordArray} The hash. | |
10827 | * | |
10828 | * @static | |
10829 | * | |
10830 | * @example | |
10831 | * | |
10832 | * var hash = CryptoJS.SHA512('message'); | |
10833 | * var hash = CryptoJS.SHA512(wordArray); | |
10834 | */ | |
10835 | C.SHA512 = Hasher._createHelper(SHA512); | |
10836 | ||
10837 | /** | |
10838 | * Shortcut function to the HMAC's object interface. | |
10839 | * | |
10840 | * @param {WordArray|string} message The message to hash. | |
10841 | * @param {WordArray|string} key The secret key. | |
10842 | * | |
10843 | * @return {WordArray} The HMAC. | |
10844 | * | |
10845 | * @static | |
10846 | * | |
10847 | * @example | |
10848 | * | |
10849 | * var hmac = CryptoJS.HmacSHA512(message, key); | |
10850 | */ | |
10851 | C.HmacSHA512 = Hasher._createHmacHelper(SHA512); | |
10852 | }()); | |
10853 | ||
10854 | ||
10855 | return CryptoJS.SHA512; | |
10856 | ||
10857 | })); | |
10858 | },{"./core":31,"./x64-core":62}],61:[function(_dereq_,module,exports){ | |
10859 | ;(function (root, factory, undef) { | |
10860 | if (typeof exports === "object") { | |
10861 | // CommonJS | |
10862 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); | |
10863 | } | |
10864 | else if (typeof define === "function" && define.amd) { | |
10865 | // AMD | |
10866 | define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); | |
10867 | } | |
10868 | else { | |
10869 | // Global (browser) | |
10870 | factory(root.CryptoJS); | |
10871 | } | |
10872 | }(this, function (CryptoJS) { | |
10873 | ||
10874 | (function () { | |
10875 | // Shortcuts | |
10876 | var C = CryptoJS; | |
10877 | var C_lib = C.lib; | |
10878 | var WordArray = C_lib.WordArray; | |
10879 | var BlockCipher = C_lib.BlockCipher; | |
10880 | var C_algo = C.algo; | |
10881 | ||
10882 | // Permuted Choice 1 constants | |
10883 | var PC1 = [ | |
10884 | 57, 49, 41, 33, 25, 17, 9, 1, | |
10885 | 58, 50, 42, 34, 26, 18, 10, 2, | |
10886 | 59, 51, 43, 35, 27, 19, 11, 3, | |
10887 | 60, 52, 44, 36, 63, 55, 47, 39, | |
10888 | 31, 23, 15, 7, 62, 54, 46, 38, | |
10889 | 30, 22, 14, 6, 61, 53, 45, 37, | |
10890 | 29, 21, 13, 5, 28, 20, 12, 4 | |
10891 | ]; | |
10892 | ||
10893 | // Permuted Choice 2 constants | |
10894 | var PC2 = [ | |
10895 | 14, 17, 11, 24, 1, 5, | |
10896 | 3, 28, 15, 6, 21, 10, | |
10897 | 23, 19, 12, 4, 26, 8, | |
10898 | 16, 7, 27, 20, 13, 2, | |
10899 | 41, 52, 31, 37, 47, 55, | |
10900 | 30, 40, 51, 45, 33, 48, | |
10901 | 44, 49, 39, 56, 34, 53, | |
10902 | 46, 42, 50, 36, 29, 32 | |
10903 | ]; | |
10904 | ||
10905 | // Cumulative bit shift constants | |
10906 | var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28]; | |
10907 | ||
10908 | // SBOXes and round permutation constants | |
10909 | var SBOX_P = [ | |
10910 | { | |
10911 | 0x0: 0x808200, | |
10912 | 0x10000000: 0x8000, | |
10913 | 0x20000000: 0x808002, | |
10914 | 0x30000000: 0x2, | |
10915 | 0x40000000: 0x200, | |
10916 | 0x50000000: 0x808202, | |
10917 | 0x60000000: 0x800202, | |
10918 | 0x70000000: 0x800000, | |
10919 | 0x80000000: 0x202, | |
10920 | 0x90000000: 0x800200, | |
10921 | 0xa0000000: 0x8200, | |
10922 | 0xb0000000: 0x808000, | |
10923 | 0xc0000000: 0x8002, | |
10924 | 0xd0000000: 0x800002, | |
10925 | 0xe0000000: 0x0, | |
10926 | 0xf0000000: 0x8202, | |
10927 | 0x8000000: 0x0, | |
10928 | 0x18000000: 0x808202, | |
10929 | 0x28000000: 0x8202, | |
10930 | 0x38000000: 0x8000, | |
10931 | 0x48000000: 0x808200, | |
10932 | 0x58000000: 0x200, | |
10933 | 0x68000000: 0x808002, | |
10934 | 0x78000000: 0x2, | |
10935 | 0x88000000: 0x800200, | |
10936 | 0x98000000: 0x8200, | |
10937 | 0xa8000000: 0x808000, | |
10938 | 0xb8000000: 0x800202, | |
10939 | 0xc8000000: 0x800002, | |
10940 | 0xd8000000: 0x8002, | |
10941 | 0xe8000000: 0x202, | |
10942 | 0xf8000000: 0x800000, | |
10943 | 0x1: 0x8000, | |
10944 | 0x10000001: 0x2, | |
10945 | 0x20000001: 0x808200, | |
10946 | 0x30000001: 0x800000, | |
10947 | 0x40000001: 0x808002, | |
10948 | 0x50000001: 0x8200, | |
10949 | 0x60000001: 0x200, | |
10950 | 0x70000001: 0x800202, | |
10951 | 0x80000001: 0x808202, | |
10952 | 0x90000001: 0x808000, | |
10953 | 0xa0000001: 0x800002, | |
10954 | 0xb0000001: 0x8202, | |
10955 | 0xc0000001: 0x202, | |
10956 | 0xd0000001: 0x800200, | |
10957 | 0xe0000001: 0x8002, | |
10958 | 0xf0000001: 0x0, | |
10959 | 0x8000001: 0x808202, | |
10960 | 0x18000001: 0x808000, | |
10961 | 0x28000001: 0x800000, | |
10962 | 0x38000001: 0x200, | |
10963 | 0x48000001: 0x8000, | |
10964 | 0x58000001: 0x800002, | |
10965 | 0x68000001: 0x2, | |
10966 | 0x78000001: 0x8202, | |
10967 | 0x88000001: 0x8002, | |
10968 | 0x98000001: 0x800202, | |
10969 | 0xa8000001: 0x202, | |
10970 | 0xb8000001: 0x808200, | |
10971 | 0xc8000001: 0x800200, | |
10972 | 0xd8000001: 0x0, | |
10973 | 0xe8000001: 0x8200, | |
10974 | 0xf8000001: 0x808002 | |
10975 | }, | |
10976 | { | |
10977 | 0x0: 0x40084010, | |
10978 | 0x1000000: 0x4000, | |
10979 | 0x2000000: 0x80000, | |
10980 | 0x3000000: 0x40080010, | |
10981 | 0x4000000: 0x40000010, | |
10982 | 0x5000000: 0x40084000, | |
10983 | 0x6000000: 0x40004000, | |
10984 | 0x7000000: 0x10, | |
10985 | 0x8000000: 0x84000, | |
10986 | 0x9000000: 0x40004010, | |
10987 | 0xa000000: 0x40000000, | |
10988 | 0xb000000: 0x84010, | |
10989 | 0xc000000: 0x80010, | |
10990 | 0xd000000: 0x0, | |
10991 | 0xe000000: 0x4010, | |
10992 | 0xf000000: 0x40080000, | |
10993 | 0x800000: 0x40004000, | |
10994 | 0x1800000: 0x84010, | |
10995 | 0x2800000: 0x10, | |
10996 | 0x3800000: 0x40004010, | |
10997 | 0x4800000: 0x40084010, | |
10998 | 0x5800000: 0x40000000, | |
10999 | 0x6800000: 0x80000, | |
11000 | 0x7800000: 0x40080010, | |
11001 | 0x8800000: 0x80010, | |
11002 | 0x9800000: 0x0, | |
11003 | 0xa800000: 0x4000, | |
11004 | 0xb800000: 0x40080000, | |
11005 | 0xc800000: 0x40000010, | |
11006 | 0xd800000: 0x84000, | |
11007 | 0xe800000: 0x40084000, | |
11008 | 0xf800000: 0x4010, | |
11009 | 0x10000000: 0x0, | |
11010 | 0x11000000: 0x40080010, | |
11011 | 0x12000000: 0x40004010, | |
11012 | 0x13000000: 0x40084000, | |
11013 | 0x14000000: 0x40080000, | |
11014 | 0x15000000: 0x10, | |
11015 | 0x16000000: 0x84010, | |
11016 | 0x17000000: 0x4000, | |
11017 | 0x18000000: 0x4010, | |
11018 | 0x19000000: 0x80000, | |
11019 | 0x1a000000: 0x80010, | |
11020 | 0x1b000000: 0x40000010, | |
11021 | 0x1c000000: 0x84000, | |
11022 | 0x1d000000: 0x40004000, | |
11023 | 0x1e000000: 0x40000000, | |
11024 | 0x1f000000: 0x40084010, | |
11025 | 0x10800000: 0x84010, | |
11026 | 0x11800000: 0x80000, | |
11027 | 0x12800000: 0x40080000, | |
11028 | 0x13800000: 0x4000, | |
11029 | 0x14800000: 0x40004000, | |
11030 | 0x15800000: 0x40084010, | |
11031 | 0x16800000: 0x10, | |
11032 | 0x17800000: 0x40000000, | |
11033 | 0x18800000: 0x40084000, | |
11034 | 0x19800000: 0x40000010, | |
11035 | 0x1a800000: 0x40004010, | |
11036 | 0x1b800000: 0x80010, | |
11037 | 0x1c800000: 0x0, | |
11038 | 0x1d800000: 0x4010, | |
11039 | 0x1e800000: 0x40080010, | |
11040 | 0x1f800000: 0x84000 | |
11041 | }, | |
11042 | { | |
11043 | 0x0: 0x104, | |
11044 | 0x100000: 0x0, | |
11045 | 0x200000: 0x4000100, | |
11046 | 0x300000: 0x10104, | |
11047 | 0x400000: 0x10004, | |
11048 | 0x500000: 0x4000004, | |
11049 | 0x600000: 0x4010104, | |
11050 | 0x700000: 0x4010000, | |
11051 | 0x800000: 0x4000000, | |
11052 | 0x900000: 0x4010100, | |
11053 | 0xa00000: 0x10100, | |
11054 | 0xb00000: 0x4010004, | |
11055 | 0xc00000: 0x4000104, | |
11056 | 0xd00000: 0x10000, | |
11057 | 0xe00000: 0x4, | |
11058 | 0xf00000: 0x100, | |
11059 | 0x80000: 0x4010100, | |
11060 | 0x180000: 0x4010004, | |
11061 | 0x280000: 0x0, | |
11062 | 0x380000: 0x4000100, | |
11063 | 0x480000: 0x4000004, | |
11064 | 0x580000: 0x10000, | |
11065 | 0x680000: 0x10004, | |
11066 | 0x780000: 0x104, | |
11067 | 0x880000: 0x4, | |
11068 | 0x980000: 0x100, | |
11069 | 0xa80000: 0x4010000, | |
11070 | 0xb80000: 0x10104, | |
11071 | 0xc80000: 0x10100, | |
11072 | 0xd80000: 0x4000104, | |
11073 | 0xe80000: 0x4010104, | |
11074 | 0xf80000: 0x4000000, | |
11075 | 0x1000000: 0x4010100, | |
11076 | 0x1100000: 0x10004, | |
11077 | 0x1200000: 0x10000, | |
11078 | 0x1300000: 0x4000100, | |
11079 | 0x1400000: 0x100, | |
11080 | 0x1500000: 0x4010104, | |
11081 | 0x1600000: 0x4000004, | |
11082 | 0x1700000: 0x0, | |
11083 | 0x1800000: 0x4000104, | |
11084 | 0x1900000: 0x4000000, | |
11085 | 0x1a00000: 0x4, | |
11086 | 0x1b00000: 0x10100, | |
11087 | 0x1c00000: 0x4010000, | |
11088 | 0x1d00000: 0x104, | |
11089 | 0x1e00000: 0x10104, | |
11090 | 0x1f00000: 0x4010004, | |
11091 | 0x1080000: 0x4000000, | |
11092 | 0x1180000: 0x104, | |
11093 | 0x1280000: 0x4010100, | |
11094 | 0x1380000: 0x0, | |
11095 | 0x1480000: 0x10004, | |
11096 | 0x1580000: 0x4000100, | |
11097 | 0x1680000: 0x100, | |
11098 | 0x1780000: 0x4010004, | |
11099 | 0x1880000: 0x10000, | |
11100 | 0x1980000: 0x4010104, | |
11101 | 0x1a80000: 0x10104, | |
11102 | 0x1b80000: 0x4000004, | |
11103 | 0x1c80000: 0x4000104, | |
11104 | 0x1d80000: 0x4010000, | |
11105 | 0x1e80000: 0x4, | |
11106 | 0x1f80000: 0x10100 | |
11107 | }, | |
11108 | { | |
11109 | 0x0: 0x80401000, | |
11110 | 0x10000: 0x80001040, | |
11111 | 0x20000: 0x401040, | |
11112 | 0x30000: 0x80400000, | |
11113 | 0x40000: 0x0, | |
11114 | 0x50000: 0x401000, | |
11115 | 0x60000: 0x80000040, | |
11116 | 0x70000: 0x400040, | |
11117 | 0x80000: 0x80000000, | |
11118 | 0x90000: 0x400000, | |
11119 | 0xa0000: 0x40, | |
11120 | 0xb0000: 0x80001000, | |
11121 | 0xc0000: 0x80400040, | |
11122 | 0xd0000: 0x1040, | |
11123 | 0xe0000: 0x1000, | |
11124 | 0xf0000: 0x80401040, | |
11125 | 0x8000: 0x80001040, | |
11126 | 0x18000: 0x40, | |
11127 | 0x28000: 0x80400040, | |
11128 | 0x38000: 0x80001000, | |
11129 | 0x48000: 0x401000, | |
11130 | 0x58000: 0x80401040, | |
11131 | 0x68000: 0x0, | |
11132 | 0x78000: 0x80400000, | |
11133 | 0x88000: 0x1000, | |
11134 | 0x98000: 0x80401000, | |
11135 | 0xa8000: 0x400000, | |
11136 | 0xb8000: 0x1040, | |
11137 | 0xc8000: 0x80000000, | |
11138 | 0xd8000: 0x400040, | |
11139 | 0xe8000: 0x401040, | |
11140 | 0xf8000: 0x80000040, | |
11141 | 0x100000: 0x400040, | |
11142 | 0x110000: 0x401000, | |
11143 | 0x120000: 0x80000040, | |
11144 | 0x130000: 0x0, | |
11145 | 0x140000: 0x1040, | |
11146 | 0x150000: 0x80400040, | |
11147 | 0x160000: 0x80401000, | |
11148 | 0x170000: 0x80001040, | |
11149 | 0x180000: 0x80401040, | |
11150 | 0x190000: 0x80000000, | |
11151 | 0x1a0000: 0x80400000, | |
11152 | 0x1b0000: 0x401040, | |
11153 | 0x1c0000: 0x80001000, | |
11154 | 0x1d0000: 0x400000, | |
11155 | 0x1e0000: 0x40, | |
11156 | 0x1f0000: 0x1000, | |
11157 | 0x108000: 0x80400000, | |
11158 | 0x118000: 0x80401040, | |
11159 | 0x128000: 0x0, | |
11160 | 0x138000: 0x401000, | |
11161 | 0x148000: 0x400040, | |
11162 | 0x158000: 0x80000000, | |
11163 | 0x168000: 0x80001040, | |
11164 | 0x178000: 0x40, | |
11165 | 0x188000: 0x80000040, | |
11166 | 0x198000: 0x1000, | |
11167 | 0x1a8000: 0x80001000, | |
11168 | 0x1b8000: 0x80400040, | |
11169 | 0x1c8000: 0x1040, | |
11170 | 0x1d8000: 0x80401000, | |
11171 | 0x1e8000: 0x400000, | |
11172 | 0x1f8000: 0x401040 | |
11173 | }, | |
11174 | { | |
11175 | 0x0: 0x80, | |
11176 | 0x1000: 0x1040000, | |
11177 | 0x2000: 0x40000, | |
11178 | 0x3000: 0x20000000, | |
11179 | 0x4000: 0x20040080, | |
11180 | 0x5000: 0x1000080, | |
11181 | 0x6000: 0x21000080, | |
11182 | 0x7000: 0x40080, | |
11183 | 0x8000: 0x1000000, | |
11184 | 0x9000: 0x20040000, | |
11185 | 0xa000: 0x20000080, | |
11186 | 0xb000: 0x21040080, | |
11187 | 0xc000: 0x21040000, | |
11188 | 0xd000: 0x0, | |
11189 | 0xe000: 0x1040080, | |
11190 | 0xf000: 0x21000000, | |
11191 | 0x800: 0x1040080, | |
11192 | 0x1800: 0x21000080, | |
11193 | 0x2800: 0x80, | |
11194 | 0x3800: 0x1040000, | |
11195 | 0x4800: 0x40000, | |
11196 | 0x5800: 0x20040080, | |
11197 | 0x6800: 0x21040000, | |
11198 | 0x7800: 0x20000000, | |
11199 | 0x8800: 0x20040000, | |
11200 | 0x9800: 0x0, | |
11201 | 0xa800: 0x21040080, | |
11202 | 0xb800: 0x1000080, | |
11203 | 0xc800: 0x20000080, | |
11204 | 0xd800: 0x21000000, | |
11205 | 0xe800: 0x1000000, | |
11206 | 0xf800: 0x40080, | |
11207 | 0x10000: 0x40000, | |
11208 | 0x11000: 0x80, | |
11209 | 0x12000: 0x20000000, | |
11210 | 0x13000: 0x21000080, | |
11211 | 0x14000: 0x1000080, | |
11212 | 0x15000: 0x21040000, | |
11213 | 0x16000: 0x20040080, | |
11214 | 0x17000: 0x1000000, | |
11215 | 0x18000: 0x21040080, | |
11216 | 0x19000: 0x21000000, | |
11217 | 0x1a000: 0x1040000, | |
11218 | 0x1b000: 0x20040000, | |
11219 | 0x1c000: 0x40080, | |
11220 | 0x1d000: 0x20000080, | |
11221 | 0x1e000: 0x0, | |
11222 | 0x1f000: 0x1040080, | |
11223 | 0x10800: 0x21000080, | |
11224 | 0x11800: 0x1000000, | |
11225 | 0x12800: 0x1040000, | |
11226 | 0x13800: 0x20040080, | |
11227 | 0x14800: 0x20000000, | |
11228 | 0x15800: 0x1040080, | |
11229 | 0x16800: 0x80, | |
11230 | 0x17800: 0x21040000, | |
11231 | 0x18800: 0x40080, | |
11232 | 0x19800: 0x21040080, | |
11233 | 0x1a800: 0x0, | |
11234 | 0x1b800: 0x21000000, | |
11235 | 0x1c800: 0x1000080, | |
11236 | 0x1d800: 0x40000, | |
11237 | 0x1e800: 0x20040000, | |
11238 | 0x1f800: 0x20000080 | |
11239 | }, | |
11240 | { | |
11241 | 0x0: 0x10000008, | |
11242 | 0x100: 0x2000, | |
11243 | 0x200: 0x10200000, | |
11244 | 0x300: 0x10202008, | |
11245 | 0x400: 0x10002000, | |
11246 | 0x500: 0x200000, | |
11247 | 0x600: 0x200008, | |
11248 | 0x700: 0x10000000, | |
11249 | 0x800: 0x0, | |
11250 | 0x900: 0x10002008, | |
11251 | 0xa00: 0x202000, | |
11252 | 0xb00: 0x8, | |
11253 | 0xc00: 0x10200008, | |
11254 | 0xd00: 0x202008, | |
11255 | 0xe00: 0x2008, | |
11256 | 0xf00: 0x10202000, | |
11257 | 0x80: 0x10200000, | |
11258 | 0x180: 0x10202008, | |
11259 | 0x280: 0x8, | |
11260 | 0x380: 0x200000, | |
11261 | 0x480: 0x202008, | |
11262 | 0x580: 0x10000008, | |
11263 | 0x680: 0x10002000, | |
11264 | 0x780: 0x2008, | |
11265 | 0x880: 0x200008, | |
11266 | 0x980: 0x2000, | |
11267 | 0xa80: 0x10002008, | |
11268 | 0xb80: 0x10200008, | |
11269 | 0xc80: 0x0, | |
11270 | 0xd80: 0x10202000, | |
11271 | 0xe80: 0x202000, | |
11272 | 0xf80: 0x10000000, | |
11273 | 0x1000: 0x10002000, | |
11274 | 0x1100: 0x10200008, | |
11275 | 0x1200: 0x10202008, | |
11276 | 0x1300: 0x2008, | |
11277 | 0x1400: 0x200000, | |
11278 | 0x1500: 0x10000000, | |
11279 | 0x1600: 0x10000008, | |
11280 | 0x1700: 0x202000, | |
11281 | 0x1800: 0x202008, | |
11282 | 0x1900: 0x0, | |
11283 | 0x1a00: 0x8, | |
11284 | 0x1b00: 0x10200000, | |
11285 | 0x1c00: 0x2000, | |
11286 | 0x1d00: 0x10002008, | |
11287 | 0x1e00: 0x10202000, | |
11288 | 0x1f00: 0x200008, | |
11289 | 0x1080: 0x8, | |
11290 | 0x1180: 0x202000, | |
11291 | 0x1280: 0x200000, | |
11292 | 0x1380: 0x10000008, | |
11293 | 0x1480: 0x10002000, | |
11294 | 0x1580: 0x2008, | |
11295 | 0x1680: 0x10202008, | |
11296 | 0x1780: 0x10200000, | |
11297 | 0x1880: 0x10202000, | |
11298 | 0x1980: 0x10200008, | |
11299 | 0x1a80: 0x2000, | |
11300 | 0x1b80: 0x202008, | |
11301 | 0x1c80: 0x200008, | |
11302 | 0x1d80: 0x0, | |
11303 | 0x1e80: 0x10000000, | |
11304 | 0x1f80: 0x10002008 | |
11305 | }, | |
11306 | { | |
11307 | 0x0: 0x100000, | |
11308 | 0x10: 0x2000401, | |
11309 | 0x20: 0x400, | |
11310 | 0x30: 0x100401, | |
11311 | 0x40: 0x2100401, | |
11312 | 0x50: 0x0, | |
11313 | 0x60: 0x1, | |
11314 | 0x70: 0x2100001, | |
11315 | 0x80: 0x2000400, | |
11316 | 0x90: 0x100001, | |
11317 | 0xa0: 0x2000001, | |
11318 | 0xb0: 0x2100400, | |
11319 | 0xc0: 0x2100000, | |
11320 | 0xd0: 0x401, | |
11321 | 0xe0: 0x100400, | |
11322 | 0xf0: 0x2000000, | |
11323 | 0x8: 0x2100001, | |
11324 | 0x18: 0x0, | |
11325 | 0x28: 0x2000401, | |
11326 | 0x38: 0x2100400, | |
11327 | 0x48: 0x100000, | |
11328 | 0x58: 0x2000001, | |
11329 | 0x68: 0x2000000, | |
11330 | 0x78: 0x401, | |
11331 | 0x88: 0x100401, | |
11332 | 0x98: 0x2000400, | |
11333 | 0xa8: 0x2100000, | |
11334 | 0xb8: 0x100001, | |
11335 | 0xc8: 0x400, | |
11336 | 0xd8: 0x2100401, | |
11337 | 0xe8: 0x1, | |
11338 | 0xf8: 0x100400, | |
11339 | 0x100: 0x2000000, | |
11340 | 0x110: 0x100000, | |
11341 | 0x120: 0x2000401, | |
11342 | 0x130: 0x2100001, | |
11343 | 0x140: 0x100001, | |
11344 | 0x150: 0x2000400, | |
11345 | 0x160: 0x2100400, | |
11346 | 0x170: 0x100401, | |
11347 | 0x180: 0x401, | |
11348 | 0x190: 0x2100401, | |
11349 | 0x1a0: 0x100400, | |
11350 | 0x1b0: 0x1, | |
11351 | 0x1c0: 0x0, | |
11352 | 0x1d0: 0x2100000, | |
11353 | 0x1e0: 0x2000001, | |
11354 | 0x1f0: 0x400, | |
11355 | 0x108: 0x100400, | |
11356 | 0x118: 0x2000401, | |
11357 | 0x128: 0x2100001, | |
11358 | 0x138: 0x1, | |
11359 | 0x148: 0x2000000, | |
11360 | 0x158: 0x100000, | |
11361 | 0x168: 0x401, | |
11362 | 0x178: 0x2100400, | |
11363 | 0x188: 0x2000001, | |
11364 | 0x198: 0x2100000, | |
11365 | 0x1a8: 0x0, | |
11366 | 0x1b8: 0x2100401, | |
11367 | 0x1c8: 0x100401, | |
11368 | 0x1d8: 0x400, | |
11369 | 0x1e8: 0x2000400, | |
11370 | 0x1f8: 0x100001 | |
11371 | }, | |
11372 | { | |
11373 | 0x0: 0x8000820, | |
11374 | 0x1: 0x20000, | |
11375 | 0x2: 0x8000000, | |
11376 | 0x3: 0x20, | |
11377 | 0x4: 0x20020, | |
11378 | 0x5: 0x8020820, | |
11379 | 0x6: 0x8020800, | |
11380 | 0x7: 0x800, | |
11381 | 0x8: 0x8020000, | |
11382 | 0x9: 0x8000800, | |
11383 | 0xa: 0x20800, | |
11384 | 0xb: 0x8020020, | |
11385 | 0xc: 0x820, | |
11386 | 0xd: 0x0, | |
11387 | 0xe: 0x8000020, | |
11388 | 0xf: 0x20820, | |
11389 | 0x80000000: 0x800, | |
11390 | 0x80000001: 0x8020820, | |
11391 | 0x80000002: 0x8000820, | |
11392 | 0x80000003: 0x8000000, | |
11393 | 0x80000004: 0x8020000, | |
11394 | 0x80000005: 0x20800, | |
11395 | 0x80000006: 0x20820, | |
11396 | 0x80000007: 0x20, | |
11397 | 0x80000008: 0x8000020, | |
11398 | 0x80000009: 0x820, | |
11399 | 0x8000000a: 0x20020, | |
11400 | 0x8000000b: 0x8020800, | |
11401 | 0x8000000c: 0x0, | |
11402 | 0x8000000d: 0x8020020, | |
11403 | 0x8000000e: 0x8000800, | |
11404 | 0x8000000f: 0x20000, | |
11405 | 0x10: 0x20820, | |
11406 | 0x11: 0x8020800, | |
11407 | 0x12: 0x20, | |
11408 | 0x13: 0x800, | |
11409 | 0x14: 0x8000800, | |
11410 | 0x15: 0x8000020, | |
11411 | 0x16: 0x8020020, | |
11412 | 0x17: 0x20000, | |
11413 | 0x18: 0x0, | |
11414 | 0x19: 0x20020, | |
11415 | 0x1a: 0x8020000, | |
11416 | 0x1b: 0x8000820, | |
11417 | 0x1c: 0x8020820, | |
11418 | 0x1d: 0x20800, | |
11419 | 0x1e: 0x820, | |
11420 | 0x1f: 0x8000000, | |
11421 | 0x80000010: 0x20000, | |
11422 | 0x80000011: 0x800, | |
11423 | 0x80000012: 0x8020020, | |
11424 | 0x80000013: 0x20820, | |
11425 | 0x80000014: 0x20, | |
11426 | 0x80000015: 0x8020000, | |
11427 | 0x80000016: 0x8000000, | |
11428 | 0x80000017: 0x8000820, | |
11429 | 0x80000018: 0x8020820, | |
11430 | 0x80000019: 0x8000020, | |
11431 | 0x8000001a: 0x8000800, | |
11432 | 0x8000001b: 0x0, | |
11433 | 0x8000001c: 0x20800, | |
11434 | 0x8000001d: 0x820, | |
11435 | 0x8000001e: 0x20020, | |
11436 | 0x8000001f: 0x8020800 | |
11437 | } | |
11438 | ]; | |
11439 | ||
11440 | // Masks that select the SBOX input | |
11441 | var SBOX_MASK = [ | |
11442 | 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000, | |
11443 | 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f | |
11444 | ]; | |
11445 | ||
11446 | /** | |
11447 | * DES block cipher algorithm. | |
11448 | */ | |
11449 | var DES = C_algo.DES = BlockCipher.extend({ | |
11450 | _doReset: function () { | |
11451 | // Shortcuts | |
11452 | var key = this._key; | |
11453 | var keyWords = key.words; | |
11454 | ||
11455 | // Select 56 bits according to PC1 | |
11456 | var keyBits = []; | |
11457 | for (var i = 0; i < 56; i++) { | |
11458 | var keyBitPos = PC1[i] - 1; | |
11459 | keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1; | |
11460 | } | |
11461 | ||
11462 | // Assemble 16 subkeys | |
11463 | var subKeys = this._subKeys = []; | |
11464 | for (var nSubKey = 0; nSubKey < 16; nSubKey++) { | |
11465 | // Create subkey | |
11466 | var subKey = subKeys[nSubKey] = []; | |
11467 | ||
11468 | // Shortcut | |
11469 | var bitShift = BIT_SHIFTS[nSubKey]; | |
11470 | ||
11471 | // Select 48 bits according to PC2 | |
11472 | for (var i = 0; i < 24; i++) { | |
11473 | // Select from the left 28 key bits | |
11474 | subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6); | |
11475 | ||
11476 | // Select from the right 28 key bits | |
11477 | subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6); | |
11478 | } | |
11479 | ||
11480 | // Since each subkey is applied to an expanded 32-bit input, | |
11481 | // the subkey can be broken into 8 values scaled to 32-bits, | |
11482 | // which allows the key to be used without expansion | |
11483 | subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31); | |
11484 | for (var i = 1; i < 7; i++) { | |
11485 | subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3); | |
11486 | } | |
11487 | subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27); | |
11488 | } | |
11489 | ||
11490 | // Compute inverse subkeys | |
11491 | var invSubKeys = this._invSubKeys = []; | |
11492 | for (var i = 0; i < 16; i++) { | |
11493 | invSubKeys[i] = subKeys[15 - i]; | |
11494 | } | |
11495 | }, | |
11496 | ||
11497 | encryptBlock: function (M, offset) { | |
11498 | this._doCryptBlock(M, offset, this._subKeys); | |
11499 | }, | |
11500 | ||
11501 | decryptBlock: function (M, offset) { | |
11502 | this._doCryptBlock(M, offset, this._invSubKeys); | |
11503 | }, | |
11504 | ||
11505 | _doCryptBlock: function (M, offset, subKeys) { | |
11506 | // Get input | |
11507 | this._lBlock = M[offset]; | |
11508 | this._rBlock = M[offset + 1]; | |
11509 | ||
11510 | // Initial permutation | |
11511 | exchangeLR.call(this, 4, 0x0f0f0f0f); | |
11512 | exchangeLR.call(this, 16, 0x0000ffff); | |
11513 | exchangeRL.call(this, 2, 0x33333333); | |
11514 | exchangeRL.call(this, 8, 0x00ff00ff); | |
11515 | exchangeLR.call(this, 1, 0x55555555); | |
11516 | ||
11517 | // Rounds | |
11518 | for (var round = 0; round < 16; round++) { | |
11519 | // Shortcuts | |
11520 | var subKey = subKeys[round]; | |
11521 | var lBlock = this._lBlock; | |
11522 | var rBlock = this._rBlock; | |
11523 | ||
11524 | // Feistel function | |
11525 | var f = 0; | |
11526 | for (var i = 0; i < 8; i++) { | |
11527 | f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0]; | |
11528 | } | |
11529 | this._lBlock = rBlock; | |
11530 | this._rBlock = lBlock ^ f; | |
11531 | } | |
11532 | ||
11533 | // Undo swap from last round | |
11534 | var t = this._lBlock; | |
11535 | this._lBlock = this._rBlock; | |
11536 | this._rBlock = t; | |
11537 | ||
11538 | // Final permutation | |
11539 | exchangeLR.call(this, 1, 0x55555555); | |
11540 | exchangeRL.call(this, 8, 0x00ff00ff); | |
11541 | exchangeRL.call(this, 2, 0x33333333); | |
11542 | exchangeLR.call(this, 16, 0x0000ffff); | |
11543 | exchangeLR.call(this, 4, 0x0f0f0f0f); | |
11544 | ||
11545 | // Set output | |
11546 | M[offset] = this._lBlock; | |
11547 | M[offset + 1] = this._rBlock; | |
11548 | }, | |
11549 | ||
11550 | keySize: 64/32, | |
11551 | ||
11552 | ivSize: 64/32, | |
11553 | ||
11554 | blockSize: 64/32 | |
11555 | }); | |
11556 | ||
11557 | // Swap bits across the left and right words | |
11558 | function exchangeLR(offset, mask) { | |
11559 | var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask; | |
11560 | this._rBlock ^= t; | |
11561 | this._lBlock ^= t << offset; | |
11562 | } | |
11563 | ||
11564 | function exchangeRL(offset, mask) { | |
11565 | var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask; | |
11566 | this._lBlock ^= t; | |
11567 | this._rBlock ^= t << offset; | |
11568 | } | |
11569 | ||
11570 | /** | |
11571 | * Shortcut functions to the cipher's object interface. | |
11572 | * | |
11573 | * @example | |
11574 | * | |
11575 | * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg); | |
11576 | * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg); | |
11577 | */ | |
11578 | C.DES = BlockCipher._createHelper(DES); | |
11579 | ||
11580 | /** | |
11581 | * Triple-DES block cipher algorithm. | |
11582 | */ | |
11583 | var TripleDES = C_algo.TripleDES = BlockCipher.extend({ | |
11584 | _doReset: function () { | |
11585 | // Shortcuts | |
11586 | var key = this._key; | |
11587 | var keyWords = key.words; | |
11588 | ||
11589 | // Create DES instances | |
11590 | this._des1 = DES.createEncryptor(WordArray.create(keyWords.slice(0, 2))); | |
11591 | this._des2 = DES.createEncryptor(WordArray.create(keyWords.slice(2, 4))); | |
11592 | this._des3 = DES.createEncryptor(WordArray.create(keyWords.slice(4, 6))); | |
11593 | }, | |
11594 | ||
11595 | encryptBlock: function (M, offset) { | |
11596 | this._des1.encryptBlock(M, offset); | |
11597 | this._des2.decryptBlock(M, offset); | |
11598 | this._des3.encryptBlock(M, offset); | |
11599 | }, | |
11600 | ||
11601 | decryptBlock: function (M, offset) { | |
11602 | this._des3.decryptBlock(M, offset); | |
11603 | this._des2.encryptBlock(M, offset); | |
11604 | this._des1.decryptBlock(M, offset); | |
11605 | }, | |
11606 | ||
11607 | keySize: 192/32, | |
11608 | ||
11609 | ivSize: 64/32, | |
11610 | ||
11611 | blockSize: 64/32 | |
11612 | }); | |
11613 | ||
11614 | /** | |
11615 | * Shortcut functions to the cipher's object interface. | |
11616 | * | |
11617 | * @example | |
11618 | * | |
11619 | * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg); | |
11620 | * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg); | |
11621 | */ | |
11622 | C.TripleDES = BlockCipher._createHelper(TripleDES); | |
11623 | }()); | |
11624 | ||
11625 | ||
11626 | return CryptoJS.TripleDES; | |
11627 | ||
11628 | })); | |
11629 | },{"./cipher-core":30,"./core":31,"./enc-base64":32,"./evpkdf":34,"./md5":39}],62:[function(_dereq_,module,exports){ | |
11630 | ;(function (root, factory) { | |
11631 | if (typeof exports === "object") { | |
11632 | // CommonJS | |
11633 | module.exports = exports = factory(_dereq_("./core")); | |
11634 | } | |
11635 | else if (typeof define === "function" && define.amd) { | |
11636 | // AMD | |
11637 | define(["./core"], factory); | |
11638 | } | |
11639 | else { | |
11640 | // Global (browser) | |
11641 | factory(root.CryptoJS); | |
11642 | } | |
11643 | }(this, function (CryptoJS) { | |
11644 | ||
11645 | (function (undefined) { | |
11646 | // Shortcuts | |
11647 | var C = CryptoJS; | |
11648 | var C_lib = C.lib; | |
11649 | var Base = C_lib.Base; | |
11650 | var X32WordArray = C_lib.WordArray; | |
11651 | ||
11652 | /** | |
11653 | * x64 namespace. | |
11654 | */ | |
11655 | var C_x64 = C.x64 = {}; | |
11656 | ||
11657 | /** | |
11658 | * A 64-bit word. | |
11659 | */ | |
11660 | var X64Word = C_x64.Word = Base.extend({ | |
11661 | /** | |
11662 | * Initializes a newly created 64-bit word. | |
11663 | * | |
11664 | * @param {number} high The high 32 bits. | |
11665 | * @param {number} low The low 32 bits. | |
11666 | * | |
11667 | * @example | |
11668 | * | |
11669 | * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607); | |
11670 | */ | |
11671 | init: function (high, low) { | |
11672 | this.high = high; | |
11673 | this.low = low; | |
11674 | } | |
11675 | ||
11676 | /** | |
11677 | * Bitwise NOTs this word. | |
11678 | * | |
11679 | * @return {X64Word} A new x64-Word object after negating. | |
11680 | * | |
11681 | * @example | |
11682 | * | |
11683 | * var negated = x64Word.not(); | |
11684 | */ | |
11685 | // not: function () { | |
11686 | // var high = ~this.high; | |
11687 | // var low = ~this.low; | |
11688 | ||
11689 | // return X64Word.create(high, low); | |
11690 | // }, | |
11691 | ||
11692 | /** | |
11693 | * Bitwise ANDs this word with the passed word. | |
11694 | * | |
11695 | * @param {X64Word} word The x64-Word to AND with this word. | |
11696 | * | |
11697 | * @return {X64Word} A new x64-Word object after ANDing. | |
11698 | * | |
11699 | * @example | |
11700 | * | |
11701 | * var anded = x64Word.and(anotherX64Word); | |
11702 | */ | |
11703 | // and: function (word) { | |
11704 | // var high = this.high & word.high; | |
11705 | // var low = this.low & word.low; | |
11706 | ||
11707 | // return X64Word.create(high, low); | |
11708 | // }, | |
11709 | ||
11710 | /** | |
11711 | * Bitwise ORs this word with the passed word. | |
11712 | * | |
11713 | * @param {X64Word} word The x64-Word to OR with this word. | |
11714 | * | |
11715 | * @return {X64Word} A new x64-Word object after ORing. | |
11716 | * | |
11717 | * @example | |
11718 | * | |
11719 | * var ored = x64Word.or(anotherX64Word); | |
11720 | */ | |
11721 | // or: function (word) { | |
11722 | // var high = this.high | word.high; | |
11723 | // var low = this.low | word.low; | |
11724 | ||
11725 | // return X64Word.create(high, low); | |
11726 | // }, | |
11727 | ||
11728 | /** | |
11729 | * Bitwise XORs this word with the passed word. | |
11730 | * | |
11731 | * @param {X64Word} word The x64-Word to XOR with this word. | |
11732 | * | |
11733 | * @return {X64Word} A new x64-Word object after XORing. | |
11734 | * | |
11735 | * @example | |
11736 | * | |
11737 | * var xored = x64Word.xor(anotherX64Word); | |
11738 | */ | |
11739 | // xor: function (word) { | |
11740 | // var high = this.high ^ word.high; | |
11741 | // var low = this.low ^ word.low; | |
11742 | ||
11743 | // return X64Word.create(high, low); | |
11744 | // }, | |
11745 | ||
11746 | /** | |
11747 | * Shifts this word n bits to the left. | |
11748 | * | |
11749 | * @param {number} n The number of bits to shift. | |
11750 | * | |
11751 | * @return {X64Word} A new x64-Word object after shifting. | |
11752 | * | |
11753 | * @example | |
11754 | * | |
11755 | * var shifted = x64Word.shiftL(25); | |
11756 | */ | |
11757 | // shiftL: function (n) { | |
11758 | // if (n < 32) { | |
11759 | // var high = (this.high << n) | (this.low >>> (32 - n)); | |
11760 | // var low = this.low << n; | |
11761 | // } else { | |
11762 | // var high = this.low << (n - 32); | |
11763 | // var low = 0; | |
11764 | // } | |
11765 | ||
11766 | // return X64Word.create(high, low); | |
11767 | // }, | |
11768 | ||
11769 | /** | |
11770 | * Shifts this word n bits to the right. | |
11771 | * | |
11772 | * @param {number} n The number of bits to shift. | |
11773 | * | |
11774 | * @return {X64Word} A new x64-Word object after shifting. | |
11775 | * | |
11776 | * @example | |
11777 | * | |
11778 | * var shifted = x64Word.shiftR(7); | |
11779 | */ | |
11780 | // shiftR: function (n) { | |
11781 | // if (n < 32) { | |
11782 | // var low = (this.low >>> n) | (this.high << (32 - n)); | |
11783 | // var high = this.high >>> n; | |
11784 | // } else { | |
11785 | // var low = this.high >>> (n - 32); | |
11786 | // var high = 0; | |
11787 | // } | |
11788 | ||
11789 | // return X64Word.create(high, low); | |
11790 | // }, | |
11791 | ||
11792 | /** | |
11793 | * Rotates this word n bits to the left. | |
11794 | * | |
11795 | * @param {number} n The number of bits to rotate. | |
11796 | * | |
11797 | * @return {X64Word} A new x64-Word object after rotating. | |
11798 | * | |
11799 | * @example | |
11800 | * | |
11801 | * var rotated = x64Word.rotL(25); | |
11802 | */ | |
11803 | // rotL: function (n) { | |
11804 | // return this.shiftL(n).or(this.shiftR(64 - n)); | |
11805 | // }, | |
11806 | ||
11807 | /** | |
11808 | * Rotates this word n bits to the right. | |
11809 | * | |
11810 | * @param {number} n The number of bits to rotate. | |
11811 | * | |
11812 | * @return {X64Word} A new x64-Word object after rotating. | |
11813 | * | |
11814 | * @example | |
11815 | * | |
11816 | * var rotated = x64Word.rotR(7); | |
11817 | */ | |
11818 | // rotR: function (n) { | |
11819 | // return this.shiftR(n).or(this.shiftL(64 - n)); | |
11820 | // }, | |
11821 | ||
11822 | /** | |
11823 | * Adds this word with the passed word. | |
11824 | * | |
11825 | * @param {X64Word} word The x64-Word to add with this word. | |
11826 | * | |
11827 | * @return {X64Word} A new x64-Word object after adding. | |
11828 | * | |
11829 | * @example | |
11830 | * | |
11831 | * var added = x64Word.add(anotherX64Word); | |
11832 | */ | |
11833 | // add: function (word) { | |
11834 | // var low = (this.low + word.low) | 0; | |
11835 | // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0; | |
11836 | // var high = (this.high + word.high + carry) | 0; | |
11837 | ||
11838 | // return X64Word.create(high, low); | |
11839 | // } | |
11840 | }); | |
11841 | ||
11842 | /** | |
11843 | * An array of 64-bit words. | |
11844 | * | |
11845 | * @property {Array} words The array of CryptoJS.x64.Word objects. | |
11846 | * @property {number} sigBytes The number of significant bytes in this word array. | |
11847 | */ | |
11848 | var X64WordArray = C_x64.WordArray = Base.extend({ | |
11849 | /** | |
11850 | * Initializes a newly created word array. | |
11851 | * | |
11852 | * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects. | |
11853 | * @param {number} sigBytes (Optional) The number of significant bytes in the words. | |
11854 | * | |
11855 | * @example | |
11856 | * | |
11857 | * var wordArray = CryptoJS.x64.WordArray.create(); | |
11858 | * | |
11859 | * var wordArray = CryptoJS.x64.WordArray.create([ | |
11860 | * CryptoJS.x64.Word.create(0x00010203, 0x04050607), | |
11861 | * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) | |
11862 | * ]); | |
11863 | * | |
11864 | * var wordArray = CryptoJS.x64.WordArray.create([ | |
11865 | * CryptoJS.x64.Word.create(0x00010203, 0x04050607), | |
11866 | * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) | |
11867 | * ], 10); | |
11868 | */ | |
11869 | init: function (words, sigBytes) { | |
11870 | words = this.words = words || []; | |
11871 | ||
11872 | if (sigBytes != undefined) { | |
11873 | this.sigBytes = sigBytes; | |
11874 | } else { | |
11875 | this.sigBytes = words.length * 8; | |
11876 | } | |
11877 | }, | |
11878 | ||
11879 | /** | |
11880 | * Converts this 64-bit word array to a 32-bit word array. | |
11881 | * | |
11882 | * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array. | |
11883 | * | |
11884 | * @example | |
11885 | * | |
11886 | * var x32WordArray = x64WordArray.toX32(); | |
11887 | */ | |
11888 | toX32: function () { | |
11889 | // Shortcuts | |
11890 | var x64Words = this.words; | |
11891 | var x64WordsLength = x64Words.length; | |
11892 | ||
11893 | // Convert | |
11894 | var x32Words = []; | |
11895 | for (var i = 0; i < x64WordsLength; i++) { | |
11896 | var x64Word = x64Words[i]; | |
11897 | x32Words.push(x64Word.high); | |
11898 | x32Words.push(x64Word.low); | |
11899 | } | |
11900 | ||
11901 | return X32WordArray.create(x32Words, this.sigBytes); | |
11902 | }, | |
11903 | ||
11904 | /** | |
11905 | * Creates a copy of this word array. | |
11906 | * | |
11907 | * @return {X64WordArray} The clone. | |
11908 | * | |
11909 | * @example | |
11910 | * | |
11911 | * var clone = x64WordArray.clone(); | |
11912 | */ | |
11913 | clone: function () { | |
11914 | var clone = Base.clone.call(this); | |
11915 | ||
11916 | // Clone "words" array | |
11917 | var words = clone.words = this.words.slice(0); | |
11918 | ||
11919 | // Clone each X64Word object | |
11920 | var wordsLength = words.length; | |
11921 | for (var i = 0; i < wordsLength; i++) { | |
11922 | words[i] = words[i].clone(); | |
11923 | } | |
11924 | ||
11925 | return clone; | |
11926 | } | |
11927 | }); | |
11928 | }()); | |
11929 | ||
11930 | ||
11931 | return CryptoJS; | |
11932 | ||
11933 | })); | |
11934 | },{"./core":31}],63:[function(_dereq_,module,exports){ | |
11935 | var assert = _dereq_('assert') | |
11936 | var BigInteger = _dereq_('bigi') | |
11937 | ||
11938 | var Point = _dereq_('./point') | |
11939 | ||
11940 | function Curve(p, a, b, Gx, Gy, n, h) { | |
11941 | this.p = p | |
11942 | this.a = a | |
11943 | this.b = b | |
11944 | this.G = Point.fromAffine(this, Gx, Gy) | |
11945 | this.n = n | |
11946 | this.h = h | |
11947 | ||
11948 | this.infinity = new Point(this, null, null, BigInteger.ZERO) | |
11949 | ||
11950 | // result caching | |
11951 | this.pOverFour = p.add(BigInteger.ONE).shiftRight(2) | |
11952 | } | |
11953 | ||
11954 | Curve.prototype.pointFromX = function(isOdd, x) { | |
11955 | var alpha = x.pow(3).add(this.a.multiply(x)).add(this.b).mod(this.p) | |
11956 | var beta = alpha.modPow(this.pOverFour, this.p) | |
11957 | ||
11958 | var y = beta | |
11959 | if (beta.isEven() ^ !isOdd) { | |
11960 | y = this.p.subtract(y) // -y % p | |
11961 | } | |
11962 | ||
11963 | return Point.fromAffine(this, x, y) | |
11964 | } | |
11965 | ||
11966 | Curve.prototype.isInfinity = function(Q) { | |
11967 | if (Q === this.infinity) return true | |
11968 | ||
11969 | return Q.z.signum() === 0 && Q.y.signum() !== 0 | |
11970 | } | |
11971 | ||
11972 | Curve.prototype.isOnCurve = function(Q) { | |
11973 | if (this.isInfinity(Q)) return true | |
11974 | ||
11975 | var x = Q.affineX | |
11976 | var y = Q.affineY | |
11977 | var a = this.a | |
11978 | var b = this.b | |
11979 | var p = this.p | |
11980 | ||
11981 | // Check that xQ and yQ are integers in the interval [0, p - 1] | |
11982 | if (x.signum() < 0 || x.compareTo(p) >= 0) return false | |
11983 | if (y.signum() < 0 || y.compareTo(p) >= 0) return false | |
11984 | ||
11985 | // and check that y^2 = x^3 + ax + b (mod p) | |
11986 | var lhs = y.square().mod(p) | |
11987 | var rhs = x.pow(3).add(a.multiply(x)).add(b).mod(p) | |
11988 | return lhs.equals(rhs) | |
11989 | } | |
11990 | ||
11991 | /** | |
11992 | * Validate an elliptic curve point. | |
11993 | * | |
11994 | * See SEC 1, section 3.2.2.1: Elliptic Curve Public Key Validation Primitive | |
11995 | */ | |
11996 | Curve.prototype.validate = function(Q) { | |
11997 | // Check Q != O | |
11998 | assert(!this.isInfinity(Q), 'Point is at infinity') | |
11999 | assert(this.isOnCurve(Q), 'Point is not on the curve') | |
12000 | ||
12001 | // Check nQ = O (where Q is a scalar multiple of G) | |
12002 | var nQ = Q.multiply(this.n) | |
12003 | assert(this.isInfinity(nQ), 'Point is not a scalar multiple of G') | |
12004 | ||
12005 | return true | |
12006 | } | |
12007 | ||
12008 | module.exports = Curve | |
12009 | ||
12010 | },{"./point":67,"assert":4,"bigi":3}],64:[function(_dereq_,module,exports){ | |
12011 | module.exports={ | |
12012 | "secp128r1": { | |
12013 | "p": "fffffffdffffffffffffffffffffffff", | |
12014 | "a": "fffffffdfffffffffffffffffffffffc", | |
12015 | "b": "e87579c11079f43dd824993c2cee5ed3", | |
12016 | "n": "fffffffe0000000075a30d1b9038a115", | |
12017 | "h": "01", | |
12018 | "Gx": "161ff7528b899b2d0c28607ca52c5b86", | |
12019 | "Gy": "cf5ac8395bafeb13c02da292dded7a83" | |
12020 | }, | |
12021 | "secp160k1": { | |
12022 | "p": "fffffffffffffffffffffffffffffffeffffac73", | |
12023 | "a": "00", | |
12024 | "b": "07", | |
12025 | "n": "0100000000000000000001b8fa16dfab9aca16b6b3", | |
12026 | "h": "01", | |
12027 | "Gx": "3b4c382ce37aa192a4019e763036f4f5dd4d7ebb", | |
12028 | "Gy": "938cf935318fdced6bc28286531733c3f03c4fee" | |
12029 | }, | |
12030 | "secp160r1": { | |
12031 | "p": "ffffffffffffffffffffffffffffffff7fffffff", | |
12032 | "a": "ffffffffffffffffffffffffffffffff7ffffffc", | |
12033 | "b": "1c97befc54bd7a8b65acf89f81d4d4adc565fa45", | |
12034 | "n": "0100000000000000000001f4c8f927aed3ca752257", | |
12035 | "h": "01", | |
12036 | "Gx": "4a96b5688ef573284664698968c38bb913cbfc82", | |
12037 | "Gy": "23a628553168947d59dcc912042351377ac5fb32" | |
12038 | }, | |
12039 | "secp192k1": { | |
12040 | "p": "fffffffffffffffffffffffffffffffffffffffeffffee37", | |
12041 | "a": "00", | |
12042 | "b": "03", | |
12043 | "n": "fffffffffffffffffffffffe26f2fc170f69466a74defd8d", | |
12044 | "h": "01", | |
12045 | "Gx": "db4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d", | |
12046 | "Gy": "9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d" | |
12047 | }, | |
12048 | "secp192r1": { | |
12049 | "p": "fffffffffffffffffffffffffffffffeffffffffffffffff", | |
12050 | "a": "fffffffffffffffffffffffffffffffefffffffffffffffc", | |
12051 | "b": "64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", | |
12052 | "n": "ffffffffffffffffffffffff99def836146bc9b1b4d22831", | |
12053 | "h": "01", | |
12054 | "Gx": "188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012", | |
12055 | "Gy": "07192b95ffc8da78631011ed6b24cdd573f977a11e794811" | |
12056 | }, | |
12057 | "secp224r1": { | |
12058 | "p": "ffffffffffffffffffffffffffffffff000000000000000000000001", | |
12059 | "a": "fffffffffffffffffffffffffffffffefffffffffffffffffffffffe", | |
12060 | "b": "b4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4", | |
12061 | "n": "ffffffffffffffffffffffffffff16a2e0b8f03e13dd29455c5c2a3d", | |
12062 | "h": "01", | |
12063 | "Gx": "b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21", | |
12064 | "Gy": "bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34" | |
12065 | }, | |
12066 | "secp256k1": { | |
12067 | "p": "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", | |
12068 | "a": "00", | |
12069 | "b": "07", | |
12070 | "n": "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", | |
12071 | "h": "01", | |
12072 | "Gx": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", | |
12073 | "Gy": "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8" | |
12074 | }, | |
12075 | "secp256r1": { | |
12076 | "p": "ffffffff00000001000000000000000000000000ffffffffffffffffffffffff", | |
12077 | "a": "ffffffff00000001000000000000000000000000fffffffffffffffffffffffc", | |
12078 | "b": "5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b", | |
12079 | "n": "ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551", | |
12080 | "h": "01", | |
12081 | "Gx": "6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296", | |
12082 | "Gy": "4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5" | |
12083 | } | |
12084 | } | |
12085 | ||
12086 | },{}],65:[function(_dereq_,module,exports){ | |
12087 | var Point = _dereq_('./point') | |
12088 | var Curve = _dereq_('./curve') | |
12089 | ||
12090 | var getCurveByName = _dereq_('./names') | |
12091 | ||
12092 | module.exports = { | |
12093 | Curve: Curve, | |
12094 | Point: Point, | |
12095 | getCurveByName: getCurveByName | |
12096 | } | |
12097 | ||
12098 | },{"./curve":63,"./names":66,"./point":67}],66:[function(_dereq_,module,exports){ | |
12099 | var BigInteger = _dereq_('bigi') | |
12100 | ||
12101 | var curves = _dereq_('./curves') | |
12102 | var Curve = _dereq_('./curve') | |
12103 | ||
12104 | function getCurveByName(name) { | |
12105 | var curve = curves[name] | |
12106 | if (!curve) return null | |
12107 | ||
12108 | var p = new BigInteger(curve.p, 16) | |
12109 | var a = new BigInteger(curve.a, 16) | |
12110 | var b = new BigInteger(curve.b, 16) | |
12111 | var n = new BigInteger(curve.n, 16) | |
12112 | var h = new BigInteger(curve.h, 16) | |
12113 | var Gx = new BigInteger(curve.Gx, 16) | |
12114 | var Gy = new BigInteger(curve.Gy, 16) | |
12115 | ||
12116 | return new Curve(p, a, b, Gx, Gy, n, h) | |
12117 | } | |
12118 | ||
12119 | module.exports = getCurveByName | |
12120 | ||
12121 | },{"./curve":63,"./curves":64,"bigi":3}],67:[function(_dereq_,module,exports){ | |
12122 | (function (Buffer){ | |
12123 | var assert = _dereq_('assert') | |
12124 | var BigInteger = _dereq_('bigi') | |
12125 | ||
12126 | var THREE = BigInteger.valueOf(3) | |
12127 | ||
12128 | function Point(curve, x, y, z) { | |
12129 | assert.notStrictEqual(z, undefined, 'Missing Z coordinate') | |
12130 | ||
12131 | this.curve = curve | |
12132 | this.x = x | |
12133 | this.y = y | |
12134 | this.z = z | |
12135 | this._zInv = null | |
12136 | ||
12137 | this.compressed = true | |
12138 | } | |
12139 | ||
12140 | Object.defineProperty(Point.prototype, 'zInv', { | |
12141 | get: function() { | |
12142 | if (this._zInv === null) { | |
12143 | this._zInv = this.z.modInverse(this.curve.p) | |
12144 | } | |
12145 | ||
12146 | return this._zInv | |
12147 | } | |
12148 | }) | |
12149 | ||
12150 | Object.defineProperty(Point.prototype, 'affineX', { | |
12151 | get: function() { | |
12152 | return this.x.multiply(this.zInv).mod(this.curve.p) | |
12153 | } | |
12154 | }) | |
12155 | ||
12156 | Object.defineProperty(Point.prototype, 'affineY', { | |
12157 | get: function() { | |
12158 | return this.y.multiply(this.zInv).mod(this.curve.p) | |
12159 | } | |
12160 | }) | |
12161 | ||
12162 | Point.fromAffine = function(curve, x, y) { | |
12163 | return new Point(curve, x, y, BigInteger.ONE) | |
12164 | } | |
12165 | ||
12166 | Point.prototype.equals = function(other) { | |
12167 | if (other === this) return true | |
12168 | if (this.curve.isInfinity(this)) return this.curve.isInfinity(other) | |
12169 | if (this.curve.isInfinity(other)) return this.curve.isInfinity(this) | |
12170 | ||
12171 | // u = Y2 * Z1 - Y1 * Z2 | |
12172 | var u = other.y.multiply(this.z).subtract(this.y.multiply(other.z)).mod(this.curve.p) | |
12173 | ||
12174 | if (u.signum() !== 0) return false | |
12175 | ||
12176 | // v = X2 * Z1 - X1 * Z2 | |
12177 | var v = other.x.multiply(this.z).subtract(this.x.multiply(other.z)).mod(this.curve.p) | |
12178 | ||
12179 | return v.signum() === 0 | |
12180 | } | |
12181 | ||
12182 | Point.prototype.negate = function() { | |
12183 | var y = this.curve.p.subtract(this.y) | |
12184 | ||
12185 | return new Point(this.curve, this.x, y, this.z) | |
12186 | } | |
12187 | ||
12188 | Point.prototype.add = function(b) { | |
12189 | if (this.curve.isInfinity(this)) return b | |
12190 | if (this.curve.isInfinity(b)) return this | |
12191 | ||
12192 | var x1 = this.x | |
12193 | var y1 = this.y | |
12194 | var x2 = b.x | |
12195 | var y2 = b.y | |
12196 | ||
12197 | // u = Y2 * Z1 - Y1 * Z2 | |
12198 | var u = y2.multiply(this.z).subtract(y1.multiply(b.z)).mod(this.curve.p) | |
12199 | // v = X2 * Z1 - X1 * Z2 | |
12200 | var v = x2.multiply(this.z).subtract(x1.multiply(b.z)).mod(this.curve.p) | |
12201 | ||
12202 | if (v.signum() === 0) { | |
12203 | if (u.signum() === 0) { | |
12204 | return this.twice() // this == b, so double | |
12205 | } | |
12206 | ||
12207 | return this.curve.infinity // this = -b, so infinity | |
12208 | } | |
12209 | ||
12210 | var v2 = v.square() | |
12211 | var v3 = v2.multiply(v) | |
12212 | var x1v2 = x1.multiply(v2) | |
12213 | var zu2 = u.square().multiply(this.z) | |
12214 | ||
12215 | // x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3) | |
12216 | var x3 = zu2.subtract(x1v2.shiftLeft(1)).multiply(b.z).subtract(v3).multiply(v).mod(this.curve.p) | |
12217 | // y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3 | |
12218 | var y3 = x1v2.multiply(THREE).multiply(u).subtract(y1.multiply(v3)).subtract(zu2.multiply(u)).multiply(b.z).add(u.multiply(v3)).mod(this.curve.p) | |
12219 | // z3 = v^3 * z1 * z2 | |
12220 | var z3 = v3.multiply(this.z).multiply(b.z).mod(this.curve.p) | |
12221 | ||
12222 | return new Point(this.curve, x3, y3, z3) | |
12223 | } | |
12224 | ||
12225 | Point.prototype.twice = function() { | |
12226 | if (this.curve.isInfinity(this)) return this | |
12227 | if (this.y.signum() === 0) return this.curve.infinity | |
12228 | ||
12229 | var x1 = this.x | |
12230 | var y1 = this.y | |
12231 | ||
12232 | var y1z1 = y1.multiply(this.z) | |
12233 | var y1sqz1 = y1z1.multiply(y1).mod(this.curve.p) | |
12234 | var a = this.curve.a | |
12235 | ||
12236 | // w = 3 * x1^2 + a * z1^2 | |
12237 | var w = x1.square().multiply(THREE) | |
12238 | ||
12239 | if (a.signum() !== 0) { | |
12240 | w = w.add(this.z.square().multiply(a)) | |
12241 | } | |
12242 | ||
12243 | w = w.mod(this.curve.p) | |
12244 | // x3 = 2 * y1 * z1 * (w^2 - 8 * x1 * y1^2 * z1) | |
12245 | var x3 = w.square().subtract(x1.shiftLeft(3).multiply(y1sqz1)).shiftLeft(1).multiply(y1z1).mod(this.curve.p) | |
12246 | // y3 = 4 * y1^2 * z1 * (3 * w * x1 - 2 * y1^2 * z1) - w^3 | |
12247 | var y3 = w.multiply(THREE).multiply(x1).subtract(y1sqz1.shiftLeft(1)).shiftLeft(2).multiply(y1sqz1).subtract(w.pow(3)).mod(this.curve.p) | |
12248 | // z3 = 8 * (y1 * z1)^3 | |
12249 | var z3 = y1z1.pow(3).shiftLeft(3).mod(this.curve.p) | |
12250 | ||
12251 | return new Point(this.curve, x3, y3, z3) | |
12252 | } | |
12253 | ||
12254 | // Simple NAF (Non-Adjacent Form) multiplication algorithm | |
12255 | // TODO: modularize the multiplication algorithm | |
12256 | Point.prototype.multiply = function(k) { | |
12257 | if (this.curve.isInfinity(this)) return this | |
12258 | if (k.signum() === 0) return this.curve.infinity | |
12259 | ||
12260 | var e = k | |
12261 | var h = e.multiply(THREE) | |
12262 | ||
12263 | var neg = this.negate() | |
12264 | var R = this | |
12265 | ||
12266 | for (var i = h.bitLength() - 2; i > 0; --i) { | |
12267 | R = R.twice() | |
12268 | ||
12269 | var hBit = h.testBit(i) | |
12270 | var eBit = e.testBit(i) | |
12271 | ||
12272 | if (hBit != eBit) { | |
12273 | R = R.add(hBit ? this : neg) | |
12274 | } | |
12275 | } | |
12276 | ||
12277 | return R | |
12278 | } | |
12279 | ||
12280 | // Compute this*j + x*k (simultaneous multiplication) | |
12281 | Point.prototype.multiplyTwo = function(j, x, k) { | |
12282 | var i | |
12283 | ||
12284 | if (j.bitLength() > k.bitLength()) | |
12285 | i = j.bitLength() - 1 | |
12286 | else | |
12287 | i = k.bitLength() - 1 | |
12288 | ||
12289 | var R = this.curve.infinity | |
12290 | var both = this.add(x) | |
12291 | ||
12292 | while (i >= 0) { | |
12293 | R = R.twice() | |
12294 | ||
12295 | var jBit = j.testBit(i) | |
12296 | var kBit = k.testBit(i) | |
12297 | ||
12298 | if (jBit) { | |
12299 | if (kBit) { | |
12300 | R = R.add(both) | |
12301 | ||
12302 | } else { | |
12303 | R = R.add(this) | |
12304 | } | |
12305 | ||
12306 | } else { | |
12307 | if (kBit) { | |
12308 | R = R.add(x) | |
12309 | } | |
12310 | } | |
12311 | --i | |
12312 | } | |
12313 | ||
12314 | return R | |
12315 | } | |
12316 | ||
12317 | Point.prototype.getEncoded = function(compressed) { | |
12318 | if (compressed == undefined) compressed = this.compressed | |
12319 | if (this.curve.isInfinity(this)) return new Buffer('00', 'hex') // Infinity point encoded is simply '00' | |
12320 | ||
12321 | var x = this.affineX | |
12322 | var y = this.affineY | |
12323 | ||
12324 | var buffer | |
12325 | ||
12326 | // Determine size of q in bytes | |
12327 | var byteLength = Math.floor((this.curve.p.bitLength() + 7) / 8) | |
12328 | ||
12329 | // 0x02/0x03 | X | |
12330 | if (compressed) { | |
12331 | buffer = new Buffer(1 + byteLength) | |
12332 | buffer.writeUInt8(y.isEven() ? 0x02 : 0x03, 0) | |
12333 | ||
12334 | // 0x04 | X | Y | |
12335 | } else { | |
12336 | buffer = new Buffer(1 + byteLength + byteLength) | |
12337 | buffer.writeUInt8(0x04, 0) | |
12338 | ||
12339 | y.toBuffer(byteLength).copy(buffer, 1 + byteLength) | |
12340 | } | |
12341 | ||
12342 | x.toBuffer(byteLength).copy(buffer, 1) | |
12343 | ||
12344 | return buffer | |
12345 | } | |
12346 | ||
12347 | Point.decodeFrom = function(curve, buffer) { | |
12348 | var type = buffer.readUInt8(0) | |
12349 | var compressed = (type !== 4) | |
12350 | ||
12351 | var x = BigInteger.fromBuffer(buffer.slice(1, 33)) | |
12352 | var byteLength = Math.floor((curve.p.bitLength() + 7) / 8) | |
12353 | ||
12354 | var Q | |
12355 | if (compressed) { | |
12356 | assert.equal(buffer.length, byteLength + 1, 'Invalid sequence length') | |
12357 | assert(type === 0x02 || type === 0x03, 'Invalid sequence tag') | |
12358 | ||
12359 | var isOdd = (type === 0x03) | |
12360 | Q = curve.pointFromX(isOdd, x) | |
12361 | ||
12362 | } else { | |
12363 | assert.equal(buffer.length, 1 + byteLength + byteLength, 'Invalid sequence length') | |
12364 | ||
12365 | var y = BigInteger.fromBuffer(buffer.slice(1 + byteLength)) | |
12366 | Q = Point.fromAffine(curve, x, y) | |
12367 | } | |
12368 | ||
12369 | Q.compressed = compressed | |
12370 | return Q | |
12371 | } | |
12372 | ||
12373 | Point.prototype.toString = function () { | |
12374 | if (this.curve.isInfinity(this)) return '(INFINITY)' | |
12375 | ||
12376 | return '(' + this.affineX.toString() + ',' + this.affineY.toString() + ')' | |
12377 | } | |
12378 | ||
12379 | module.exports = Point | |
12380 | ||
12381 | }).call(this,_dereq_("buffer").Buffer) | |
12382 | },{"assert":4,"bigi":3,"buffer":8}],68:[function(_dereq_,module,exports){ | |
12383 | (function (process,Buffer){ | |
12384 | // Closure compiler error - result of 'not' operator not being used | |
12385 | //!function(globals){ | |
12386 | (function(globals){ | |
12387 | 'use strict' | |
12388 | ||
12389 | //*** UMD BEGIN | |
12390 | if (typeof define !== 'undefined' && define.amd) { //require.js / AMD | |
12391 | define([], function() { | |
12392 | return secureRandom | |
12393 | }) | |
12394 | } else if (typeof module !== 'undefined' && module.exports) { //CommonJS | |
12395 | module.exports = secureRandom | |
12396 | } else { //script / browser | |
12397 | globals.secureRandom = secureRandom | |
12398 | } | |
12399 | //*** UMD END | |
12400 | ||
12401 | //options.type is the only valid option | |
12402 | function secureRandom(count, options) { | |
12403 | options = options || {type: 'Array'} | |
12404 | //we check for process.pid to prevent browserify from tricking us | |
12405 | if (typeof process != 'undefined' && typeof process.pid == 'number') { | |
12406 | return nodeRandom(count, options) | |
12407 | } else { | |
12408 | var crypto = window.crypto || window.msCrypto | |
12409 | if (!crypto) throw new Error("Your browser does not support window.crypto.") | |
12410 | return browserRandom(count, options) | |
12411 | } | |
12412 | } | |
12413 | ||
12414 | function nodeRandom(count, options) { | |
12415 | var crypto = _dereq_('crypto') | |
12416 | var buf = crypto.randomBytes(count) | |
12417 | ||
12418 | switch (options.type) { | |
12419 | case 'Array': | |
12420 | return [].slice.call(buf) | |
12421 | case 'Buffer': | |
12422 | return buf | |
12423 | case 'Uint8Array': | |
12424 | var arr = new Uint8Array(count) | |
12425 | for (var i = 0; i < count; ++i) { arr[i] = buf.readUInt8(i) } | |
12426 | return arr | |
12427 | default: | |
12428 | throw new Error(options.type + " is unsupported.") | |
12429 | } | |
12430 | } | |
12431 | ||
12432 | function browserRandom(count, options) { | |
12433 | var nativeArr = new Uint8Array(count) | |
12434 | var crypto = window.crypto || window.msCrypto | |
12435 | crypto.getRandomValues(nativeArr) | |
12436 | ||
12437 | switch (options.type) { | |
12438 | case 'Array': | |
12439 | return [].slice.call(nativeArr) | |
12440 | case 'Buffer': | |
12441 | try { var b = new Buffer(1) } catch(e) { throw new Error('Buffer not supported in this environment. Use Node.js or Browserify for browser support.')} | |
12442 | return new Buffer(nativeArr) | |
12443 | case 'Uint8Array': | |
12444 | return nativeArr | |
12445 | default: | |
12446 | throw new Error(options.type + " is unsupported.") | |
12447 | } | |
12448 | } | |
12449 | ||
12450 | secureRandom.randomArray = function(byteCount) { | |
12451 | return secureRandom(byteCount, {type: 'Array'}) | |
12452 | } | |
12453 | ||
12454 | secureRandom.randomUint8Array = function(byteCount) { | |
12455 | return secureRandom(byteCount, {type: 'Uint8Array'}) | |
12456 | } | |
12457 | ||
12458 | secureRandom.randomBuffer = function(byteCount) { | |
12459 | return secureRandom(byteCount, {type: 'Buffer'}) | |
12460 | } | |
12461 | ||
12462 | ||
12463 | })(this); | |
12464 | ||
12465 | }).call(this,_dereq_("FWaASH"),_dereq_("buffer").Buffer) | |
12466 | },{"FWaASH":12,"buffer":8,"crypto":7}],69:[function(_dereq_,module,exports){ | |
12467 | (function (Buffer){ | |
12468 | var assert = _dereq_('assert') | |
12469 | var base58check = _dereq_('./base58check') | |
12470 | var networks = _dereq_('./networks') | |
12471 | var scripts = _dereq_('./scripts') | |
12472 | ||
12473 | function findScriptTypeByVersion(version) { | |
12474 | for (var networkName in networks) { | |
12475 | var network = networks[networkName] | |
12476 | ||
12477 | if (version === network.pubKeyHash) return 'pubkeyhash' | |
12478 | if (version === network.scriptHash) return 'scripthash' | |
12479 | } | |
12480 | } | |
12481 | ||
12482 | function Address(hash, version) { | |
12483 | assert(Buffer.isBuffer(hash), 'Expected Buffer, got ' + hash) | |
12484 | assert.strictEqual(hash.length, 20, 'Invalid hash length') | |
12485 | assert.strictEqual(version & 0xff, version, 'Invalid version byte') | |
12486 | ||
12487 | this.hash = hash | |
12488 | this.version = version | |
12489 | } | |
12490 | ||
12491 | // Import functions | |
12492 | Address.fromBase58Check = function(string) { | |
12493 | var payload = base58check.decode(string) | |
12494 | var version = payload.readUInt8(0) | |
12495 | var hash = payload.slice(1) | |
12496 | ||
12497 | return new Address(hash, version) | |
12498 | } | |
12499 | ||
12500 | Address.fromOutputScript = function(script, network) { | |
12501 | network = network || networks.bitcoin | |
12502 | ||
12503 | var type = scripts.classifyOutput(script) | |
12504 | ||
12505 | if (type === 'pubkeyhash') return new Address(script.chunks[2], network.pubKeyHash) | |
12506 | if (type === 'scripthash') return new Address(script.chunks[1], network.scriptHash) | |
12507 | ||
12508 | assert(false, type + ' has no matching Address') | |
12509 | } | |
12510 | ||
12511 | // Export functions | |
12512 | Address.prototype.toBase58Check = function () { | |
12513 | var payload = new Buffer(21) | |
12514 | payload.writeUInt8(this.version, 0) | |
12515 | this.hash.copy(payload, 1) | |
12516 | ||
12517 | return base58check.encode(payload) | |
12518 | } | |
12519 | ||
12520 | Address.prototype.toOutputScript = function() { | |
12521 | var scriptType = findScriptTypeByVersion(this.version) | |
12522 | ||
12523 | if (scriptType === 'pubkeyhash') return scripts.pubKeyHashOutput(this.hash) | |
12524 | if (scriptType === 'scripthash') return scripts.scriptHashOutput(this.hash) | |
12525 | ||
12526 | assert(false, this.toString() + ' has no matching Script') | |
12527 | } | |
12528 | ||
12529 | Address.prototype.toString = Address.prototype.toBase58Check | |
12530 | ||
12531 | module.exports = Address | |
12532 | ||
12533 | }).call(this,_dereq_("buffer").Buffer) | |
12534 | },{"./base58check":70,"./networks":81,"./scripts":84,"assert":4,"buffer":8}],70:[function(_dereq_,module,exports){ | |
12535 | (function (Buffer){ | |
12536 | // https://en.bitcoin.it/wiki/Base58Check_encoding | |
12537 | var assert = _dereq_('assert') | |
12538 | var base58 = _dereq_('bs58') | |
12539 | var crypto = _dereq_('./crypto') | |
12540 | ||
12541 | // Encode a buffer as a base58-check-encoded string | |
12542 | function encode(payload) { | |
12543 | var checksum = crypto.hash256(payload).slice(0, 4) | |
12544 | ||
12545 | return base58.encode(Buffer.concat([ | |
12546 | payload, | |
12547 | checksum | |
12548 | ])) | |
12549 | } | |
12550 | ||
12551 | // Decode a base58-check-encoded string to a buffer | |
12552 | function decode(string) { | |
12553 | var buffer = base58.decode(string) | |
12554 | ||
12555 | var payload = buffer.slice(0, -4) | |
12556 | var checksum = buffer.slice(-4) | |
12557 | var newChecksum = crypto.hash256(payload).slice(0, 4) | |
12558 | ||
12559 | assert.deepEqual(newChecksum, checksum, 'Invalid checksum') | |
12560 | ||
12561 | return payload | |
12562 | } | |
12563 | ||
12564 | module.exports = { | |
12565 | encode: encode, | |
12566 | decode: decode | |
12567 | } | |
12568 | ||
12569 | }).call(this,_dereq_("buffer").Buffer) | |
12570 | },{"./crypto":73,"assert":4,"bs58":15,"buffer":8}],71:[function(_dereq_,module,exports){ | |
12571 | var assert = _dereq_('assert') | |
12572 | var opcodes = _dereq_('./opcodes') | |
12573 | ||
12574 | // https://github.com/feross/buffer/blob/master/index.js#L1127 | |
12575 | function verifuint(value, max) { | |
12576 | assert(typeof value === 'number', 'cannot write a non-number as a number') | |
12577 | assert(value >= 0, 'specified a negative value for writing an unsigned value') | |
12578 | assert(value <= max, 'value is larger than maximum value for type') | |
12579 | assert(Math.floor(value) === value, 'value has a fractional component') | |
12580 | } | |
12581 | ||
12582 | function pushDataSize(i) { | |
12583 | return i < opcodes.OP_PUSHDATA1 ? 1 | |
12584 | : i < 0xff ? 2 | |
12585 | : i < 0xffff ? 3 | |
12586 | : 5 | |
12587 | } | |
12588 | ||
12589 | function readPushDataInt(buffer, offset) { | |
12590 | var opcode = buffer.readUInt8(offset) | |
12591 | var number, size | |
12592 | ||
12593 | // ~6 bit | |
12594 | if (opcode < opcodes.OP_PUSHDATA1) { | |
12595 | number = opcode | |
12596 | size = 1 | |
12597 | ||
12598 | // 8 bit | |
12599 | } else if (opcode === opcodes.OP_PUSHDATA1) { | |
12600 | number = buffer.readUInt8(offset + 1) | |
12601 | size = 2 | |
12602 | ||
12603 | // 16 bit | |
12604 | } else if (opcode === opcodes.OP_PUSHDATA2) { | |
12605 | number = buffer.readUInt16LE(offset + 1) | |
12606 | size = 3 | |
12607 | ||
12608 | // 32 bit | |
12609 | } else { | |
12610 | assert.equal(opcode, opcodes.OP_PUSHDATA4, 'Unexpected opcode') | |
12611 | ||
12612 | number = buffer.readUInt32LE(offset + 1) | |
12613 | size = 5 | |
12614 | ||
12615 | } | |
12616 | ||
12617 | return { | |
12618 | opcode: opcode, | |
12619 | number: number, | |
12620 | size: size | |
12621 | } | |
12622 | } | |
12623 | ||
12624 | function readUInt64LE(buffer, offset) { | |
12625 | var a = buffer.readUInt32LE(offset) | |
12626 | var b = buffer.readUInt32LE(offset + 4) | |
12627 | b *= 0x100000000 | |
12628 | ||
12629 | verifuint(b + a, 0x001fffffffffffff) | |
12630 | ||
12631 | return b + a | |
12632 | } | |
12633 | ||
12634 | function readVarInt(buffer, offset) { | |
12635 | var t = buffer.readUInt8(offset) | |
12636 | var number, size | |
12637 | ||
12638 | // 8 bit | |
12639 | if (t < 253) { | |
12640 | number = t | |
12641 | size = 1 | |
12642 | ||
12643 | // 16 bit | |
12644 | } else if (t < 254) { | |
12645 | number = buffer.readUInt16LE(offset + 1) | |
12646 | size = 3 | |
12647 | ||
12648 | // 32 bit | |
12649 | } else if (t < 255) { | |
12650 | number = buffer.readUInt32LE(offset + 1) | |
12651 | size = 5 | |
12652 | ||
12653 | // 64 bit | |
12654 | } else { | |
12655 | number = readUInt64LE(buffer, offset + 1) | |
12656 | size = 9 | |
12657 | } | |
12658 | ||
12659 | return { | |
12660 | number: number, | |
12661 | size: size | |
12662 | } | |
12663 | } | |
12664 | ||
12665 | function writePushDataInt(buffer, number, offset) { | |
12666 | var size = pushDataSize(number) | |
12667 | ||
12668 | // ~6 bit | |
12669 | if (size === 1) { | |
12670 | buffer.writeUInt8(number, offset) | |
12671 | ||
12672 | // 8 bit | |
12673 | } else if (size === 2) { | |
12674 | buffer.writeUInt8(opcodes.OP_PUSHDATA1, offset) | |
12675 | buffer.writeUInt8(number, offset + 1) | |
12676 | ||
12677 | // 16 bit | |
12678 | } else if (size === 3) { | |
12679 | buffer.writeUInt8(opcodes.OP_PUSHDATA2, offset) | |
12680 | buffer.writeUInt16LE(number, offset + 1) | |
12681 | ||
12682 | // 32 bit | |
12683 | } else { | |
12684 | buffer.writeUInt8(opcodes.OP_PUSHDATA4, offset) | |
12685 | buffer.writeUInt32LE(number, offset + 1) | |
12686 | ||
12687 | } | |
12688 | ||
12689 | return size | |
12690 | } | |
12691 | ||
12692 | function writeUInt64LE(buffer, value, offset) { | |
12693 | verifuint(value, 0x001fffffffffffff) | |
12694 | ||
12695 | buffer.writeInt32LE(value & -1, offset) | |
12696 | buffer.writeUInt32LE(Math.floor(value / 0x100000000), offset + 4) | |
12697 | } | |
12698 | ||
12699 | function varIntSize(i) { | |
12700 | return i < 253 ? 1 | |
12701 | : i < 0x10000 ? 3 | |
12702 | : i < 0x100000000 ? 5 | |
12703 | : 9 | |
12704 | } | |
12705 | ||
12706 | function writeVarInt(buffer, number, offset) { | |
12707 | var size = varIntSize(number) | |
12708 | ||
12709 | // 8 bit | |
12710 | if (size === 1) { | |
12711 | buffer.writeUInt8(number, offset) | |
12712 | ||
12713 | // 16 bit | |
12714 | } else if (size === 3) { | |
12715 | buffer.writeUInt8(253, offset) | |
12716 | buffer.writeUInt16LE(number, offset + 1) | |
12717 | ||
12718 | // 32 bit | |
12719 | } else if (size === 5) { | |
12720 | buffer.writeUInt8(254, offset) | |
12721 | buffer.writeUInt32LE(number, offset + 1) | |
12722 | ||
12723 | // 64 bit | |
12724 | } else { | |
12725 | buffer.writeUInt8(255, offset) | |
12726 | writeUInt64LE(buffer, number, offset + 1) | |
12727 | } | |
12728 | ||
12729 | return size | |
12730 | } | |
12731 | ||
12732 | module.exports = { | |
12733 | pushDataSize: pushDataSize, | |
12734 | readPushDataInt: readPushDataInt, | |
12735 | readUInt64LE: readUInt64LE, | |
12736 | readVarInt: readVarInt, | |
12737 | varIntSize: varIntSize, | |
12738 | writePushDataInt: writePushDataInt, | |
12739 | writeUInt64LE: writeUInt64LE, | |
12740 | writeVarInt: writeVarInt | |
12741 | } | |
12742 | ||
12743 | },{"./opcodes":82,"assert":4}],72:[function(_dereq_,module,exports){ | |
12744 | (function (Buffer){ | |
12745 | var assert = _dereq_('assert') | |
12746 | var Crypto = _dereq_('crypto-js') | |
12747 | var WordArray = Crypto.lib.WordArray | |
12748 | ||
12749 | function bufferToWordArray(buffer) { | |
12750 | assert(Buffer.isBuffer(buffer), 'Expected Buffer, got', buffer) | |
12751 | ||
12752 | var words = [] | |
12753 | for (var i = 0, b = 0; i < buffer.length; i++, b += 8) { | |
12754 | words[b >>> 5] |= buffer[i] << (24 - b % 32) | |
12755 | } | |
12756 | ||
12757 | return new WordArray.init(words, buffer.length) | |
12758 | } | |
12759 | ||
12760 | function wordArrayToBuffer(wordArray) { | |
12761 | assert(Array.isArray(wordArray.words), 'Expected WordArray, got' + wordArray) | |
12762 | ||
12763 | var words = wordArray.words | |
12764 | var buffer = new Buffer(words.length * 4) | |
12765 | ||
12766 | words.forEach(function(value, i) { | |
12767 | buffer.writeInt32BE(value & -1, i * 4) | |
12768 | }) | |
12769 | ||
12770 | return buffer | |
12771 | } | |
12772 | ||
12773 | module.exports = { | |
12774 | bufferToWordArray: bufferToWordArray, | |
12775 | wordArrayToBuffer: wordArrayToBuffer | |
12776 | } | |
12777 | ||
12778 | }).call(this,_dereq_("buffer").Buffer) | |
12779 | },{"assert":4,"buffer":8,"crypto-js":37}],73:[function(_dereq_,module,exports){ | |
12780 | (function (Buffer){ | |
12781 | // Crypto, crypto, where art thou crypto | |
12782 | var assert = _dereq_('assert') | |
12783 | var CryptoJS = _dereq_('crypto-js') | |
12784 | var crypto = _dereq_('crypto') | |
12785 | var convert = _dereq_('./convert') | |
12786 | ||
12787 | function hash160(buffer) { | |
12788 | return ripemd160(sha256(buffer)) | |
12789 | } | |
12790 | ||
12791 | function hash256(buffer) { | |
12792 | return sha256(sha256(buffer)) | |
12793 | } | |
12794 | ||
12795 | function ripemd160(buffer) { | |
12796 | return crypto.createHash('rmd160').update(buffer).digest() | |
12797 | } | |
12798 | ||
12799 | function sha1(buffer) { | |
12800 | return crypto.createHash('sha1').update(buffer).digest() | |
12801 | } | |
12802 | ||
12803 | function sha256(buffer) { | |
12804 | return crypto.createHash('sha256').update(buffer).digest() | |
12805 | } | |
12806 | ||
12807 | // FIXME: Name not consistent with others | |
12808 | function HmacSHA256(buffer, secret) { | |
12809 | return crypto.createHmac('sha256', secret).update(buffer).digest() | |
12810 | } | |
12811 | ||
12812 | function HmacSHA512(data, secret) { | |
12813 | assert(Buffer.isBuffer(data), 'Expected Buffer for data, got ' + data) | |
12814 | assert(Buffer.isBuffer(secret), 'Expected Buffer for secret, got ' + secret) | |
12815 | ||
12816 | var dataWords = convert.bufferToWordArray(data) | |
12817 | var secretWords = convert.bufferToWordArray(secret) | |
12818 | ||
12819 | var hash = CryptoJS.HmacSHA512(dataWords, secretWords) | |
12820 | ||
12821 | return convert.wordArrayToBuffer(hash) | |
12822 | } | |
12823 | ||
12824 | module.exports = { | |
12825 | ripemd160: ripemd160, | |
12826 | sha1: sha1, | |
12827 | sha256: sha256, | |
12828 | hash160: hash160, | |
12829 | hash256: hash256, | |
12830 | HmacSHA256: HmacSHA256, | |
12831 | HmacSHA512: HmacSHA512 | |
12832 | } | |
12833 | ||
12834 | }).call(this,_dereq_("buffer").Buffer) | |
12835 | },{"./convert":72,"assert":4,"buffer":8,"crypto":19,"crypto-js":37}],74:[function(_dereq_,module,exports){ | |
12836 | (function (Buffer){ | |
12837 | var assert = _dereq_('assert') | |
12838 | var crypto = _dereq_('./crypto') | |
12839 | ||
12840 | var BigInteger = _dereq_('bigi') | |
12841 | var ECSignature = _dereq_('./ecsignature') | |
12842 | var Point = _dereq_('ecurve').Point | |
12843 | ||
12844 | // https://tools.ietf.org/html/rfc6979#section-3.2 | |
12845 | function deterministicGenerateK(curve, hash, d) { | |
12846 | assert(Buffer.isBuffer(hash), 'Hash must be a Buffer, not ' + hash) | |
12847 | assert.equal(hash.length, 32, 'Hash must be 256 bit') | |
12848 | assert(d instanceof BigInteger, 'Private key must be a BigInteger') | |
12849 | ||
12850 | var x = d.toBuffer(32) | |
12851 | var k = new Buffer(32) | |
12852 | var v = new Buffer(32) | |
12853 | ||
12854 | // Step B | |
12855 | v.fill(1) | |
12856 | ||
12857 | // Step C | |
12858 | k.fill(0) | |
12859 | ||
12860 | // Step D | |
12861 | k = crypto.HmacSHA256(Buffer.concat([v, new Buffer([0]), x, hash]), k) | |
12862 | ||
12863 | // Step E | |
12864 | v = crypto.HmacSHA256(v, k) | |
12865 | ||
12866 | // Step F | |
12867 | k = crypto.HmacSHA256(Buffer.concat([v, new Buffer([1]), x, hash]), k) | |
12868 | ||
12869 | // Step G | |
12870 | v = crypto.HmacSHA256(v, k) | |
12871 | ||
12872 | // Step H1/H2a, ignored as tlen === qlen (256 bit) | |
12873 | // Step H2b | |
12874 | v = crypto.HmacSHA256(v, k) | |
12875 | ||
12876 | var T = BigInteger.fromBuffer(v) | |
12877 | ||
12878 | // Step H3, repeat until T is within the interval [1, n - 1] | |
12879 | while ((T.signum() <= 0) || (T.compareTo(curve.n) >= 0)) { | |
12880 | k = crypto.HmacSHA256(Buffer.concat([v, new Buffer([0])]), k) | |
12881 | v = crypto.HmacSHA256(v, k) | |
12882 | ||
12883 | T = BigInteger.fromBuffer(v) | |
12884 | } | |
12885 | ||
12886 | return T | |
12887 | } | |
12888 | ||
12889 | function sign(curve, hash, d) { | |
12890 | var k = deterministicGenerateK(curve, hash, d) | |
12891 | ||
12892 | var n = curve.n | |
12893 | var G = curve.G | |
12894 | var Q = G.multiply(k) | |
12895 | var e = BigInteger.fromBuffer(hash) | |
12896 | ||
12897 | var r = Q.affineX.mod(n) | |
12898 | assert.notEqual(r.signum(), 0, 'Invalid R value') | |
12899 | ||
12900 | var s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n) | |
12901 | assert.notEqual(s.signum(), 0, 'Invalid S value') | |
12902 | ||
12903 | var N_OVER_TWO = n.shiftRight(1) | |
12904 | ||
12905 | // enforce low S values, see bip62: 'low s values in signatures' | |
12906 | if (s.compareTo(N_OVER_TWO) > 0) { | |
12907 | s = n.subtract(s) | |
12908 | } | |
12909 | ||
12910 | return new ECSignature(r, s) | |
12911 | } | |
12912 | ||
12913 | function verify(curve, hash, signature, Q) { | |
12914 | var e = BigInteger.fromBuffer(hash) | |
12915 | ||
12916 | return verifyRaw(curve, e, signature, Q) | |
12917 | } | |
12918 | ||
12919 | function verifyRaw(curve, e, signature, Q) { | |
12920 | var n = curve.n | |
12921 | var G = curve.G | |
12922 | ||
12923 | var r = signature.r | |
12924 | var s = signature.s | |
12925 | ||
12926 | if (r.signum() === 0 || r.compareTo(n) >= 0) return false | |
12927 | if (s.signum() === 0 || s.compareTo(n) >= 0) return false | |
12928 | ||
12929 | var c = s.modInverse(n) | |
12930 | ||
12931 | var u1 = e.multiply(c).mod(n) | |
12932 | var u2 = r.multiply(c).mod(n) | |
12933 | ||
12934 | var point = G.multiplyTwo(u1, Q, u2) | |
12935 | var v = point.affineX.mod(n) | |
12936 | ||
12937 | return v.equals(r) | |
12938 | } | |
12939 | ||
12940 | /** | |
12941 | * Recover a public key from a signature. | |
12942 | * | |
12943 | * See SEC 1: Elliptic Curve Cryptography, section 4.1.6, "Public | |
12944 | * Key Recovery Operation". | |
12945 | * | |
12946 | * http://www.secg.org/download/aid-780/sec1-v2.pdf | |
12947 | */ | |
12948 | function recoverPubKey(curve, e, signature, i) { | |
12949 | assert.strictEqual(i & 3, i, 'Recovery param is more than two bits') | |
12950 | ||
12951 | var r = signature.r | |
12952 | var s = signature.s | |
12953 | ||
12954 | // A set LSB signifies that the y-coordinate is odd | |
12955 | var isYOdd = i & 1 | |
12956 | ||
12957 | // The more significant bit specifies whether we should use the | |
12958 | // first or second candidate key. | |
12959 | var isSecondKey = i >> 1 | |
12960 | ||
12961 | var n = curve.n | |
12962 | var G = curve.G | |
12963 | ||
12964 | // 1.1 Let x = r + jn | |
12965 | var x = isSecondKey ? r.add(n) : r | |
12966 | var R = curve.pointFromX(isYOdd, x) | |
12967 | ||
12968 | // 1.4 Check that nR is at infinity | |
12969 | var nR = R.multiply(n) | |
12970 | assert(curve.isInfinity(nR), 'nR is not a valid curve point') | |
12971 | ||
12972 | // Compute -e from e | |
12973 | var eNeg = e.negate().mod(n) | |
12974 | ||
12975 | // 1.6.1 Compute Q = r^-1 (sR - eG) | |
12976 | // Q = r^-1 (sR + -eG) | |
12977 | var rInv = r.modInverse(n) | |
12978 | ||
12979 | var Q = R.multiplyTwo(s, G, eNeg).multiply(rInv) | |
12980 | curve.validate(Q) | |
12981 | ||
12982 | return Q | |
12983 | } | |
12984 | ||
12985 | /** | |
12986 | * Calculate pubkey extraction parameter. | |
12987 | * | |
12988 | * When extracting a pubkey from a signature, we have to | |
12989 | * distinguish four different cases. Rather than putting this | |
12990 | * burden on the verifier, Bitcoin includes a 2-bit value with the | |
12991 | * signature. | |
12992 | * | |
12993 | * This function simply tries all four cases and returns the value | |
12994 | * that resulted in a successful pubkey recovery. | |
12995 | */ | |
12996 | function calcPubKeyRecoveryParam(curve, e, signature, Q) { | |
12997 | for (var i = 0; i < 4; i++) { | |
12998 | var Qprime = recoverPubKey(curve, e, signature, i) | |
12999 | ||
13000 | // 1.6.2 Verify Q | |
13001 | if (Qprime.equals(Q)) { | |
13002 | return i | |
13003 | } | |
13004 | } | |
13005 | ||
13006 | throw new Error('Unable to find valid recovery factor') | |
13007 | } | |
13008 | ||
13009 | module.exports = { | |
13010 | calcPubKeyRecoveryParam: calcPubKeyRecoveryParam, | |
13011 | deterministicGenerateK: deterministicGenerateK, | |
13012 | recoverPubKey: recoverPubKey, | |
13013 | sign: sign, | |
13014 | verify: verify, | |
13015 | verifyRaw: verifyRaw | |
13016 | } | |
13017 | ||
13018 | }).call(this,_dereq_("buffer").Buffer) | |
13019 | },{"./crypto":73,"./ecsignature":77,"assert":4,"bigi":3,"buffer":8,"ecurve":65}],75:[function(_dereq_,module,exports){ | |
13020 | (function (Buffer){ | |
13021 | var assert = _dereq_('assert') | |
13022 | var base58check = _dereq_('./base58check') | |
13023 | var ecdsa = _dereq_('./ecdsa') | |
13024 | var networks = _dereq_('./networks') | |
13025 | var secureRandom = _dereq_('secure-random') | |
13026 | ||
13027 | var BigInteger = _dereq_('bigi') | |
13028 | var ECPubKey = _dereq_('./ecpubkey') | |
13029 | ||
13030 | var ecurve = _dereq_('ecurve') | |
13031 | var curve = ecurve.getCurveByName('secp256k1') | |
13032 | ||
13033 | function ECKey(d, compressed) { | |
13034 | assert(d.signum() > 0, 'Private key must be greater than 0') | |
13035 | assert(d.compareTo(curve.n) < 0, 'Private key must be less than the curve order') | |
13036 | ||
13037 | var Q = curve.G.multiply(d) | |
13038 | ||
13039 | this.d = d | |
13040 | this.pub = new ECPubKey(Q, compressed) | |
13041 | } | |
13042 | ||
13043 | // Static constructors | |
13044 | ECKey.fromWIF = function(string) { | |
13045 | var payload = base58check.decode(string) | |
13046 | var compressed = false | |
13047 | ||
13048 | // Ignore the version byte | |
13049 | payload = payload.slice(1) | |
13050 | ||
13051 | if (payload.length === 33) { | |
13052 | assert.strictEqual(payload[32], 0x01, 'Invalid compression flag') | |
13053 | ||
13054 | // Truncate the compression flag | |
13055 | payload = payload.slice(0, -1) | |
13056 | compressed = true | |
13057 | } | |
13058 | ||
13059 | assert.equal(payload.length, 32, 'Invalid WIF payload length') | |
13060 | ||
13061 | var d = BigInteger.fromBuffer(payload) | |
13062 | return new ECKey(d, compressed) | |
13063 | } | |
13064 | ||
13065 | ECKey.makeRandom = function(compressed, rng) { | |
13066 | rng = rng || secureRandom.randomBuffer | |
13067 | ||
13068 | var buffer = rng(32) | |
13069 | assert(Buffer.isBuffer(buffer), 'Expected Buffer, got ' + buffer) | |
13070 | ||
13071 | var d = BigInteger.fromBuffer(buffer) | |
13072 | d = d.mod(curve.n) | |
13073 | ||
13074 | return new ECKey(d, compressed) | |
13075 | } | |
13076 | ||
13077 | // Export functions | |
13078 | ECKey.prototype.toWIF = function(network) { | |
13079 | network = network || networks.bitcoin | |
13080 | ||
13081 | var bufferLen = this.pub.compressed ? 34 : 33 | |
13082 | var buffer = new Buffer(bufferLen) | |
13083 | ||
13084 | buffer.writeUInt8(network.wif, 0) | |
13085 | this.d.toBuffer(32).copy(buffer, 1) | |
13086 | ||
13087 | if (this.pub.compressed) { | |
13088 | buffer.writeUInt8(0x01, 33) | |
13089 | } | |
13090 | ||
13091 | return base58check.encode(buffer) | |
13092 | } | |
13093 | ||
13094 | // Operations | |
13095 | ECKey.prototype.sign = function(hash) { | |
13096 | return ecdsa.sign(curve, hash, this.d) | |
13097 | } | |
13098 | ||
13099 | module.exports = ECKey | |
13100 | ||
13101 | }).call(this,_dereq_("buffer").Buffer) | |
13102 | },{"./base58check":70,"./ecdsa":74,"./ecpubkey":76,"./networks":81,"assert":4,"bigi":3,"buffer":8,"ecurve":65,"secure-random":68}],76:[function(_dereq_,module,exports){ | |
13103 | (function (Buffer){ | |
13104 | var assert = _dereq_('assert') | |
13105 | var crypto = _dereq_('./crypto') | |
13106 | var ecdsa = _dereq_('./ecdsa') | |
13107 | var networks = _dereq_('./networks') | |
13108 | ||
13109 | var Address = _dereq_('./address') | |
13110 | ||
13111 | var ecurve = _dereq_('ecurve') | |
13112 | var curve = ecurve.getCurveByName('secp256k1') | |
13113 | ||
13114 | function ECPubKey(Q, compressed) { | |
13115 | assert(Q instanceof ecurve.Point, 'Expected Point, got ' + Q) | |
13116 | ||
13117 | if (compressed == undefined) compressed = true | |
13118 | assert.strictEqual(typeof compressed, 'boolean', 'Expected boolean, got ' + compressed) | |
13119 | ||
13120 | this.compressed = compressed | |
13121 | this.Q = Q | |
13122 | } | |
13123 | ||
13124 | // Static constructors | |
13125 | ECPubKey.fromBuffer = function(buffer) { | |
13126 | var Q = ecurve.Point.decodeFrom(curve, buffer) | |
13127 | return new ECPubKey(Q, Q.compressed) | |
13128 | } | |
13129 | ||
13130 | ECPubKey.fromHex = function(hex) { | |
13131 | return ECPubKey.fromBuffer(new Buffer(hex, 'hex')) | |
13132 | } | |
13133 | ||
13134 | // Operations | |
13135 | ECPubKey.prototype.getAddress = function(network) { | |
13136 | network = network || networks.bitcoin | |
13137 | ||
13138 | return new Address(crypto.hash160(this.toBuffer()), network.pubKeyHash) | |
13139 | } | |
13140 | ||
13141 | ECPubKey.prototype.verify = function(hash, signature) { | |
13142 | return ecdsa.verify(curve, hash, signature, this.Q) | |
13143 | } | |
13144 | ||
13145 | // Export functions | |
13146 | ECPubKey.prototype.toBuffer = function() { | |
13147 | return this.Q.getEncoded(this.compressed) | |
13148 | } | |
13149 | ||
13150 | ECPubKey.prototype.toHex = function() { | |
13151 | return this.toBuffer().toString('hex') | |
13152 | } | |
13153 | ||
13154 | module.exports = ECPubKey | |
13155 | ||
13156 | }).call(this,_dereq_("buffer").Buffer) | |
13157 | },{"./address":69,"./crypto":73,"./ecdsa":74,"./networks":81,"assert":4,"buffer":8,"ecurve":65}],77:[function(_dereq_,module,exports){ | |
13158 | (function (Buffer){ | |
13159 | var assert = _dereq_('assert') | |
13160 | var BigInteger = _dereq_('bigi') | |
13161 | ||
13162 | function ECSignature(r, s) { | |
13163 | assert(r instanceof BigInteger, 'Expected BigInteger, got ' + r) | |
13164 | assert(s instanceof BigInteger, 'Expected BigInteger, got ' + s) | |
13165 | this.r = r | |
13166 | this.s = s | |
13167 | } | |
13168 | ||
13169 | // Import operations | |
13170 | ECSignature.parseCompact = function(buffer) { | |
13171 | assert.equal(buffer.length, 65, 'Invalid signature length') | |
13172 | var i = buffer.readUInt8(0) - 27 | |
13173 | ||
13174 | // At most 3 bits | |
13175 | assert.equal(i, i & 7, 'Invalid signature parameter') | |
13176 | var compressed = !!(i & 4) | |
13177 | ||
13178 | // Recovery param only | |
13179 | i = i & 3 | |
13180 | ||
13181 | var r = BigInteger.fromBuffer(buffer.slice(1, 33)) | |
13182 | var s = BigInteger.fromBuffer(buffer.slice(33)) | |
13183 | ||
13184 | return { | |
13185 | compressed: compressed, | |
13186 | i: i, | |
13187 | signature: new ECSignature(r, s) | |
13188 | } | |
13189 | } | |
13190 | ||
13191 | ECSignature.fromDER = function(buffer) { | |
13192 | assert.equal(buffer.readUInt8(0), 0x30, 'Not a DER sequence') | |
13193 | assert.equal(buffer.readUInt8(1), buffer.length - 2, 'Invalid sequence length') | |
13194 | assert.equal(buffer.readUInt8(2), 0x02, 'Expected a DER integer') | |
13195 | ||
13196 | var rLen = buffer.readUInt8(3) | |
13197 | assert(rLen > 0, 'R length is zero') | |
13198 | ||
13199 | var offset = 4 + rLen | |
13200 | assert.equal(buffer.readUInt8(offset), 0x02, 'Expected a DER integer (2)') | |
13201 | ||
13202 | var sLen = buffer.readUInt8(offset + 1) | |
13203 | assert(sLen > 0, 'S length is zero') | |
13204 | ||
13205 | var rB = buffer.slice(4, offset) | |
13206 | var sB = buffer.slice(offset + 2) | |
13207 | offset += 2 + sLen | |
13208 | ||
13209 | if (rLen > 1 && rB.readUInt8(0) === 0x00) { | |
13210 | assert(rB.readUInt8(1) & 0x80, 'R value excessively padded') | |
13211 | } | |
13212 | ||
13213 | if (sLen > 1 && sB.readUInt8(0) === 0x00) { | |
13214 | assert(sB.readUInt8(1) & 0x80, 'S value excessively padded') | |
13215 | } | |
13216 | ||
13217 | assert.equal(offset, buffer.length, 'Invalid DER encoding') | |
13218 | var r = BigInteger.fromDERInteger(rB) | |
13219 | var s = BigInteger.fromDERInteger(sB) | |
13220 | ||
13221 | assert(r.signum() >= 0, 'R value is negative') | |
13222 | assert(s.signum() >= 0, 'S value is negative') | |
13223 | ||
13224 | return new ECSignature(r, s) | |
13225 | } | |
13226 | ||
13227 | // FIXME: 0x00, 0x04, 0x80 are SIGHASH_* boundary constants, importing Transaction causes a circular dependency | |
13228 | ECSignature.parseScriptSignature = function(buffer) { | |
13229 | var hashType = buffer.readUInt8(buffer.length - 1) | |
13230 | var hashTypeMod = hashType & ~0x80 | |
13231 | ||
13232 | assert(hashTypeMod > 0x00 && hashTypeMod < 0x04, 'Invalid hashType') | |
13233 | ||
13234 | return { | |
13235 | signature: ECSignature.fromDER(buffer.slice(0, -1)), | |
13236 | hashType: hashType | |
13237 | } | |
13238 | } | |
13239 | ||
13240 | // Export operations | |
13241 | ECSignature.prototype.toCompact = function(i, compressed) { | |
13242 | if (compressed) i += 4 | |
13243 | i += 27 | |
13244 | ||
13245 | var buffer = new Buffer(65) | |
13246 | buffer.writeUInt8(i, 0) | |
13247 | ||
13248 | this.r.toBuffer(32).copy(buffer, 1) | |
13249 | this.s.toBuffer(32).copy(buffer, 33) | |
13250 | ||
13251 | return buffer | |
13252 | } | |
13253 | ||
13254 | ECSignature.prototype.toDER = function() { | |
13255 | var rBa = this.r.toDERInteger() | |
13256 | var sBa = this.s.toDERInteger() | |
13257 | ||
13258 | var sequence = [] | |
13259 | sequence.push(0x02) // INTEGER | |
13260 | sequence.push(rBa.length) | |
13261 | sequence = sequence.concat(rBa) | |
13262 | ||
13263 | sequence.push(0x02) // INTEGER | |
13264 | sequence.push(sBa.length) | |
13265 | sequence = sequence.concat(sBa) | |
13266 | ||
13267 | sequence.unshift(sequence.length) | |
13268 | sequence.unshift(0x30) // SEQUENCE | |
13269 | ||
13270 | return new Buffer(sequence) | |
13271 | } | |
13272 | ||
13273 | ECSignature.prototype.toScriptSignature = function(hashType) { | |
13274 | var hashTypeBuffer = new Buffer(1) | |
13275 | hashTypeBuffer.writeUInt8(hashType, 0) | |
13276 | ||
13277 | return Buffer.concat([this.toDER(), hashTypeBuffer]) | |
13278 | } | |
13279 | ||
13280 | module.exports = ECSignature | |
13281 | ||
13282 | }).call(this,_dereq_("buffer").Buffer) | |
13283 | },{"assert":4,"bigi":3,"buffer":8}],78:[function(_dereq_,module,exports){ | |
13284 | (function (Buffer){ | |
13285 | var assert = _dereq_('assert') | |
13286 | var base58check = _dereq_('./base58check') | |
13287 | var crypto = _dereq_('./crypto') | |
13288 | var networks = _dereq_('./networks') | |
13289 | ||
13290 | var BigInteger = _dereq_('bigi') | |
13291 | var ECKey = _dereq_('./eckey') | |
13292 | var ECPubKey = _dereq_('./ecpubkey') | |
13293 | ||
13294 | var ecurve = _dereq_('ecurve') | |
13295 | var curve = ecurve.getCurveByName('secp256k1') | |
13296 | ||
13297 | function findBIP32ParamsByVersion(version) { | |
13298 | for (var name in networks) { | |
13299 | var network = networks[name] | |
13300 | ||
13301 | for (var type in network.bip32) { | |
13302 | if (version != network.bip32[type]) continue | |
13303 | ||
13304 | return { | |
13305 | isPrivate: (type === 'private'), | |
13306 | network: network | |
13307 | } | |
13308 | } | |
13309 | } | |
13310 | ||
13311 | assert(false, 'Could not find version ' + version.toString(16)) | |
13312 | } | |
13313 | ||
13314 | function HDNode(K, chainCode, network) { | |
13315 | network = network || networks.bitcoin | |
13316 | ||
13317 | assert(Buffer.isBuffer(chainCode), 'Expected Buffer, got ' + chainCode) | |
13318 | assert(network.bip32, 'Unknown BIP32 constants for network') | |
13319 | ||
13320 | this.chainCode = chainCode | |
13321 | this.depth = 0 | |
13322 | this.index = 0 | |
13323 | this.network = network | |
13324 | ||
13325 | if (K instanceof BigInteger) { | |
13326 | this.privKey = new ECKey(K, true) | |
13327 | this.pubKey = this.privKey.pub | |
13328 | } else { | |
13329 | this.pubKey = new ECPubKey(K, true) | |
13330 | } | |
13331 | } | |
13332 | ||
13333 | HDNode.MASTER_SECRET = new Buffer('Bitcoin seed') | |
13334 | HDNode.HIGHEST_BIT = 0x80000000 | |
13335 | HDNode.LENGTH = 78 | |
13336 | ||
13337 | HDNode.fromSeedBuffer = function(seed, network) { | |
13338 | var I = crypto.HmacSHA512(seed, HDNode.MASTER_SECRET) | |
13339 | var IL = I.slice(0, 32) | |
13340 | var IR = I.slice(32) | |
13341 | ||
13342 | // In case IL is 0 or >= n, the master key is invalid | |
13343 | // This is handled by `new ECKey` in the HDNode constructor | |
13344 | var pIL = BigInteger.fromBuffer(IL) | |
13345 | ||
13346 | return new HDNode(pIL, IR, network) | |
13347 | } | |
13348 | ||
13349 | HDNode.fromSeedHex = function(hex, network) { | |
13350 | return HDNode.fromSeedBuffer(new Buffer(hex, 'hex'), network) | |
13351 | } | |
13352 | ||
13353 | HDNode.fromBase58 = function(string) { | |
13354 | return HDNode.fromBuffer(base58check.decode(string)) | |
13355 | } | |
13356 | ||
13357 | HDNode.fromBuffer = function(buffer) { | |
13358 | assert.strictEqual(buffer.length, HDNode.LENGTH, 'Invalid buffer length') | |
13359 | ||
13360 | // 4 byte: version bytes | |
13361 | var version = buffer.readUInt32BE(0) | |
13362 | var params = findBIP32ParamsByVersion(version) | |
13363 | ||
13364 | // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ... | |
13365 | var depth = buffer.readUInt8(4) | |
13366 | ||
13367 | // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key) | |
13368 | var parentFingerprint = buffer.readUInt32BE(5) | |
13369 | if (depth === 0) { | |
13370 | assert.strictEqual(parentFingerprint, 0x00000000, 'Invalid parent fingerprint') | |
13371 | } | |
13372 | ||
13373 | // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized. | |
13374 | // This is encoded in MSB order. (0x00000000 if master key) | |
13375 | var index = buffer.readUInt32BE(9) | |
13376 | assert(depth > 0 || index === 0, 'Invalid index') | |
13377 | ||
13378 | // 32 bytes: the chain code | |
13379 | var chainCode = buffer.slice(13, 45) | |
13380 | var hd | |
13381 | ||
13382 | // 33 bytes: private key data (0x00 + k) | |
13383 | if (params.isPrivate) { | |
13384 | assert.strictEqual(buffer.readUInt8(45), 0x00, 'Invalid private key') | |
13385 | var data = buffer.slice(46, 78) | |
13386 | var d = BigInteger.fromBuffer(data) | |
13387 | hd = new HDNode(d, chainCode, params.network) | |
13388 | ||
13389 | // 33 bytes: public key data (0x02 + X or 0x03 + X) | |
13390 | } else { | |
13391 | var data = buffer.slice(45, 78) | |
13392 | var Q = ecurve.Point.decodeFrom(curve, data) | |
13393 | assert.equal(Q.compressed, true, 'Invalid public key') | |
13394 | ||
13395 | // Verify that the X coordinate in the public point corresponds to a point on the curve. | |
13396 | // If not, the extended public key is invalid. | |
13397 | curve.validate(Q) | |
13398 | ||
13399 | hd = new HDNode(Q, chainCode, params.network) | |
13400 | } | |
13401 | ||
13402 | hd.depth = depth | |
13403 | hd.index = index | |
13404 | hd.parentFingerprint = parentFingerprint | |
13405 | ||
13406 | return hd | |
13407 | } | |
13408 | ||
13409 | HDNode.fromHex = function(hex) { | |
13410 | return HDNode.fromBuffer(new Buffer(hex, 'hex')) | |
13411 | } | |
13412 | ||
13413 | HDNode.prototype.getIdentifier = function() { | |
13414 | return crypto.hash160(this.pubKey.toBuffer()) | |
13415 | } | |
13416 | ||
13417 | HDNode.prototype.getFingerprint = function() { | |
13418 | return this.getIdentifier().slice(0, 4) | |
13419 | } | |
13420 | ||
13421 | HDNode.prototype.getAddress = function() { | |
13422 | return this.pubKey.getAddress(this.network) | |
13423 | } | |
13424 | ||
13425 | HDNode.prototype.toBase58 = function(isPrivate) { | |
13426 | return base58check.encode(this.toBuffer(isPrivate)) | |
13427 | } | |
13428 | ||
13429 | HDNode.prototype.toBuffer = function(isPrivate) { | |
13430 | if (isPrivate == undefined) isPrivate = !!this.privKey | |
13431 | ||
13432 | // Version | |
13433 | var version = isPrivate ? this.network.bip32.private : this.network.bip32.public | |
13434 | var buffer = new Buffer(HDNode.LENGTH) | |
13435 | ||
13436 | // 4 bytes: version bytes | |
13437 | buffer.writeUInt32BE(version, 0) | |
13438 | ||
13439 | // Depth | |
13440 | // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, .... | |
13441 | buffer.writeUInt8(this.depth, 4) | |
13442 | ||
13443 | // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key) | |
13444 | var fingerprint = (this.depth === 0) ? 0x00000000 : this.parentFingerprint | |
13445 | buffer.writeUInt32BE(fingerprint, 5) | |
13446 | ||
13447 | // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized. | |
13448 | // This is encoded in Big endian. (0x00000000 if master key) | |
13449 | buffer.writeUInt32BE(this.index, 9) | |
13450 | ||
13451 | // 32 bytes: the chain code | |
13452 | this.chainCode.copy(buffer, 13) | |
13453 | ||
13454 | // 33 bytes: the public key or private key data | |
13455 | if (isPrivate) { | |
13456 | assert(this.privKey, 'Missing private key') | |
13457 | ||
13458 | // 0x00 + k for private keys | |
13459 | buffer.writeUInt8(0, 45) | |
13460 | this.privKey.d.toBuffer(32).copy(buffer, 46) | |
13461 | } else { | |
13462 | ||
13463 | // X9.62 encoding for public keys | |
13464 | this.pubKey.toBuffer().copy(buffer, 45) | |
13465 | } | |
13466 | ||
13467 | return buffer | |
13468 | } | |
13469 | ||
13470 | HDNode.prototype.toHex = function(isPrivate) { | |
13471 | return this.toBuffer(isPrivate).toString('hex') | |
13472 | } | |
13473 | ||
13474 | // https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#child-key-derivation-ckd-functions | |
13475 | HDNode.prototype.derive = function(index) { | |
13476 | var isHardened = index >= HDNode.HIGHEST_BIT | |
13477 | var indexBuffer = new Buffer(4) | |
13478 | indexBuffer.writeUInt32BE(index, 0) | |
13479 | ||
13480 | var data | |
13481 | ||
13482 | // Hardened child | |
13483 | if (isHardened) { | |
13484 | assert(this.privKey, 'Could not derive hardened child key') | |
13485 | ||
13486 | // data = 0x00 || ser256(kpar) || ser32(index) | |
13487 | data = Buffer.concat([ | |
13488 | this.privKey.d.toBuffer(33), | |
13489 | indexBuffer | |
13490 | ]) | |
13491 | ||
13492 | // Normal child | |
13493 | } else { | |
13494 | // data = serP(point(kpar)) || ser32(index) | |
13495 | // = serP(Kpar) || ser32(index) | |
13496 | data = Buffer.concat([ | |
13497 | this.pubKey.toBuffer(), | |
13498 | indexBuffer | |
13499 | ]) | |
13500 | } | |
13501 | ||
13502 | var I = crypto.HmacSHA512(data, this.chainCode) | |
13503 | var IL = I.slice(0, 32) | |
13504 | var IR = I.slice(32) | |
13505 | ||
13506 | var pIL = BigInteger.fromBuffer(IL) | |
13507 | ||
13508 | // In case parse256(IL) >= n, proceed with the next value for i | |
13509 | if (pIL.compareTo(curve.n) >= 0) { | |
13510 | return this.derive(index + 1) | |
13511 | } | |
13512 | ||
13513 | // Private parent key -> private child key | |
13514 | var hd | |
13515 | if (this.privKey) { | |
13516 | // ki = parse256(IL) + kpar (mod n) | |
13517 | var ki = pIL.add(this.privKey.d).mod(curve.n) | |
13518 | ||
13519 | // In case ki == 0, proceed with the next value for i | |
13520 | if (ki.signum() === 0) { | |
13521 | return this.derive(index + 1) | |
13522 | } | |
13523 | ||
13524 | hd = new HDNode(ki, IR, this.network) | |
13525 | ||
13526 | // Public parent key -> public child key | |
13527 | } else { | |
13528 | // Ki = point(parse256(IL)) + Kpar | |
13529 | // = G*IL + Kpar | |
13530 | var Ki = curve.G.multiply(pIL).add(this.pubKey.Q) | |
13531 | ||
13532 | // In case Ki is the point at infinity, proceed with the next value for i | |
13533 | if (curve.isInfinity(Ki)) { | |
13534 | return this.derive(index + 1) | |
13535 | } | |
13536 | ||
13537 | hd = new HDNode(Ki, IR, this.network) | |
13538 | } | |
13539 | ||
13540 | hd.depth = this.depth + 1 | |
13541 | hd.index = index | |
13542 | hd.parentFingerprint = this.getFingerprint().readUInt32BE(0) | |
13543 | ||
13544 | return hd | |
13545 | } | |
13546 | ||
13547 | HDNode.prototype.deriveHardened = function(index) { | |
13548 | // Only derives hardened private keys by default | |
13549 | return this.derive(index + HDNode.HIGHEST_BIT) | |
13550 | } | |
13551 | ||
13552 | HDNode.prototype.toString = HDNode.prototype.toBase58 | |
13553 | ||
13554 | module.exports = HDNode | |
13555 | ||
13556 | }).call(this,_dereq_("buffer").Buffer) | |
13557 | },{"./base58check":70,"./crypto":73,"./eckey":75,"./ecpubkey":76,"./networks":81,"assert":4,"bigi":3,"buffer":8,"ecurve":65}],79:[function(_dereq_,module,exports){ | |
13558 | module.exports = { | |
13559 | Address: _dereq_('./address'), | |
13560 | base58check: _dereq_('./base58check'), | |
13561 | bufferutils: _dereq_('./bufferutils'), | |
13562 | convert: _dereq_('./convert'), | |
13563 | crypto: _dereq_('./crypto'), | |
13564 | ecdsa: _dereq_('./ecdsa'), | |
13565 | ECKey: _dereq_('./eckey'), | |
13566 | ECPubKey: _dereq_('./ecpubkey'), | |
13567 | ECSignature: _dereq_('./ecsignature'), | |
13568 | Message: _dereq_('./message'), | |
13569 | opcodes: _dereq_('./opcodes'), | |
13570 | HDNode: _dereq_('./hdnode'), | |
13571 | Script: _dereq_('./script'), | |
13572 | scripts: _dereq_('./scripts'), | |
13573 | Transaction: _dereq_('./transaction'), | |
13574 | networks: _dereq_('./networks'), | |
13575 | Wallet: _dereq_('./wallet') | |
13576 | } | |
13577 | ||
13578 | },{"./address":69,"./base58check":70,"./bufferutils":71,"./convert":72,"./crypto":73,"./ecdsa":74,"./eckey":75,"./ecpubkey":76,"./ecsignature":77,"./hdnode":78,"./message":80,"./networks":81,"./opcodes":82,"./script":83,"./scripts":84,"./transaction":85,"./wallet":86}],80:[function(_dereq_,module,exports){ | |
13579 | (function (Buffer){ | |
13580 | /// Implements Bitcoin's feature for signing arbitrary messages. | |
13581 | var Address = _dereq_('./address') | |
13582 | var BigInteger = _dereq_('bigi') | |
13583 | var bufferutils = _dereq_('./bufferutils') | |
13584 | var crypto = _dereq_('./crypto') | |
13585 | var ecdsa = _dereq_('./ecdsa') | |
13586 | var networks = _dereq_('./networks') | |
13587 | ||
13588 | var Address = _dereq_('./address') | |
13589 | var ECPubKey = _dereq_('./ecpubkey') | |
13590 | var ECSignature = _dereq_('./ecsignature') | |
13591 | ||
13592 | var ecurve = _dereq_('ecurve') | |
13593 | var ecparams = ecurve.getCurveByName('secp256k1') | |
13594 | ||
13595 | function magicHash(message, network) { | |
13596 | var magicPrefix = new Buffer(network.magicPrefix) | |
13597 | var messageBuffer = new Buffer(message) | |
13598 | var lengthBuffer = new Buffer(bufferutils.varIntSize(messageBuffer.length)) | |
13599 | bufferutils.writeVarInt(lengthBuffer, messageBuffer.length, 0) | |
13600 | ||
13601 | var buffer = Buffer.concat([magicPrefix, lengthBuffer, messageBuffer]) | |
13602 | return crypto.hash256(buffer) | |
13603 | } | |
13604 | ||
13605 | function sign(privKey, message, network) { | |
13606 | network = network || networks.bitcoin | |
13607 | ||
13608 | var hash = magicHash(message, network) | |
13609 | var signature = privKey.sign(hash) | |
13610 | var e = BigInteger.fromBuffer(hash) | |
13611 | var i = ecdsa.calcPubKeyRecoveryParam(ecparams, e, signature, privKey.pub.Q) | |
13612 | ||
13613 | return signature.toCompact(i, privKey.pub.compressed) | |
13614 | } | |
13615 | ||
13616 | // TODO: network could be implied from address | |
13617 | function verify(address, signatureBuffer, message, network) { | |
13618 | if (address instanceof Address) { | |
13619 | address = address.toString() | |
13620 | } | |
13621 | network = network || networks.bitcoin | |
13622 | ||
13623 | var hash = magicHash(message, network) | |
13624 | var parsed = ECSignature.parseCompact(signatureBuffer) | |
13625 | var e = BigInteger.fromBuffer(hash) | |
13626 | var Q = ecdsa.recoverPubKey(ecparams, e, parsed.signature, parsed.i) | |
13627 | ||
13628 | var pubKey = new ECPubKey(Q, parsed.compressed) | |
13629 | return pubKey.getAddress(network).toString() === address | |
13630 | } | |
13631 | ||
13632 | module.exports = { | |
13633 | magicHash: magicHash, | |
13634 | sign: sign, | |
13635 | verify: verify | |
13636 | } | |
13637 | ||
13638 | }).call(this,_dereq_("buffer").Buffer) | |
13639 | },{"./address":69,"./bufferutils":71,"./crypto":73,"./ecdsa":74,"./ecpubkey":76,"./ecsignature":77,"./networks":81,"bigi":3,"buffer":8,"ecurve":65}],81:[function(_dereq_,module,exports){ | |
13640 | // https://en.bitcoin.it/wiki/List_of_address_prefixes | |
13641 | // Dogecoin BIP32 is a proposed standard: https://bitcointalk.org/index.php?topic=409731 | |
13642 | ||
13643 | var networks = { | |
13644 | bitcoin: { | |
13645 | magicPrefix: '\x18Bitcoin Signed Message:\n', | |
13646 | bip32: { | |
13647 | public: 0x0488b21e, | |
13648 | private: 0x0488ade4 | |
13649 | }, | |
13650 | pubKeyHash: 0x00, | |
13651 | scriptHash: 0x05, | |
13652 | wif: 0x80, | |
13653 | dustThreshold: 546, // https://github.com/bitcoin/bitcoin/blob/v0.9.2/src/core.h#L151-L162 | |
13654 | feePerKb: 10000, // https://github.com/bitcoin/bitcoin/blob/v0.9.2/src/main.cpp#L53 | |
13655 | estimateFee: estimateFee('bitcoin') | |
13656 | }, | |
13657 | dogecoin: { | |
13658 | magicPrefix: '\x19Dogecoin Signed Message:\n', | |
13659 | bip32: { | |
13660 | public: 0x02facafd, | |
13661 | private: 0x02fac398 | |
13662 | }, | |
13663 | pubKeyHash: 0x1e, | |
13664 | scriptHash: 0x16, | |
13665 | wif: 0x9e, | |
13666 | dustThreshold: 0, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/core.h#L155-L160 | |
13667 | dustSoftThreshold: 100000000, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/main.h#L62 | |
13668 | feePerKb: 100000000, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/main.cpp#L58 | |
13669 | estimateFee: estimateFee('dogecoin') | |
13670 | }, | |
13671 | litecoin: { | |
13672 | magicPrefix: '\x19Litecoin Signed Message:\n', | |
13673 | bip32: { | |
13674 | public: 0x019da462, | |
13675 | private: 0x019d9cfe | |
13676 | }, | |
13677 | pubKeyHash: 0x30, | |
13678 | scriptHash: 0x05, | |
13679 | wif: 0xb0, | |
13680 | dustThreshold: 0, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L360-L365 | |
13681 | dustSoftThreshold: 100000, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.h#L53 | |
13682 | feePerKb: 100000, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L56 | |
13683 | estimateFee: estimateFee('litecoin') | |
13684 | }, | |
13685 | testnet: { | |
13686 | magicPrefix: '\x18Bitcoin Signed Message:\n', | |
13687 | bip32: { | |
13688 | public: 0x043587cf, | |
13689 | private: 0x04358394 | |
13690 | }, | |
13691 | pubKeyHash: 0x6f, | |
13692 | scriptHash: 0xc4, | |
13693 | wif: 0xef, | |
13694 | dustThreshold: 546, | |
13695 | feePerKb: 10000, | |
13696 | estimateFee: estimateFee('testnet') | |
13697 | } | |
13698 | } | |
13699 | ||
13700 | function estimateFee(type) { | |
13701 | return function(tx) { | |
13702 | var network = networks[type] | |
13703 | var baseFee = network.feePerKb | |
13704 | var byteSize = tx.toBuffer().length | |
13705 | ||
13706 | var fee = baseFee * Math.ceil(byteSize / 1000) | |
13707 | if (network.dustSoftThreshold == undefined) return fee | |
13708 | ||
13709 | tx.outs.forEach(function(e){ | |
13710 | if (e.value < network.dustSoftThreshold) { | |
13711 | fee += baseFee | |
13712 | } | |
13713 | }) | |
13714 | ||
13715 | return fee | |
13716 | } | |
13717 | } | |
13718 | ||
13719 | module.exports = networks | |
13720 | ||
13721 | },{}],82:[function(_dereq_,module,exports){ | |
13722 | module.exports = { | |
13723 | // push value | |
13724 | OP_FALSE : 0, | |
13725 | OP_0 : 0, | |
13726 | OP_PUSHDATA1 : 76, | |
13727 | OP_PUSHDATA2 : 77, | |
13728 | OP_PUSHDATA4 : 78, | |
13729 | OP_1NEGATE : 79, | |
13730 | OP_RESERVED : 80, | |
13731 | OP_1 : 81, | |
13732 | OP_TRUE : 81, | |
13733 | OP_2 : 82, | |
13734 | OP_3 : 83, | |
13735 | OP_4 : 84, | |
13736 | OP_5 : 85, | |
13737 | OP_6 : 86, | |
13738 | OP_7 : 87, | |
13739 | OP_8 : 88, | |
13740 | OP_9 : 89, | |
13741 | OP_10 : 90, | |
13742 | OP_11 : 91, | |
13743 | OP_12 : 92, | |
13744 | OP_13 : 93, | |
13745 | OP_14 : 94, | |
13746 | OP_15 : 95, | |
13747 | OP_16 : 96, | |
13748 | ||
13749 | // control | |
13750 | OP_NOP : 97, | |
13751 | OP_VER : 98, | |
13752 | OP_IF : 99, | |
13753 | OP_NOTIF : 100, | |
13754 | OP_VERIF : 101, | |
13755 | OP_VERNOTIF : 102, | |
13756 | OP_ELSE : 103, | |
13757 | OP_ENDIF : 104, | |
13758 | OP_VERIFY : 105, | |
13759 | OP_RETURN : 106, | |
13760 | ||
13761 | // stack ops | |
13762 | OP_TOALTSTACK : 107, | |
13763 | OP_FROMALTSTACK : 108, | |
13764 | OP_2DROP : 109, | |
13765 | OP_2DUP : 110, | |
13766 | OP_3DUP : 111, | |
13767 | OP_2OVER : 112, | |
13768 | OP_2ROT : 113, | |
13769 | OP_2SWAP : 114, | |
13770 | OP_IFDUP : 115, | |
13771 | OP_DEPTH : 116, | |
13772 | OP_DROP : 117, | |
13773 | OP_DUP : 118, | |
13774 | OP_NIP : 119, | |
13775 | OP_OVER : 120, | |
13776 | OP_PICK : 121, | |
13777 | OP_ROLL : 122, | |
13778 | OP_ROT : 123, | |
13779 | OP_SWAP : 124, | |
13780 | OP_TUCK : 125, | |
13781 | ||
13782 | // splice ops | |
13783 | OP_CAT : 126, | |
13784 | OP_SUBSTR : 127, | |
13785 | OP_LEFT : 128, | |
13786 | OP_RIGHT : 129, | |
13787 | OP_SIZE : 130, | |
13788 | ||
13789 | // bit logic | |
13790 | OP_INVERT : 131, | |
13791 | OP_AND : 132, | |
13792 | OP_OR : 133, | |
13793 | OP_XOR : 134, | |
13794 | OP_EQUAL : 135, | |
13795 | OP_EQUALVERIFY : 136, | |
13796 | OP_RESERVED1 : 137, | |
13797 | OP_RESERVED2 : 138, | |
13798 | ||
13799 | // numeric | |
13800 | OP_1ADD : 139, | |
13801 | OP_1SUB : 140, | |
13802 | OP_2MUL : 141, | |
13803 | OP_2DIV : 142, | |
13804 | OP_NEGATE : 143, | |
13805 | OP_ABS : 144, | |
13806 | OP_NOT : 145, | |
13807 | OP_0NOTEQUAL : 146, | |
13808 | ||
13809 | OP_ADD : 147, | |
13810 | OP_SUB : 148, | |
13811 | OP_MUL : 149, | |
13812 | OP_DIV : 150, | |
13813 | OP_MOD : 151, | |
13814 | OP_LSHIFT : 152, | |
13815 | OP_RSHIFT : 153, | |
13816 | ||
13817 | OP_BOOLAND : 154, | |
13818 | OP_BOOLOR : 155, | |
13819 | OP_NUMEQUAL : 156, | |
13820 | OP_NUMEQUALVERIFY : 157, | |
13821 | OP_NUMNOTEQUAL : 158, | |
13822 | OP_LESSTHAN : 159, | |
13823 | OP_GREATERTHAN : 160, | |
13824 | OP_LESSTHANOREQUAL : 161, | |
13825 | OP_GREATERTHANOREQUAL : 162, | |
13826 | OP_MIN : 163, | |
13827 | OP_MAX : 164, | |
13828 | ||
13829 | OP_WITHIN : 165, | |
13830 | ||
13831 | // crypto | |
13832 | OP_RIPEMD160 : 166, | |
13833 | OP_SHA1 : 167, | |
13834 | OP_SHA256 : 168, | |
13835 | OP_HASH160 : 169, | |
13836 | OP_HASH256 : 170, | |
13837 | OP_CODESEPARATOR : 171, | |
13838 | OP_CHECKSIG : 172, | |
13839 | OP_CHECKSIGVERIFY : 173, | |
13840 | OP_CHECKMULTISIG : 174, | |
13841 | OP_CHECKMULTISIGVERIFY : 175, | |
13842 | ||
13843 | // expansion | |
13844 | OP_NOP1 : 176, | |
13845 | OP_NOP2 : 177, | |
13846 | OP_NOP3 : 178, | |
13847 | OP_NOP4 : 179, | |
13848 | OP_NOP5 : 180, | |
13849 | OP_NOP6 : 181, | |
13850 | OP_NOP7 : 182, | |
13851 | OP_NOP8 : 183, | |
13852 | OP_NOP9 : 184, | |
13853 | OP_NOP10 : 185, | |
13854 | ||
13855 | // template matching params | |
13856 | OP_PUBKEYHASH : 253, | |
13857 | OP_PUBKEY : 254, | |
13858 | OP_INVALIDOPCODE : 255 | |
13859 | } | |
13860 | ||
13861 | },{}],83:[function(_dereq_,module,exports){ | |
13862 | (function (Buffer){ | |
13863 | var assert = _dereq_('assert') | |
13864 | var bufferutils = _dereq_('./bufferutils') | |
13865 | var crypto = _dereq_('./crypto') | |
13866 | var opcodes = _dereq_('./opcodes') | |
13867 | ||
13868 | function Script(buffer, chunks) { | |
13869 | assert(Buffer.isBuffer(buffer), 'Expected Buffer, got ' + buffer) | |
13870 | assert(Array.isArray(chunks), 'Expected Array, got ' + chunks) | |
13871 | ||
13872 | this.buffer = buffer | |
13873 | this.chunks = chunks | |
13874 | } | |
13875 | ||
13876 | // Import operations | |
13877 | Script.fromASM = function(asm) { | |
13878 | var strChunks = asm.split(' ') | |
13879 | ||
13880 | var chunks = strChunks.map(function(strChunk) { | |
13881 | if (strChunk in opcodes) { | |
13882 | return opcodes[strChunk] | |
13883 | ||
13884 | } else { | |
13885 | return new Buffer(strChunk, 'hex') | |
13886 | } | |
13887 | }) | |
13888 | ||
13889 | return Script.fromChunks(chunks) | |
13890 | } | |
13891 | ||
13892 | Script.fromBuffer = function(buffer) { | |
13893 | var chunks = [] | |
13894 | ||
13895 | var i = 0 | |
13896 | ||
13897 | while (i < buffer.length) { | |
13898 | var opcode = buffer.readUInt8(i) | |
13899 | ||
13900 | if ((opcode > opcodes.OP_0) && (opcode <= opcodes.OP_PUSHDATA4)) { | |
13901 | var d = bufferutils.readPushDataInt(buffer, i) | |
13902 | i += d.size | |
13903 | ||
13904 | var data = buffer.slice(i, i + d.number) | |
13905 | i += d.number | |
13906 | ||
13907 | chunks.push(data) | |
13908 | ||
13909 | } else { | |
13910 | chunks.push(opcode) | |
13911 | ||
13912 | i += 1 | |
13913 | } | |
13914 | } | |
13915 | ||
13916 | return new Script(buffer, chunks) | |
13917 | } | |
13918 | ||
13919 | Script.fromChunks = function(chunks) { | |
13920 | assert(Array.isArray(chunks), 'Expected Array, got ' + chunks) | |
13921 | ||
13922 | var bufferSize = chunks.reduce(function(accum, chunk) { | |
13923 | if (Buffer.isBuffer(chunk)) { | |
13924 | return accum + bufferutils.pushDataSize(chunk.length) + chunk.length | |
13925 | } | |
13926 | ||
13927 | return accum + 1 | |
13928 | }, 0.0) | |
13929 | ||
13930 | var buffer = new Buffer(bufferSize) | |
13931 | var offset = 0 | |
13932 | ||
13933 | chunks.forEach(function(chunk) { | |
13934 | if (Buffer.isBuffer(chunk)) { | |
13935 | offset += bufferutils.writePushDataInt(buffer, chunk.length, offset) | |
13936 | ||
13937 | chunk.copy(buffer, offset) | |
13938 | offset += chunk.length | |
13939 | ||
13940 | } else { | |
13941 | buffer.writeUInt8(chunk, offset) | |
13942 | offset += 1 | |
13943 | } | |
13944 | }) | |
13945 | ||
13946 | assert.equal(offset, buffer.length, 'Could not decode chunks') | |
13947 | return new Script(buffer, chunks) | |
13948 | } | |
13949 | ||
13950 | Script.fromHex = function(hex) { | |
13951 | return Script.fromBuffer(new Buffer(hex, 'hex')) | |
13952 | } | |
13953 | ||
13954 | // Constants | |
13955 | Script.EMPTY = Script.fromChunks([]) | |
13956 | ||
13957 | // Operations | |
13958 | Script.prototype.getHash = function() { | |
13959 | return crypto.hash160(this.buffer) | |
13960 | } | |
13961 | ||
13962 | // FIXME: doesn't work for data chunks, maybe time to use buffertools.compare... | |
13963 | Script.prototype.without = function(needle) { | |
13964 | return Script.fromChunks(this.chunks.filter(function(op) { | |
13965 | return op !== needle | |
13966 | })) | |
13967 | } | |
13968 | ||
13969 | // Export operations | |
13970 | var reverseOps = [] | |
13971 | for (var op in opcodes) { | |
13972 | var code = opcodes[op] | |
13973 | reverseOps[code] = op | |
13974 | } | |
13975 | ||
13976 | Script.prototype.toASM = function() { | |
13977 | return this.chunks.map(function(chunk) { | |
13978 | if (Buffer.isBuffer(chunk)) { | |
13979 | return chunk.toString('hex') | |
13980 | ||
13981 | } else { | |
13982 | return reverseOps[chunk] | |
13983 | } | |
13984 | }).join(' ') | |
13985 | } | |
13986 | ||
13987 | Script.prototype.toBuffer = function() { | |
13988 | return this.buffer | |
13989 | } | |
13990 | ||
13991 | Script.prototype.toHex = function() { | |
13992 | return this.toBuffer().toString('hex') | |
13993 | } | |
13994 | ||
13995 | module.exports = Script | |
13996 | ||
13997 | }).call(this,_dereq_("buffer").Buffer) | |
13998 | },{"./bufferutils":71,"./crypto":73,"./opcodes":82,"assert":4,"buffer":8}],84:[function(_dereq_,module,exports){ | |
13999 | (function (Buffer){ | |
14000 | var assert = _dereq_('assert') | |
14001 | var opcodes = _dereq_('./opcodes') | |
14002 | ||
14003 | // FIXME: use ECPubKey, currently the circular dependency breaks everything. | |
14004 | // | |
14005 | // Solutions: | |
14006 | // * Remove ECPubKey.getAddress | |
14007 | // - Minimal change, but likely unpopular | |
14008 | // * Move all script related functionality out of Address | |
14009 | // - Means a lot of changes to Transaction/Wallet | |
14010 | // * Ignore it (existing solution) | |
14011 | // * Some form of hackery with commonjs | |
14012 | // | |
14013 | var ecurve = _dereq_('ecurve') | |
14014 | var curve = ecurve.getCurveByName('secp256k1') | |
14015 | ||
14016 | var ECSignature = _dereq_('./ecsignature') | |
14017 | var Script = _dereq_('./script') | |
14018 | ||
14019 | function classifyOutput(script) { | |
14020 | assert(script instanceof Script, 'Expected Script, got ', script) | |
14021 | ||
14022 | if (isPubKeyHashOutput.call(script)) { | |
14023 | return 'pubkeyhash' | |
14024 | } else if (isScriptHashOutput.call(script)) { | |
14025 | return 'scripthash' | |
14026 | } else if (isMultisigOutput.call(script)) { | |
14027 | return 'multisig' | |
14028 | } else if (isPubKeyOutput.call(script)) { | |
14029 | return 'pubkey' | |
14030 | } else if (isNulldataOutput.call(script)) { | |
14031 | return 'nulldata' | |
14032 | } else { | |
14033 | return 'nonstandard' | |
14034 | } | |
14035 | } | |
14036 | ||
14037 | function classifyInput(script) { | |
14038 | assert(script instanceof Script, 'Expected Script, got ', script) | |
14039 | ||
14040 | if (isPubKeyHashInput.call(script)) { | |
14041 | return 'pubkeyhash' | |
14042 | } else if (isScriptHashInput.call(script)) { | |
14043 | return 'scripthash' | |
14044 | } else if (isMultisigInput.call(script)) { | |
14045 | return 'multisig' | |
14046 | } else if (isPubKeyInput.call(script)) { | |
14047 | return 'pubkey' | |
14048 | } else { | |
14049 | return 'nonstandard' | |
14050 | } | |
14051 | } | |
14052 | ||
14053 | function isCanonicalPubKey(buffer) { | |
14054 | if (!Buffer.isBuffer(buffer)) return false | |
14055 | ||
14056 | try { | |
14057 | // FIXME: boo | |
14058 | ecurve.Point.decodeFrom(curve, buffer) | |
14059 | } catch (e) { | |
14060 | if (!(e.message.match(/Invalid sequence (length|tag)/))) throw e | |
14061 | ||
14062 | return false | |
14063 | } | |
14064 | ||
14065 | return true | |
14066 | } | |
14067 | ||
14068 | function isCanonicalSignature(buffer) { | |
14069 | if (!Buffer.isBuffer(buffer)) return false | |
14070 | ||
14071 | try { | |
14072 | ECSignature.parseScriptSignature(buffer) | |
14073 | } catch(e) { | |
14074 | if (!(e.message.match(/Not a DER sequence|Invalid sequence length|Expected a DER integer|R length is zero|S length is zero|R value excessively padded|S value excessively padded|R value is negative|S value is negative|Invalid hashType/))) throw e | |
14075 | ||
14076 | return false | |
14077 | } | |
14078 | ||
14079 | return true | |
14080 | } | |
14081 | ||
14082 | function isPubKeyHashInput() { | |
14083 | return this.chunks.length === 2 && | |
14084 | isCanonicalSignature(this.chunks[0]) && | |
14085 | isCanonicalPubKey(this.chunks[1]) | |
14086 | } | |
14087 | ||
14088 | function isPubKeyHashOutput() { | |
14089 | return this.chunks.length === 5 && | |
14090 | this.chunks[0] === opcodes.OP_DUP && | |
14091 | this.chunks[1] === opcodes.OP_HASH160 && | |
14092 | Buffer.isBuffer(this.chunks[2]) && | |
14093 | this.chunks[2].length === 20 && | |
14094 | this.chunks[3] === opcodes.OP_EQUALVERIFY && | |
14095 | this.chunks[4] === opcodes.OP_CHECKSIG | |
14096 | } | |
14097 | ||
14098 | function isPubKeyInput() { | |
14099 | return this.chunks.length === 1 && | |
14100 | isCanonicalSignature(this.chunks[0]) | |
14101 | } | |
14102 | ||
14103 | function isPubKeyOutput() { | |
14104 | return this.chunks.length === 2 && | |
14105 | isCanonicalPubKey(this.chunks[0]) && | |
14106 | this.chunks[1] === opcodes.OP_CHECKSIG | |
14107 | } | |
14108 | ||
14109 | function isScriptHashInput() { | |
14110 | if (this.chunks.length < 2) return false | |
14111 | var lastChunk = this.chunks[this.chunks.length - 1] | |
14112 | ||
14113 | if (!Buffer.isBuffer(lastChunk)) return false | |
14114 | ||
14115 | var scriptSig = Script.fromChunks(this.chunks.slice(0, -1)) | |
14116 | var scriptPubKey = Script.fromBuffer(lastChunk) | |
14117 | ||
14118 | return classifyInput(scriptSig) === classifyOutput(scriptPubKey) | |
14119 | } | |
14120 | ||
14121 | function isScriptHashOutput() { | |
14122 | return this.chunks.length === 3 && | |
14123 | this.chunks[0] === opcodes.OP_HASH160 && | |
14124 | Buffer.isBuffer(this.chunks[1]) && | |
14125 | this.chunks[1].length === 20 && | |
14126 | this.chunks[2] === opcodes.OP_EQUAL | |
14127 | } | |
14128 | ||
14129 | function isMultisigInput() { | |
14130 | return this.chunks[0] === opcodes.OP_0 && | |
14131 | this.chunks.slice(1).every(isCanonicalSignature) | |
14132 | } | |
14133 | ||
14134 | function isMultisigOutput() { | |
14135 | if (this.chunks < 4) return false | |
14136 | if (this.chunks[this.chunks.length - 1] !== opcodes.OP_CHECKMULTISIG) return false | |
14137 | ||
14138 | var mOp = this.chunks[0] | |
14139 | if (mOp === opcodes.OP_0) return false | |
14140 | if (mOp < opcodes.OP_1) return false | |
14141 | if (mOp > opcodes.OP_16) return false | |
14142 | ||
14143 | var nOp = this.chunks[this.chunks.length - 2] | |
14144 | if (nOp === opcodes.OP_0) return false | |
14145 | if (nOp < opcodes.OP_1) return false | |
14146 | if (nOp > opcodes.OP_16) return false | |
14147 | ||
14148 | var m = mOp - (opcodes.OP_1 - 1) | |
14149 | var n = nOp - (opcodes.OP_1 - 1) | |
14150 | if (n < m) return false | |
14151 | ||
14152 | var pubKeys = this.chunks.slice(1, -2) | |
14153 | if (n < pubKeys.length) return false | |
14154 | ||
14155 | return pubKeys.every(isCanonicalPubKey) | |
14156 | } | |
14157 | ||
14158 | function isNulldataOutput() { | |
14159 | return this.chunks[0] === opcodes.OP_RETURN | |
14160 | } | |
14161 | ||
14162 | // Standard Script Templates | |
14163 | // {pubKey} OP_CHECKSIG | |
14164 | function pubKeyOutput(pubKey) { | |
14165 | return Script.fromChunks([ | |
14166 | pubKey.toBuffer(), | |
14167 | opcodes.OP_CHECKSIG | |
14168 | ]) | |
14169 | } | |
14170 | ||
14171 | // OP_DUP OP_HASH160 {pubKeyHash} OP_EQUALVERIFY OP_CHECKSIG | |
14172 | function pubKeyHashOutput(hash) { | |
14173 | assert(Buffer.isBuffer(hash), 'Expected Buffer, got ' + hash) | |
14174 | ||
14175 | return Script.fromChunks([ | |
14176 | opcodes.OP_DUP, | |
14177 | opcodes.OP_HASH160, | |
14178 | hash, | |
14179 | opcodes.OP_EQUALVERIFY, | |
14180 | opcodes.OP_CHECKSIG | |
14181 | ]) | |
14182 | } | |
14183 | ||
14184 | // OP_HASH160 {scriptHash} OP_EQUAL | |
14185 | function scriptHashOutput(hash) { | |
14186 | assert(Buffer.isBuffer(hash), 'Expected Buffer, got ' + hash) | |
14187 | ||
14188 | return Script.fromChunks([ | |
14189 | opcodes.OP_HASH160, | |
14190 | hash, | |
14191 | opcodes.OP_EQUAL | |
14192 | ]) | |
14193 | } | |
14194 | ||
14195 | // m [pubKeys ...] n OP_CHECKMULTISIG | |
14196 | function multisigOutput(m, pubKeys) { | |
14197 | assert(Array.isArray(pubKeys), 'Expected Array, got ' + pubKeys) | |
14198 | assert(pubKeys.length >= m, 'Not enough pubKeys provided') | |
14199 | ||
14200 | var pubKeyBuffers = pubKeys.map(function(pubKey) { | |
14201 | return pubKey.toBuffer() | |
14202 | }) | |
14203 | var n = pubKeys.length | |
14204 | ||
14205 | return Script.fromChunks([].concat( | |
14206 | (opcodes.OP_1 - 1) + m, | |
14207 | pubKeyBuffers, | |
14208 | (opcodes.OP_1 - 1) + n, | |
14209 | opcodes.OP_CHECKMULTISIG | |
14210 | )) | |
14211 | } | |
14212 | ||
14213 | // {signature} | |
14214 | function pubKeyInput(signature) { | |
14215 | assert(Buffer.isBuffer(signature), 'Expected Buffer, got ' + signature) | |
14216 | ||
14217 | return Script.fromChunks([signature]) | |
14218 | } | |
14219 | ||
14220 | // {signature} {pubKey} | |
14221 | function pubKeyHashInput(signature, pubKey) { | |
14222 | assert(Buffer.isBuffer(signature), 'Expected Buffer, got ' + signature) | |
14223 | ||
14224 | return Script.fromChunks([signature, pubKey.toBuffer()]) | |
14225 | } | |
14226 | ||
14227 | // <scriptSig> {serialized scriptPubKey script} | |
14228 | function scriptHashInput(scriptSig, scriptPubKey) { | |
14229 | return Script.fromChunks([].concat( | |
14230 | scriptSig.chunks, | |
14231 | scriptPubKey.toBuffer() | |
14232 | )) | |
14233 | } | |
14234 | ||
14235 | // OP_0 [signatures ...] | |
14236 | function multisigInput(signatures, scriptPubKey) { | |
14237 | if (scriptPubKey) { | |
14238 | assert(isMultisigOutput.call(scriptPubKey)) | |
14239 | ||
14240 | var m = scriptPubKey.chunks[0] | |
14241 | var k = m - (opcodes.OP_1 - 1) | |
14242 | assert(k <= signatures.length, 'Not enough signatures provided') | |
14243 | } | |
14244 | ||
14245 | return Script.fromChunks([].concat(opcodes.OP_0, signatures)) | |
14246 | } | |
14247 | ||
14248 | module.exports = { | |
14249 | classifyInput: classifyInput, | |
14250 | classifyOutput: classifyOutput, | |
14251 | multisigInput: multisigInput, | |
14252 | multisigOutput: multisigOutput, | |
14253 | pubKeyHashInput: pubKeyHashInput, | |
14254 | pubKeyHashOutput: pubKeyHashOutput, | |
14255 | pubKeyInput: pubKeyInput, | |
14256 | pubKeyOutput: pubKeyOutput, | |
14257 | scriptHashInput: scriptHashInput, | |
14258 | scriptHashOutput: scriptHashOutput | |
14259 | } | |
14260 | ||
14261 | }).call(this,_dereq_("buffer").Buffer) | |
14262 | },{"./ecsignature":77,"./opcodes":82,"./script":83,"assert":4,"buffer":8,"ecurve":65}],85:[function(_dereq_,module,exports){ | |
14263 | (function (Buffer){ | |
14264 | var assert = _dereq_('assert') | |
14265 | var bufferutils = _dereq_('./bufferutils') | |
14266 | var crypto = _dereq_('./crypto') | |
14267 | var opcodes = _dereq_('./opcodes') | |
14268 | var scripts = _dereq_('./scripts') | |
14269 | ||
14270 | var Address = _dereq_('./address') | |
14271 | var ECKey = _dereq_('./eckey') | |
14272 | var ECSignature = _dereq_('./ecsignature') | |
14273 | var Script = _dereq_('./script') | |
14274 | ||
14275 | Transaction.DEFAULT_SEQUENCE = 0xffffffff | |
14276 | Transaction.SIGHASH_ALL = 0x01 | |
14277 | Transaction.SIGHASH_NONE = 0x02 | |
14278 | Transaction.SIGHASH_SINGLE = 0x03 | |
14279 | Transaction.SIGHASH_ANYONECANPAY = 0x80 | |
14280 | ||
14281 | function Transaction() { | |
14282 | this.version = 1 | |
14283 | this.locktime = 0 | |
14284 | this.ins = [] | |
14285 | this.outs = [] | |
14286 | } | |
14287 | ||
14288 | /** | |
14289 | * Create a new txin. | |
14290 | * | |
14291 | * Can be called with any of: | |
14292 | * | |
14293 | * - A transaction and an index | |
14294 | * - A transaction hash and an index | |
14295 | * | |
14296 | * Note that this method does not sign the created input. | |
14297 | */ | |
14298 | Transaction.prototype.addInput = function(tx, index, sequence) { | |
14299 | if (sequence == undefined) sequence = Transaction.DEFAULT_SEQUENCE | |
14300 | ||
14301 | var hash | |
14302 | ||
14303 | if (typeof tx === 'string') { | |
14304 | hash = new Buffer(tx, 'hex') | |
14305 | ||
14306 | // TxId hex is big-endian, we need little-endian | |
14307 | Array.prototype.reverse.call(hash) | |
14308 | ||
14309 | } else if (tx instanceof Transaction) { | |
14310 | hash = tx.getHash() | |
14311 | ||
14312 | } else { | |
14313 | hash = tx | |
14314 | } | |
14315 | ||
14316 | assert(Buffer.isBuffer(hash), 'Expected Transaction, txId or txHash, got ' + tx) | |
14317 | assert.equal(hash.length, 32, 'Expected hash length of 32, got ' + hash.length) | |
14318 | assert.equal(typeof index, 'number', 'Expected number index, got ' + index) | |
14319 | ||
14320 | return (this.ins.push({ | |
14321 | hash: hash, | |
14322 | index: index, | |
14323 | script: Script.EMPTY, | |
14324 | sequence: sequence | |
14325 | }) - 1) | |
14326 | } | |
14327 | ||
14328 | /** | |
14329 | * Create a new txout. | |
14330 | * | |
14331 | * Can be called with: | |
14332 | * | |
14333 | * - A base58 address string and a value | |
14334 | * - An Address object and a value | |
14335 | * - A scriptPubKey Script and a value | |
14336 | */ | |
14337 | Transaction.prototype.addOutput = function(scriptPubKey, value) { | |
14338 | // Attempt to get a valid address if it's a base58 address string | |
14339 | if (typeof scriptPubKey === 'string') { | |
14340 | scriptPubKey = Address.fromBase58Check(scriptPubKey) | |
14341 | } | |
14342 | ||
14343 | // Attempt to get a valid script if it's an Address object | |
14344 | if (scriptPubKey instanceof Address) { | |
14345 | var address = scriptPubKey | |
14346 | ||
14347 | scriptPubKey = address.toOutputScript() | |
14348 | } | |
14349 | ||
14350 | return (this.outs.push({ | |
14351 | script: scriptPubKey, | |
14352 | value: value, | |
14353 | }) - 1) | |
14354 | } | |
14355 | ||
14356 | Transaction.prototype.toBuffer = function () { | |
14357 | var txInSize = this.ins.reduce(function(a, x) { | |
14358 | return a + (40 + bufferutils.varIntSize(x.script.buffer.length) + x.script.buffer.length) | |
14359 | }, 0) | |
14360 | ||
14361 | var txOutSize = this.outs.reduce(function(a, x) { | |
14362 | return a + (8 + bufferutils.varIntSize(x.script.buffer.length) + x.script.buffer.length) | |
14363 | }, 0) | |
14364 | ||
14365 | var buffer = new Buffer( | |
14366 | 8 + | |
14367 | bufferutils.varIntSize(this.ins.length) + | |
14368 | bufferutils.varIntSize(this.outs.length) + | |
14369 | txInSize + | |
14370 | txOutSize | |
14371 | ) | |
14372 | ||
14373 | var offset = 0 | |
14374 | function writeSlice(slice) { | |
14375 | slice.copy(buffer, offset) | |
14376 | offset += slice.length | |
14377 | } | |
14378 | function writeUInt32(i) { | |
14379 | buffer.writeUInt32LE(i, offset) | |
14380 | offset += 4 | |
14381 | } | |
14382 | function writeUInt64(i) { | |
14383 | bufferutils.writeUInt64LE(buffer, i, offset) | |
14384 | offset += 8 | |
14385 | } | |
14386 | function writeVarInt(i) { | |
14387 | var n = bufferutils.writeVarInt(buffer, i, offset) | |
14388 | offset += n | |
14389 | } | |
14390 | ||
14391 | writeUInt32(this.version) | |
14392 | writeVarInt(this.ins.length) | |
14393 | ||
14394 | this.ins.forEach(function(txin) { | |
14395 | writeSlice(txin.hash) | |
14396 | writeUInt32(txin.index) | |
14397 | writeVarInt(txin.script.buffer.length) | |
14398 | writeSlice(txin.script.buffer) | |
14399 | writeUInt32(txin.sequence) | |
14400 | }) | |
14401 | ||
14402 | writeVarInt(this.outs.length) | |
14403 | this.outs.forEach(function(txout) { | |
14404 | writeUInt64(txout.value) | |
14405 | writeVarInt(txout.script.buffer.length) | |
14406 | writeSlice(txout.script.buffer) | |
14407 | }) | |
14408 | ||
14409 | writeUInt32(this.locktime) | |
14410 | ||
14411 | return buffer | |
14412 | } | |
14413 | ||
14414 | Transaction.prototype.toHex = function() { | |
14415 | return this.toBuffer().toString('hex') | |
14416 | } | |
14417 | ||
14418 | /** | |
14419 | * Hash transaction for signing a specific input. | |
14420 | * | |
14421 | * Bitcoin uses a different hash for each signed transaction input. This | |
14422 | * method copies the transaction, makes the necessary changes based on the | |
14423 | * hashType, serializes and finally hashes the result. This hash can then be | |
14424 | * used to sign the transaction input in question. | |
14425 | */ | |
14426 | Transaction.prototype.hashForSignature = function(prevOutScript, inIndex, hashType) { | |
14427 | assert(inIndex >= 0, 'Invalid vin index') | |
14428 | assert(inIndex < this.ins.length, 'Invalid vin index') | |
14429 | assert(prevOutScript instanceof Script, 'Invalid Script object') | |
14430 | ||
14431 | var txTmp = this.clone() | |
14432 | var hashScript = prevOutScript.without(opcodes.OP_CODESEPARATOR) | |
14433 | ||
14434 | // Blank out other inputs' signatures | |
14435 | txTmp.ins.forEach(function(txin) { | |
14436 | txin.script = Script.EMPTY | |
14437 | }) | |
14438 | txTmp.ins[inIndex].script = hashScript | |
14439 | ||
14440 | var hashTypeModifier = hashType & 0x1f | |
14441 | if (hashTypeModifier === Transaction.SIGHASH_NONE) { | |
14442 | assert(false, 'SIGHASH_NONE not yet supported') | |
14443 | ||
14444 | } else if (hashTypeModifier === Transaction.SIGHASH_SINGLE) { | |
14445 | assert(false, 'SIGHASH_SINGLE not yet supported') | |
14446 | ||
14447 | } | |
14448 | ||
14449 | if (hashType & Transaction.SIGHASH_ANYONECANPAY) { | |
14450 | assert(false, 'SIGHASH_ANYONECANPAY not yet supported') | |
14451 | } | |
14452 | ||
14453 | var hashTypeBuffer = new Buffer(4) | |
14454 | hashTypeBuffer.writeInt32LE(hashType, 0) | |
14455 | ||
14456 | var buffer = Buffer.concat([txTmp.toBuffer(), hashTypeBuffer]) | |
14457 | return crypto.hash256(buffer) | |
14458 | } | |
14459 | ||
14460 | Transaction.prototype.getHash = function () { | |
14461 | return crypto.hash256(this.toBuffer()) | |
14462 | } | |
14463 | ||
14464 | Transaction.prototype.getId = function () { | |
14465 | var buffer = this.getHash() | |
14466 | ||
14467 | // Big-endian is used for TxHash | |
14468 | Array.prototype.reverse.call(buffer) | |
14469 | ||
14470 | return buffer.toString('hex') | |
14471 | } | |
14472 | ||
14473 | Transaction.prototype.clone = function () { | |
14474 | var newTx = new Transaction() | |
14475 | newTx.version = this.version | |
14476 | newTx.locktime = this.locktime | |
14477 | ||
14478 | newTx.ins = this.ins.map(function(txin) { | |
14479 | return { | |
14480 | hash: txin.hash, | |
14481 | index: txin.index, | |
14482 | script: txin.script, | |
14483 | sequence: txin.sequence | |
14484 | } | |
14485 | }) | |
14486 | ||
14487 | newTx.outs = this.outs.map(function(txout) { | |
14488 | return { | |
14489 | script: txout.script, | |
14490 | value: txout.value | |
14491 | } | |
14492 | }) | |
14493 | ||
14494 | return newTx | |
14495 | } | |
14496 | ||
14497 | Transaction.fromBuffer = function(buffer) { | |
14498 | var offset = 0 | |
14499 | function readSlice(n) { | |
14500 | offset += n | |
14501 | return buffer.slice(offset - n, offset) | |
14502 | } | |
14503 | function readUInt32() { | |
14504 | var i = buffer.readUInt32LE(offset) | |
14505 | offset += 4 | |
14506 | return i | |
14507 | } | |
14508 | function readUInt64() { | |
14509 | var i = bufferutils.readUInt64LE(buffer, offset) | |
14510 | offset += 8 | |
14511 | return i | |
14512 | } | |
14513 | function readVarInt() { | |
14514 | var vi = bufferutils.readVarInt(buffer, offset) | |
14515 | offset += vi.size | |
14516 | return vi.number | |
14517 | } | |
14518 | ||
14519 | var tx = new Transaction() | |
14520 | tx.version = readUInt32() | |
14521 | ||
14522 | var vinLen = readVarInt() | |
14523 | for (var i = 0; i < vinLen; ++i) { | |
14524 | var hash = readSlice(32) | |
14525 | var vout = readUInt32() | |
14526 | var scriptLen = readVarInt() | |
14527 | var script = readSlice(scriptLen) | |
14528 | var sequence = readUInt32() | |
14529 | ||
14530 | tx.ins.push({ | |
14531 | hash: hash, | |
14532 | index: vout, | |
14533 | script: Script.fromBuffer(script), | |
14534 | sequence: sequence | |
14535 | }) | |
14536 | } | |
14537 | ||
14538 | var voutLen = readVarInt() | |
14539 | for (i = 0; i < voutLen; ++i) { | |
14540 | var value = readUInt64() | |
14541 | var scriptLen = readVarInt() | |
14542 | var script = readSlice(scriptLen) | |
14543 | ||
14544 | tx.outs.push({ | |
14545 | value: value, | |
14546 | script: Script.fromBuffer(script) | |
14547 | }) | |
14548 | } | |
14549 | ||
14550 | tx.locktime = readUInt32() | |
14551 | assert.equal(offset, buffer.length, 'Transaction has unexpected data') | |
14552 | ||
14553 | return tx | |
14554 | } | |
14555 | ||
14556 | Transaction.fromHex = function(hex) { | |
14557 | return Transaction.fromBuffer(new Buffer(hex, 'hex')) | |
14558 | } | |
14559 | ||
14560 | /** | |
14561 | * Signs a pubKeyHash output at some index with the given key | |
14562 | */ | |
14563 | Transaction.prototype.sign = function(index, privKey, hashType) { | |
14564 | var prevOutScript = privKey.pub.getAddress().toOutputScript() | |
14565 | var signature = this.signInput(index, prevOutScript, privKey, hashType) | |
14566 | ||
14567 | // FIXME: Assumed prior TX was pay-to-pubkey-hash | |
14568 | var scriptSig = scripts.pubKeyHashInput(signature, privKey.pub) | |
14569 | this.setInputScript(index, scriptSig) | |
14570 | } | |
14571 | ||
14572 | Transaction.prototype.signInput = function(index, prevOutScript, privKey, hashType) { | |
14573 | hashType = hashType || Transaction.SIGHASH_ALL | |
14574 | ||
14575 | var hash = this.hashForSignature(prevOutScript, index, hashType) | |
14576 | var signature = privKey.sign(hash) | |
14577 | ||
14578 | return signature.toScriptSignature(hashType) | |
14579 | } | |
14580 | ||
14581 | Transaction.prototype.setInputScript = function(index, script) { | |
14582 | this.ins[index].script = script | |
14583 | } | |
14584 | ||
14585 | // FIXME: could be validateInput(index, prevTxOut, pub) | |
14586 | Transaction.prototype.validateInput = function(index, prevOutScript, pubKey, buffer) { | |
14587 | var parsed = ECSignature.parseScriptSignature(buffer) | |
14588 | var hash = this.hashForSignature(prevOutScript, index, parsed.hashType) | |
14589 | ||
14590 | return pubKey.verify(hash, parsed.signature) | |
14591 | } | |
14592 | ||
14593 | module.exports = Transaction | |
14594 | ||
14595 | }).call(this,_dereq_("buffer").Buffer) | |
14596 | },{"./address":69,"./bufferutils":71,"./crypto":73,"./eckey":75,"./ecsignature":77,"./opcodes":82,"./script":83,"./scripts":84,"assert":4,"buffer":8}],86:[function(_dereq_,module,exports){ | |
14597 | (function (Buffer){ | |
14598 | var assert = _dereq_('assert') | |
14599 | var networks = _dereq_('./networks') | |
14600 | var rng = _dereq_('secure-random') | |
14601 | ||
14602 | var Address = _dereq_('./address') | |
14603 | var HDNode = _dereq_('./hdnode') | |
14604 | var Transaction = _dereq_('./transaction') | |
14605 | ||
14606 | function Wallet(seed, network) { | |
14607 | network = network || networks.bitcoin | |
14608 | ||
14609 | // Stored in a closure to make accidental serialization less likely | |
14610 | var masterkey = null | |
14611 | var me = this | |
14612 | var accountZero = null | |
14613 | var internalAccount = null | |
14614 | var externalAccount = null | |
14615 | ||
14616 | // Addresses | |
14617 | this.addresses = [] | |
14618 | this.changeAddresses = [] | |
14619 | ||
14620 | // Transaction output data | |
14621 | this.outputs = {} | |
14622 | ||
14623 | // Make a new master key | |
14624 | this.newMasterKey = function(seed) { | |
14625 | seed = seed || new Buffer(rng(32)) | |
14626 | masterkey = HDNode.fromSeedBuffer(seed, network) | |
14627 | ||
14628 | // HD first-level child derivation method should be hardened | |
14629 | // See https://bitcointalk.org/index.php?topic=405179.msg4415254#msg4415254 | |
14630 | accountZero = masterkey.deriveHardened(0) | |
14631 | externalAccount = accountZero.derive(0) | |
14632 | internalAccount = accountZero.derive(1) | |
14633 | ||
14634 | me.addresses = [] | |
14635 | me.changeAddresses = [] | |
14636 | ||
14637 | me.outputs = {} | |
14638 | } | |
14639 | ||
14640 | this.newMasterKey(seed) | |
14641 | ||
14642 | this.generateAddress = function() { | |
14643 | var key = externalAccount.derive(this.addresses.length) | |
14644 | this.addresses.push(key.getAddress().toString()) | |
14645 | return this.addresses[this.addresses.length - 1] | |
14646 | } | |
14647 | ||
14648 | this.generateChangeAddress = function() { | |
14649 | var key = internalAccount.derive(this.changeAddresses.length) | |
14650 | this.changeAddresses.push(key.getAddress().toString()) | |
14651 | return this.changeAddresses[this.changeAddresses.length - 1] | |
14652 | } | |
14653 | ||
14654 | this.getBalance = function() { | |
14655 | return this.getUnspentOutputs().reduce(function(memo, output){ | |
14656 | return memo + output.value | |
14657 | }, 0) | |
14658 | } | |
14659 | ||
14660 | this.getUnspentOutputs = function() { | |
14661 | var utxo = [] | |
14662 | ||
14663 | for(var key in this.outputs){ | |
14664 | var output = this.outputs[key] | |
14665 | if(!output.to) utxo.push(outputToUnspentOutput(output)) | |
14666 | } | |
14667 | ||
14668 | return utxo | |
14669 | } | |
14670 | ||
14671 | this.setUnspentOutputs = function(utxo) { | |
14672 | var outputs = {} | |
14673 | ||
14674 | utxo.forEach(function(uo){ | |
14675 | validateUnspentOutput(uo) | |
14676 | var o = unspentOutputToOutput(uo) | |
14677 | outputs[o.from] = o | |
14678 | }) | |
14679 | ||
14680 | this.outputs = outputs | |
14681 | } | |
14682 | ||
14683 | function outputToUnspentOutput(output){ | |
14684 | var hashAndIndex = output.from.split(":") | |
14685 | ||
14686 | return { | |
14687 | hash: hashAndIndex[0], | |
14688 | outputIndex: parseInt(hashAndIndex[1]), | |
14689 | address: output.address, | |
14690 | value: output.value, | |
14691 | pending: output.pending | |
14692 | } | |
14693 | } | |
14694 | ||
14695 | function unspentOutputToOutput(o) { | |
14696 | var hash = o.hash | |
14697 | var key = hash + ":" + o.outputIndex | |
14698 | return { | |
14699 | from: key, | |
14700 | address: o.address, | |
14701 | value: o.value, | |
14702 | pending: o.pending | |
14703 | } | |
14704 | } | |
14705 | ||
14706 | function validateUnspentOutput(uo) { | |
14707 | var missingField | |
14708 | ||
14709 | if (isNullOrUndefined(uo.hash)) { | |
14710 | missingField = "hash" | |
14711 | } | |
14712 | ||
14713 | var requiredKeys = ['outputIndex', 'address', 'value'] | |
14714 | requiredKeys.forEach(function (key) { | |
14715 | if (isNullOrUndefined(uo[key])){ | |
14716 | missingField = key | |
14717 | } | |
14718 | }) | |
14719 | ||
14720 | if (missingField) { | |
14721 | var message = [ | |
14722 | 'Invalid unspent output: key', missingField, 'is missing.', | |
14723 | 'A valid unspent output must contain' | |
14724 | ] | |
14725 | message.push(requiredKeys.join(', ')) | |
14726 | message.push("and hash") | |
14727 | throw new Error(message.join(' ')) | |
14728 | } | |
14729 | } | |
14730 | ||
14731 | function isNullOrUndefined(value) { | |
14732 | return value == undefined | |
14733 | } | |
14734 | ||
14735 | this.processPendingTx = function(tx){ | |
14736 | processTx(tx, true) | |
14737 | } | |
14738 | ||
14739 | this.processConfirmedTx = function(tx){ | |
14740 | processTx(tx, false) | |
14741 | } | |
14742 | ||
14743 | function processTx(tx, isPending) { | |
14744 | var txid = tx.getId() | |
14745 | ||
14746 | tx.outs.forEach(function(txOut, i) { | |
14747 | var address | |
14748 | ||
14749 | try { | |
14750 | address = Address.fromOutputScript(txOut.script, network).toString() | |
14751 | } catch(e) { | |
14752 | if (!(e.message.match(/has no matching Address/))) throw e | |
14753 | } | |
14754 | ||
14755 | if (isMyAddress(address)) { | |
14756 | var output = txid + ':' + i | |
14757 | ||
14758 | me.outputs[output] = { | |
14759 | from: output, | |
14760 | value: txOut.value, | |
14761 | address: address, | |
14762 | pending: isPending | |
14763 | } | |
14764 | } | |
14765 | }) | |
14766 | ||
14767 | tx.ins.forEach(function(txIn, i) { | |
14768 | // copy and convert to big-endian hex | |
14769 | var txinId = new Buffer(txIn.hash) | |
14770 | Array.prototype.reverse.call(txinId) | |
14771 | txinId = txinId.toString('hex') | |
14772 | ||
14773 | var output = txinId + ':' + txIn.index | |
14774 | ||
14775 | if (!(output in me.outputs)) return | |
14776 | ||
14777 | if (isPending) { | |
14778 | me.outputs[output].to = txid + ':' + i | |
14779 | me.outputs[output].pending = true | |
14780 | } else { | |
14781 | delete me.outputs[output] | |
14782 | } | |
14783 | }) | |
14784 | } | |
14785 | ||
14786 | this.createTx = function(to, value, fixedFee, changeAddress) { | |
14787 | assert(value > network.dustThreshold, value + ' must be above dust threshold (' + network.dustThreshold + ' Satoshis)') | |
14788 | ||
14789 | var utxos = getCandidateOutputs(value) | |
14790 | var accum = 0 | |
14791 | var subTotal = value | |
14792 | var addresses = [] | |
14793 | ||
14794 | var tx = new Transaction() | |
14795 | tx.addOutput(to, value) | |
14796 | ||
14797 | for (var i = 0; i < utxos.length; ++i) { | |
14798 | var utxo = utxos[i] | |
14799 | addresses.push(utxo.address) | |
14800 | ||
14801 | var outpoint = utxo.from.split(':') | |
14802 | tx.addInput(outpoint[0], parseInt(outpoint[1])) | |
14803 | ||
14804 | var fee = fixedFee == undefined ? estimateFeePadChangeOutput(tx) : fixedFee | |
14805 | ||
14806 | accum += utxo.value | |
14807 | subTotal = value + fee | |
14808 | if (accum >= subTotal) { | |
14809 | var change = accum - subTotal | |
14810 | ||
14811 | if (change > network.dustThreshold) { | |
14812 | tx.addOutput(changeAddress || getChangeAddress(), change) | |
14813 | } | |
14814 | ||
14815 | break | |
14816 | } | |
14817 | } | |
14818 | ||
14819 | assert(accum >= subTotal, 'Not enough funds (incl. fee): ' + accum + ' < ' + subTotal) | |
14820 | ||
14821 | this.signWith(tx, addresses) | |
14822 | return tx | |
14823 | } | |
14824 | ||
14825 | function getCandidateOutputs() { | |
14826 | var unspent = [] | |
14827 | ||
14828 | for (var key in me.outputs) { | |
14829 | var output = me.outputs[key] | |
14830 | if (!output.pending) unspent.push(output) | |
14831 | } | |
14832 | ||
14833 | var sortByValueDesc = unspent.sort(function(o1, o2){ | |
14834 | return o2.value - o1.value | |
14835 | }) | |
14836 | ||
14837 | return sortByValueDesc | |
14838 | } | |
14839 | ||
14840 | function estimateFeePadChangeOutput(tx) { | |
14841 | var tmpTx = tx.clone() | |
14842 | tmpTx.addOutput(getChangeAddress(), network.dustSoftThreshold || 0) | |
14843 | ||
14844 | return network.estimateFee(tmpTx) | |
14845 | } | |
14846 | ||
14847 | function getChangeAddress() { | |
14848 | if(me.changeAddresses.length === 0) me.generateChangeAddress(); | |
14849 | return me.changeAddresses[me.changeAddresses.length - 1] | |
14850 | } | |
14851 | ||
14852 | this.signWith = function(tx, addresses) { | |
14853 | assert.equal(tx.ins.length, addresses.length, 'Number of addresses must match number of transaction inputs') | |
14854 | ||
14855 | addresses.forEach(function(address, i) { | |
14856 | var key = me.getPrivateKeyForAddress(address) | |
14857 | ||
14858 | tx.sign(i, key) | |
14859 | }) | |
14860 | ||
14861 | return tx | |
14862 | } | |
14863 | ||
14864 | this.getMasterKey = function() { return masterkey } | |
14865 | this.getAccountZero = function() { return accountZero } | |
14866 | this.getInternalAccount = function() { return internalAccount } | |
14867 | this.getExternalAccount = function() { return externalAccount } | |
14868 | ||
14869 | this.getPrivateKey = function(index) { | |
14870 | return externalAccount.derive(index).privKey | |
14871 | } | |
14872 | ||
14873 | this.getInternalPrivateKey = function(index) { | |
14874 | return internalAccount.derive(index).privKey | |
14875 | } | |
14876 | ||
14877 | this.getPrivateKeyForAddress = function(address) { | |
14878 | var index | |
14879 | if((index = this.addresses.indexOf(address)) > -1) { | |
14880 | return this.getPrivateKey(index) | |
14881 | } else if((index = this.changeAddresses.indexOf(address)) > -1) { | |
14882 | return this.getInternalPrivateKey(index) | |
14883 | } else { | |
14884 | throw new Error('Unknown address. Make sure the address is from the keychain and has been generated.') | |
14885 | } | |
14886 | } | |
14887 | ||
14888 | function isReceiveAddress(address){ | |
14889 | return me.addresses.indexOf(address) > -1 | |
14890 | } | |
14891 | ||
14892 | function isChangeAddress(address){ | |
14893 | return me.changeAddresses.indexOf(address) > -1 | |
14894 | } | |
14895 | ||
14896 | function isMyAddress(address) { | |
14897 | return isReceiveAddress(address) || isChangeAddress(address) | |
14898 | } | |
14899 | } | |
14900 | ||
14901 | module.exports = Wallet | |
14902 | ||
14903 | }).call(this,_dereq_("buffer").Buffer) | |
14904 | },{"./address":69,"./hdnode":78,"./networks":81,"./transaction":85,"assert":4,"buffer":8,"secure-random":68}]},{},[79]) | |
14905 | (79) | |
14906 | }); | |
14907 | </script> | |
14908 | ||
14909 | <!--<script src="/js/asmcrypto.js"></script>--> | |
14910 | <script> | |
14911 | // INCLUDE ASMCRYPTO | |
14912 | // https://rawgit.com/tresorit/asmcrypto.js/598a1098504f1b2d0e615bc51dd8404afd2d338b/asmcrypto.js | |
14913 | // Provides PBKDF2 functionality | |
14914 | // It's faster than CryptoJS | |
14915 | // Couldn't get SJCL working as desired | |
14916 | ||
14917 | ||
14918 | (function(exports, global) { | |
14919 | "use strict"; | |
14920 | global["asmCrypto"] = exports; | |
14921 | function string_to_bytes(str) { | |
14922 | var i, len = str.length, arr = new Uint8Array(len); | |
14923 | for (i = 0; i < len; i += 1) { | |
14924 | arr[i] = str.charCodeAt(i); | |
14925 | } | |
14926 | return arr; | |
14927 | } | |
14928 | function hex_to_bytes(str) { | |
14929 | var arr = [], len = str.length, i; | |
14930 | if (len & 1) { | |
14931 | str = "0" + str; | |
14932 | len++; | |
14933 | } | |
14934 | for (i = 0; i < len; i += 2) { | |
14935 | arr.push(parseInt(str.substr(i, 2), 16)); | |
14936 | } | |
14937 | return new Uint8Array(arr); | |
14938 | } | |
14939 | function base64_to_bytes(str) { | |
14940 | return string_to_bytes(atob(str)); | |
14941 | } | |
14942 | function bytes_to_string(arr) { | |
14943 | var str = ""; | |
14944 | for (var i = 0; i < arr.length; i++) str += String.fromCharCode(arr[i]); | |
14945 | return str; | |
14946 | } | |
14947 | function bytes_to_hex(arr) { | |
14948 | var sz = (arr.byteLength || arr.length) / arr.length, str = ""; | |
14949 | for (var i = 0; i < arr.length; i++) { | |
14950 | var h = arr[i].toString(16); | |
14951 | if (h.length < 2 * sz) str += "00000000000000".substr(0, 2 * sz - h.length); | |
14952 | str += h; | |
14953 | } | |
14954 | return str; | |
14955 | } | |
14956 | function bytes_to_base64(arr) { | |
14957 | return btoa(bytes_to_string(arr)); | |
14958 | } | |
14959 | function pow2_ceil(a) { | |
14960 | a -= 1; | |
14961 | a |= a >>> 1; | |
14962 | a |= a >>> 2; | |
14963 | a |= a >>> 4; | |
14964 | a |= a >>> 8; | |
14965 | a |= a >>> 16; | |
14966 | a += 1; | |
14967 | return a; | |
14968 | } | |
14969 | function is_number(a) { | |
14970 | return typeof a === "number"; | |
14971 | } | |
14972 | function is_string(a) { | |
14973 | return typeof a === "string"; | |
14974 | } | |
14975 | function is_buffer(a) { | |
14976 | return a instanceof ArrayBuffer; | |
14977 | } | |
14978 | function is_bytes(a) { | |
14979 | return a instanceof Uint8Array; | |
14980 | } | |
14981 | function is_typed_array(a) { | |
14982 | return a instanceof Int8Array || a instanceof Uint8Array || a instanceof Int16Array || a instanceof Uint16Array || a instanceof Int32Array || a instanceof Uint32Array || a instanceof Float32Array || a instanceof Float64Array; | |
14983 | } | |
14984 | function IllegalStateError() { | |
14985 | Error.apply(this, arguments); | |
14986 | } | |
14987 | IllegalStateError.prototype = new Error(); | |
14988 | function IllegalArgumentError() { | |
14989 | Error.apply(this, arguments); | |
14990 | } | |
14991 | IllegalArgumentError.prototype = new Error(); | |
14992 | function SecurityError() { | |
14993 | Error.apply(this, arguments); | |
14994 | } | |
14995 | IllegalArgumentError.prototype = new Error(); | |
14996 | var _aes_tables = [ 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22, 82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125, 198, 248, 238, 246, 255, 214, 222, 145, 96, 2, 206, 86, 231, 181, 77, 236, 143, 31, 137, 250, 239, 178, 142, 251, 65, 179, 95, 69, 35, 83, 228, 155, 117, 225, 61, 76, 108, 126, 245, 131, 104, 81, 209, 249, 226, 171, 98, 42, 8, 149, 70, 157, 48, 55, 10, 47, 14, 36, 27, 223, 205, 78, 127, 234, 18, 29, 88, 52, 54, 220, 180, 91, 164, 118, 183, 125, 82, 221, 94, 19, 166, 185, 0, 193, 64, 227, 121, 182, 212, 141, 103, 114, 148, 152, 176, 133, 187, 197, 79, 237, 134, 154, 102, 17, 138, 233, 4, 254, 160, 120, 37, 75, 162, 93, 128, 5, 63, 33, 112, 241, 99, 119, 175, 66, 32, 229, 253, 191, 129, 24, 38, 195, 190, 53, 136, 46, 147, 85, 252, 122, 200, 186, 50, 230, 192, 25, 158, 163, 68, 84, 59, 11, 140, 199, 107, 40, 167, 188, 22, 173, 219, 100, 116, 20, 146, 12, 72, 184, 159, 189, 67, 196, 57, 49, 211, 242, 213, 139, 110, 218, 1, 177, 156, 73, 216, 172, 243, 207, 202, 244, 71, 16, 111, 240, 74, 92, 56, 87, 115, 151, 203, 161, 232, 62, 150, 97, 13, 15, 224, 124, 113, 204, 144, 6, 247, 28, 194, 106, 174, 105, 23, 153, 58, 39, 217, 235, 43, 34, 210, 169, 7, 51, 45, 60, 21, 201, 135, 170, 80, 165, 3, 89, 9, 26, 101, 215, 132, 208, 130, 41, 90, 30, 123, 168, 109, 44, 165, 132, 153, 141, 13, 189, 177, 84, 80, 3, 169, 125, 25, 98, 230, 154, 69, 157, 64, 135, 21, 235, 201, 11, 236, 103, 253, 234, 191, 247, 150, 91, 194, 28, 174, 106, 90, 65, 2, 79, 92, 244, 52, 8, 147, 115, 83, 63, 12, 82, 101, 94, 40, 161, 15, 181, 9, 54, 155, 61, 38, 105, 205, 159, 27, 158, 116, 46, 45, 178, 238, 251, 246, 77, 97, 206, 123, 62, 113, 151, 245, 104, 0, 44, 96, 31, 200, 237, 190, 70, 217, 75, 222, 212, 232, 74, 107, 42, 229, 22, 197, 215, 85, 148, 207, 16, 6, 129, 240, 68, 186, 227, 243, 254, 192, 138, 173, 188, 72, 4, 223, 193, 117, 99, 48, 26, 14, 109, 76, 20, 53, 47, 225, 162, 204, 57, 87, 242, 130, 71, 172, 231, 43, 149, 160, 152, 209, 127, 102, 126, 171, 131, 202, 41, 211, 60, 121, 226, 29, 118, 59, 86, 78, 30, 219, 10, 108, 228, 93, 110, 239, 166, 168, 164, 55, 139, 50, 67, 89, 183, 140, 100, 210, 224, 180, 250, 7, 37, 175, 142, 233, 24, 213, 136, 111, 114, 36, 241, 199, 81, 35, 124, 156, 33, 221, 220, 134, 133, 144, 66, 196, 170, 216, 5, 1, 18, 163, 95, 249, 208, 145, 88, 39, 185, 56, 19, 179, 51, 187, 112, 137, 167, 182, 34, 146, 32, 73, 255, 120, 122, 143, 248, 128, 23, 218, 49, 198, 184, 195, 176, 119, 17, 203, 252, 214, 58, 0, 9, 18, 27, 36, 45, 54, 63, 72, 65, 90, 83, 108, 101, 126, 119, 144, 153, 130, 139, 180, 189, 166, 175, 216, 209, 202, 195, 252, 245, 238, 231, 59, 50, 41, 32, 31, 22, 13, 4, 115, 122, 97, 104, 87, 94, 69, 76, 171, 162, 185, 176, 143, 134, 157, 148, 227, 234, 241, 248, 199, 206, 213, 220, 118, 127, 100, 109, 82, 91, 64, 73, 62, 55, 44, 37, 26, 19, 8, 1, 230, 239, 244, 253, 194, 203, 208, 217, 174, 167, 188, 181, 138, 131, 152, 145, 77, 68, 95, 86, 105, 96, 123, 114, 5, 12, 23, 30, 33, 40, 51, 58, 221, 212, 207, 198, 249, 240, 235, 226, 149, 156, 135, 142, 177, 184, 163, 170, 236, 229, 254, 247, 200, 193, 218, 211, 164, 173, 182, 191, 128, 137, 146, 155, 124, 117, 110, 103, 88, 81, 74, 67, 52, 61, 38, 47, 16, 25, 2, 11, 215, 222, 197, 204, 243, 250, 225, 232, 159, 150, 141, 132, 187, 178, 169, 160, 71, 78, 85, 92, 99, 106, 113, 120, 15, 6, 29, 20, 43, 34, 57, 48, 154, 147, 136, 129, 190, 183, 172, 165, 210, 219, 192, 201, 246, 255, 228, 237, 10, 3, 24, 17, 46, 39, 60, 53, 66, 75, 80, 89, 102, 111, 116, 125, 161, 168, 179, 186, 133, 140, 151, 158, 233, 224, 251, 242, 205, 196, 223, 214, 49, 56, 35, 42, 21, 28, 7, 14, 121, 112, 107, 98, 93, 84, 79, 70, 0, 11, 22, 29, 44, 39, 58, 49, 88, 83, 78, 69, 116, 127, 98, 105, 176, 187, 166, 173, 156, 151, 138, 129, 232, 227, 254, 245, 196, 207, 210, 217, 123, 112, 109, 102, 87, 92, 65, 74, 35, 40, 53, 62, 15, 4, 25, 18, 203, 192, 221, 214, 231, 236, 241, 250, 147, 152, 133, 142, 191, 180, 169, 162, 246, 253, 224, 235, 218, 209, 204, 199, 174, 165, 184, 179, 130, 137, 148, 159, 70, 77, 80, 91, 106, 97, 124, 119, 30, 21, 8, 3, 50, 57, 36, 47, 141, 134, 155, 144, 161, 170, 183, 188, 213, 222, 195, 200, 249, 242, 239, 228, 61, 54, 43, 32, 17, 26, 7, 12, 101, 110, 115, 120, 73, 66, 95, 84, 247, 252, 225, 234, 219, 208, 205, 198, 175, 164, 185, 178, 131, 136, 149, 158, 71, 76, 81, 90, 107, 96, 125, 118, 31, 20, 9, 2, 51, 56, 37, 46, 140, 135, 154, 145, 160, 171, 182, 189, 212, 223, 194, 201, 248, 243, 238, 229, 60, 55, 42, 33, 16, 27, 6, 13, 100, 111, 114, 121, 72, 67, 94, 85, 1, 10, 23, 28, 45, 38, 59, 48, 89, 82, 79, 68, 117, 126, 99, 104, 177, 186, 167, 172, 157, 150, 139, 128, 233, 226, 255, 244, 197, 206, 211, 216, 122, 113, 108, 103, 86, 93, 64, 75, 34, 41, 52, 63, 14, 5, 24, 19, 202, 193, 220, 215, 230, 237, 240, 251, 146, 153, 132, 143, 190, 181, 168, 163, 0, 13, 26, 23, 52, 57, 46, 35, 104, 101, 114, 127, 92, 81, 70, 75, 208, 221, 202, 199, 228, 233, 254, 243, 184, 181, 162, 175, 140, 129, 150, 155, 187, 182, 161, 172, 143, 130, 149, 152, 211, 222, 201, 196, 231, 234, 253, 240, 107, 102, 113, 124, 95, 82, 69, 72, 3, 14, 25, 20, 55, 58, 45, 32, 109, 96, 119, 122, 89, 84, 67, 78, 5, 8, 31, 18, 49, 60, 43, 38, 189, 176, 167, 170, 137, 132, 147, 158, 213, 216, 207, 194, 225, 236, 251, 246, 214, 219, 204, 193, 226, 239, 248, 245, 190, 179, 164, 169, 138, 135, 144, 157, 6, 11, 28, 17, 50, 63, 40, 37, 110, 99, 116, 121, 90, 87, 64, 77, 218, 215, 192, 205, 238, 227, 244, 249, 178, 191, 168, 165, 134, 139, 156, 145, 10, 7, 16, 29, 62, 51, 36, 41, 98, 111, 120, 117, 86, 91, 76, 65, 97, 108, 123, 118, 85, 88, 79, 66, 9, 4, 19, 30, 61, 48, 39, 42, 177, 188, 171, 166, 133, 136, 159, 146, 217, 212, 195, 206, 237, 224, 247, 250, 183, 186, 173, 160, 131, 142, 153, 148, 223, 210, 197, 200, 235, 230, 241, 252, 103, 106, 125, 112, 83, 94, 73, 68, 15, 2, 21, 24, 59, 54, 33, 44, 12, 1, 22, 27, 56, 53, 34, 47, 100, 105, 126, 115, 80, 93, 74, 71, 220, 209, 198, 203, 232, 229, 242, 255, 180, 185, 174, 163, 128, 141, 154, 151, 0, 14, 28, 18, 56, 54, 36, 42, 112, 126, 108, 98, 72, 70, 84, 90, 224, 238, 252, 242, 216, 214, 196, 202, 144, 158, 140, 130, 168, 166, 180, 186, 219, 213, 199, 201, 227, 237, 255, 241, 171, 165, 183, 185, 147, 157, 143, 129, 59, 53, 39, 41, 3, 13, 31, 17, 75, 69, 87, 89, 115, 125, 111, 97, 173, 163, 177, 191, 149, 155, 137, 135, 221, 211, 193, 207, 229, 235, 249, 247, 77, 67, 81, 95, 117, 123, 105, 103, 61, 51, 33, 47, 5, 11, 25, 23, 118, 120, 106, 100, 78, 64, 82, 92, 6, 8, 26, 20, 62, 48, 34, 44, 150, 152, 138, 132, 174, 160, 178, 188, 230, 232, 250, 244, 222, 208, 194, 204, 65, 79, 93, 83, 121, 119, 101, 107, 49, 63, 45, 35, 9, 7, 21, 27, 161, 175, 189, 179, 153, 151, 133, 139, 209, 223, 205, 195, 233, 231, 245, 251, 154, 148, 134, 136, 162, 172, 190, 176, 234, 228, 246, 248, 210, 220, 206, 192, 122, 116, 102, 104, 66, 76, 94, 80, 10, 4, 22, 24, 50, 60, 46, 32, 236, 226, 240, 254, 212, 218, 200, 198, 156, 146, 128, 142, 164, 170, 184, 182, 12, 2, 16, 30, 52, 58, 40, 38, 124, 114, 96, 110, 68, 74, 88, 86, 55, 57, 43, 37, 15, 1, 19, 29, 71, 73, 91, 85, 127, 113, 99, 109, 215, 217, 203, 197, 239, 225, 243, 253, 167, 169, 187, 181, 159, 145, 131, 141 ]; | |
14997 | var _aes_heap_start = 2048; | |
14998 | function _aes_asm(stdlib, foreign, buffer) { | |
14999 | // Closure Compiler warning - commented out | |
15000 | //"use asm"; | |
15001 | var S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0, S5 = 0, S6 = 0, S7 = 0, S8 = 0, S9 = 0, SA = 0, SB = 0, SC = 0, SD = 0, SE = 0, SF = 0; | |
15002 | var keySize = 0; | |
15003 | var R00 = 0, R01 = 0, R02 = 0, R03 = 0, R04 = 0, R05 = 0, R06 = 0, R07 = 0, R08 = 0, R09 = 0, R0A = 0, R0B = 0, R0C = 0, R0D = 0, R0E = 0, R0F = 0, R10 = 0, R11 = 0, R12 = 0, R13 = 0, R14 = 0, R15 = 0, R16 = 0, R17 = 0, R18 = 0, R19 = 0, R1A = 0, R1B = 0, R1C = 0, R1D = 0, R1E = 0, R1F = 0, R20 = 0, R21 = 0, R22 = 0, R23 = 0, R24 = 0, R25 = 0, R26 = 0, R27 = 0, R28 = 0, R29 = 0, R2A = 0, R2B = 0, R2C = 0, R2D = 0, R2E = 0, R2F = 0, R30 = 0, R31 = 0, R32 = 0, R33 = 0, R34 = 0, R35 = 0, R36 = 0, R37 = 0, R38 = 0, R39 = 0, R3A = 0, R3B = 0, R3C = 0, R3D = 0, R3E = 0, R3F = 0, R40 = 0, R41 = 0, R42 = 0, R43 = 0, R44 = 0, R45 = 0, R46 = 0, R47 = 0, R48 = 0, R49 = 0, R4A = 0, R4B = 0, R4C = 0, R4D = 0, R4E = 0, R4F = 0, R50 = 0, R51 = 0, R52 = 0, R53 = 0, R54 = 0, R55 = 0, R56 = 0, R57 = 0, R58 = 0, R59 = 0, R5A = 0, R5B = 0, R5C = 0, R5D = 0, R5E = 0, R5F = 0, R60 = 0, R61 = 0, R62 = 0, R63 = 0, R64 = 0, R65 = 0, R66 = 0, R67 = 0, R68 = 0, R69 = 0, R6A = 0, R6B = 0, R6C = 0, R6D = 0, R6E = 0, R6F = 0, R70 = 0, R71 = 0, R72 = 0, R73 = 0, R74 = 0, R75 = 0, R76 = 0, R77 = 0, R78 = 0, R79 = 0, R7A = 0, R7B = 0, R7C = 0, R7D = 0, R7E = 0, R7F = 0, R80 = 0, R81 = 0, R82 = 0, R83 = 0, R84 = 0, R85 = 0, R86 = 0, R87 = 0, R88 = 0, R89 = 0, R8A = 0, R8B = 0, R8C = 0, R8D = 0, R8E = 0, R8F = 0, R90 = 0, R91 = 0, R92 = 0, R93 = 0, R94 = 0, R95 = 0, R96 = 0, R97 = 0, R98 = 0, R99 = 0, R9A = 0, R9B = 0, R9C = 0, R9D = 0, R9E = 0, R9F = 0, RA0 = 0, RA1 = 0, RA2 = 0, RA3 = 0, RA4 = 0, RA5 = 0, RA6 = 0, RA7 = 0, RA8 = 0, RA9 = 0, RAA = 0, RAB = 0, RAC = 0, RAD = 0, RAE = 0, RAF = 0, RB0 = 0, RB1 = 0, RB2 = 0, RB3 = 0, RB4 = 0, RB5 = 0, RB6 = 0, RB7 = 0, RB8 = 0, RB9 = 0, RBA = 0, RBB = 0, RBC = 0, RBD = 0, RBE = 0, RBF = 0, RC0 = 0, RC1 = 0, RC2 = 0, RC3 = 0, RC4 = 0, RC5 = 0, RC6 = 0, RC7 = 0, RC8 = 0, RC9 = 0, RCA = 0, RCB = 0, RCC = 0, RCD = 0, RCE = 0, RCF = 0, RD0 = 0, RD1 = 0, RD2 = 0, RD3 = 0, RD4 = 0, RD5 = 0, RD6 = 0, RD7 = 0, RD8 = 0, RD9 = 0, RDA = 0, RDB = 0, RDC = 0, RDD = 0, RDE = 0, RDF = 0, RE0 = 0, RE1 = 0, RE2 = 0, RE3 = 0, RE4 = 0, RE5 = 0, RE6 = 0, RE7 = 0, RE8 = 0, RE9 = 0, REA = 0, REB = 0, REC = 0, RED = 0, REE = 0, REF = 0; | |
15004 | var HEAP = new stdlib.Uint8Array(buffer); | |
15005 | function _expand_key_128() { | |
15006 | var sbox = 0; | |
15007 | R10 = R00 ^ HEAP[sbox | R0D] ^ 1; | |
15008 | R11 = R01 ^ HEAP[sbox | R0E]; | |
15009 | R12 = R02 ^ HEAP[sbox | R0F]; | |
15010 | R13 = R03 ^ HEAP[sbox | R0C]; | |
15011 | R14 = R04 ^ R10; | |
15012 | R15 = R05 ^ R11; | |
15013 | R16 = R06 ^ R12; | |
15014 | R17 = R07 ^ R13; | |
15015 | R18 = R08 ^ R14; | |
15016 | R19 = R09 ^ R15; | |
15017 | R1A = R0A ^ R16; | |
15018 | R1B = R0B ^ R17; | |
15019 | R1C = R0C ^ R18; | |
15020 | R1D = R0D ^ R19; | |
15021 | R1E = R0E ^ R1A; | |
15022 | R1F = R0F ^ R1B; | |
15023 | R20 = R10 ^ HEAP[sbox | R1D] ^ 2; | |
15024 | R21 = R11 ^ HEAP[sbox | R1E]; | |
15025 | R22 = R12 ^ HEAP[sbox | R1F]; | |
15026 | R23 = R13 ^ HEAP[sbox | R1C]; | |
15027 | R24 = R14 ^ R20; | |
15028 | R25 = R15 ^ R21; | |
15029 | R26 = R16 ^ R22; | |
15030 | R27 = R17 ^ R23; | |
15031 | R28 = R18 ^ R24; | |
15032 | R29 = R19 ^ R25; | |
15033 | R2A = R1A ^ R26; | |
15034 | R2B = R1B ^ R27; | |
15035 | R2C = R1C ^ R28; | |
15036 | R2D = R1D ^ R29; | |
15037 | R2E = R1E ^ R2A; | |
15038 | R2F = R1F ^ R2B; | |
15039 | R30 = R20 ^ HEAP[sbox | R2D] ^ 4; | |
15040 | R31 = R21 ^ HEAP[sbox | R2E]; | |
15041 | R32 = R22 ^ HEAP[sbox | R2F]; | |
15042 | R33 = R23 ^ HEAP[sbox | R2C]; | |
15043 | R34 = R24 ^ R30; | |
15044 | R35 = R25 ^ R31; | |
15045 | R36 = R26 ^ R32; | |
15046 | R37 = R27 ^ R33; | |
15047 | R38 = R28 ^ R34; | |
15048 | R39 = R29 ^ R35; | |
15049 | R3A = R2A ^ R36; | |
15050 | R3B = R2B ^ R37; | |
15051 | R3C = R2C ^ R38; | |
15052 | R3D = R2D ^ R39; | |
15053 | R3E = R2E ^ R3A; | |
15054 | R3F = R2F ^ R3B; | |
15055 | R40 = R30 ^ HEAP[sbox | R3D] ^ 8; | |
15056 | R41 = R31 ^ HEAP[sbox | R3E]; | |
15057 | R42 = R32 ^ HEAP[sbox | R3F]; | |
15058 | R43 = R33 ^ HEAP[sbox | R3C]; | |
15059 | R44 = R34 ^ R40; | |
15060 | R45 = R35 ^ R41; | |
15061 | R46 = R36 ^ R42; | |
15062 | R47 = R37 ^ R43; | |
15063 | R48 = R38 ^ R44; | |
15064 | R49 = R39 ^ R45; | |
15065 | R4A = R3A ^ R46; | |
15066 | R4B = R3B ^ R47; | |
15067 | R4C = R3C ^ R48; | |
15068 | R4D = R3D ^ R49; | |
15069 | R4E = R3E ^ R4A; | |
15070 | R4F = R3F ^ R4B; | |
15071 | R50 = R40 ^ HEAP[sbox | R4D] ^ 16; | |
15072 | R51 = R41 ^ HEAP[sbox | R4E]; | |
15073 | R52 = R42 ^ HEAP[sbox | R4F]; | |
15074 | R53 = R43 ^ HEAP[sbox | R4C]; | |
15075 | R54 = R44 ^ R50; | |
15076 | R55 = R45 ^ R51; | |
15077 | R56 = R46 ^ R52; | |
15078 | R57 = R47 ^ R53; | |
15079 | R58 = R48 ^ R54; | |
15080 | R59 = R49 ^ R55; | |
15081 | R5A = R4A ^ R56; | |
15082 | R5B = R4B ^ R57; | |
15083 | R5C = R4C ^ R58; | |
15084 | R5D = R4D ^ R59; | |
15085 | R5E = R4E ^ R5A; | |
15086 | R5F = R4F ^ R5B; | |
15087 | R60 = R50 ^ HEAP[sbox | R5D] ^ 32; | |
15088 | R61 = R51 ^ HEAP[sbox | R5E]; | |
15089 | R62 = R52 ^ HEAP[sbox | R5F]; | |
15090 | R63 = R53 ^ HEAP[sbox | R5C]; | |
15091 | R64 = R54 ^ R60; | |
15092 | R65 = R55 ^ R61; | |
15093 | R66 = R56 ^ R62; | |
15094 | R67 = R57 ^ R63; | |
15095 | R68 = R58 ^ R64; | |
15096 | R69 = R59 ^ R65; | |
15097 | R6A = R5A ^ R66; | |
15098 | R6B = R5B ^ R67; | |
15099 | R6C = R5C ^ R68; | |
15100 | R6D = R5D ^ R69; | |
15101 | R6E = R5E ^ R6A; | |
15102 | R6F = R5F ^ R6B; | |
15103 | R70 = R60 ^ HEAP[sbox | R6D] ^ 64; | |
15104 | R71 = R61 ^ HEAP[sbox | R6E]; | |
15105 | R72 = R62 ^ HEAP[sbox | R6F]; | |
15106 | R73 = R63 ^ HEAP[sbox | R6C]; | |
15107 | R74 = R64 ^ R70; | |
15108 | R75 = R65 ^ R71; | |
15109 | R76 = R66 ^ R72; | |
15110 | R77 = R67 ^ R73; | |
15111 | R78 = R68 ^ R74; | |
15112 | R79 = R69 ^ R75; | |
15113 | R7A = R6A ^ R76; | |
15114 | R7B = R6B ^ R77; | |
15115 | R7C = R6C ^ R78; | |
15116 | R7D = R6D ^ R79; | |
15117 | R7E = R6E ^ R7A; | |
15118 | R7F = R6F ^ R7B; | |
15119 | R80 = R70 ^ HEAP[sbox | R7D] ^ 128; | |
15120 | R81 = R71 ^ HEAP[sbox | R7E]; | |
15121 | R82 = R72 ^ HEAP[sbox | R7F]; | |
15122 | R83 = R73 ^ HEAP[sbox | R7C]; | |
15123 | R84 = R74 ^ R80; | |
15124 | R85 = R75 ^ R81; | |
15125 | R86 = R76 ^ R82; | |
15126 | R87 = R77 ^ R83; | |
15127 | R88 = R78 ^ R84; | |
15128 | R89 = R79 ^ R85; | |
15129 | R8A = R7A ^ R86; | |
15130 | R8B = R7B ^ R87; | |
15131 | R8C = R7C ^ R88; | |
15132 | R8D = R7D ^ R89; | |
15133 | R8E = R7E ^ R8A; | |
15134 | R8F = R7F ^ R8B; | |
15135 | R90 = R80 ^ HEAP[sbox | R8D] ^ 27; | |
15136 | R91 = R81 ^ HEAP[sbox | R8E]; | |
15137 | R92 = R82 ^ HEAP[sbox | R8F]; | |
15138 | R93 = R83 ^ HEAP[sbox | R8C]; | |
15139 | R94 = R84 ^ R90; | |
15140 | R95 = R85 ^ R91; | |
15141 | R96 = R86 ^ R92; | |
15142 | R97 = R87 ^ R93; | |
15143 | R98 = R88 ^ R94; | |
15144 | R99 = R89 ^ R95; | |
15145 | R9A = R8A ^ R96; | |
15146 | R9B = R8B ^ R97; | |
15147 | R9C = R8C ^ R98; | |
15148 | R9D = R8D ^ R99; | |
15149 | R9E = R8E ^ R9A; | |
15150 | R9F = R8F ^ R9B; | |
15151 | RA0 = R90 ^ HEAP[sbox | R9D] ^ 54; | |
15152 | RA1 = R91 ^ HEAP[sbox | R9E]; | |
15153 | RA2 = R92 ^ HEAP[sbox | R9F]; | |
15154 | RA3 = R93 ^ HEAP[sbox | R9C]; | |
15155 | RA4 = R94 ^ RA0; | |
15156 | RA5 = R95 ^ RA1; | |
15157 | RA6 = R96 ^ RA2; | |
15158 | RA7 = R97 ^ RA3; | |
15159 | RA8 = R98 ^ RA4; | |
15160 | RA9 = R99 ^ RA5; | |
15161 | RAA = R9A ^ RA6; | |
15162 | RAB = R9B ^ RA7; | |
15163 | RAC = R9C ^ RA8; | |
15164 | RAD = R9D ^ RA9; | |
15165 | RAE = R9E ^ RAA; | |
15166 | RAF = R9F ^ RAB; | |
15167 | } | |
15168 | function _expand_key_256() { | |
15169 | var sbox = 0; | |
15170 | R20 = R00 ^ HEAP[sbox | R1D] ^ 1; | |
15171 | R21 = R01 ^ HEAP[sbox | R1E]; | |
15172 | R22 = R02 ^ HEAP[sbox | R1F]; | |
15173 | R23 = R03 ^ HEAP[sbox | R1C]; | |
15174 | R24 = R04 ^ R20; | |
15175 | R25 = R05 ^ R21; | |
15176 | R26 = R06 ^ R22; | |
15177 | R27 = R07 ^ R23; | |
15178 | R28 = R08 ^ R24; | |
15179 | R29 = R09 ^ R25; | |
15180 | R2A = R0A ^ R26; | |
15181 | R2B = R0B ^ R27; | |
15182 | R2C = R0C ^ R28; | |
15183 | R2D = R0D ^ R29; | |
15184 | R2E = R0E ^ R2A; | |
15185 | R2F = R0F ^ R2B; | |
15186 | R30 = R10 ^ HEAP[sbox | R2C]; | |
15187 | R31 = R11 ^ HEAP[sbox | R2D]; | |
15188 | R32 = R12 ^ HEAP[sbox | R2E]; | |
15189 | R33 = R13 ^ HEAP[sbox | R2F]; | |
15190 | R34 = R14 ^ R30; | |
15191 | R35 = R15 ^ R31; | |
15192 | R36 = R16 ^ R32; | |
15193 | R37 = R17 ^ R33; | |
15194 | R38 = R18 ^ R34; | |
15195 | R39 = R19 ^ R35; | |
15196 | R3A = R1A ^ R36; | |
15197 | R3B = R1B ^ R37; | |
15198 | R3C = R1C ^ R38; | |
15199 | R3D = R1D ^ R39; | |
15200 | R3E = R1E ^ R3A; | |
15201 | R3F = R1F ^ R3B; | |
15202 | R40 = R20 ^ HEAP[sbox | R3D] ^ 2; | |
15203 | R41 = R21 ^ HEAP[sbox | R3E]; | |
15204 | R42 = R22 ^ HEAP[sbox | R3F]; | |
15205 | R43 = R23 ^ HEAP[sbox | R3C]; | |
15206 | R44 = R24 ^ R40; | |
15207 | R45 = R25 ^ R41; | |
15208 | R46 = R26 ^ R42; | |
15209 | R47 = R27 ^ R43; | |
15210 | R48 = R28 ^ R44; | |
15211 | R49 = R29 ^ R45; | |
15212 | R4A = R2A ^ R46; | |
15213 | R4B = R2B ^ R47; | |
15214 | R4C = R2C ^ R48; | |
15215 | R4D = R2D ^ R49; | |
15216 | R4E = R2E ^ R4A; | |
15217 | R4F = R2F ^ R4B; | |
15218 | R50 = R30 ^ HEAP[sbox | R4C]; | |
15219 | R51 = R31 ^ HEAP[sbox | R4D]; | |
15220 | R52 = R32 ^ HEAP[sbox | R4E]; | |
15221 | R53 = R33 ^ HEAP[sbox | R4F]; | |
15222 | R54 = R34 ^ R50; | |
15223 | R55 = R35 ^ R51; | |
15224 | R56 = R36 ^ R52; | |
15225 | R57 = R37 ^ R53; | |
15226 | R58 = R38 ^ R54; | |
15227 | R59 = R39 ^ R55; | |
15228 | R5A = R3A ^ R56; | |
15229 | R5B = R3B ^ R57; | |
15230 | R5C = R3C ^ R58; | |
15231 | R5D = R3D ^ R59; | |
15232 | R5E = R3E ^ R5A; | |
15233 | R5F = R3F ^ R5B; | |
15234 | R60 = R40 ^ HEAP[sbox | R5D] ^ 4; | |
15235 | R61 = R41 ^ HEAP[sbox | R5E]; | |
15236 | R62 = R42 ^ HEAP[sbox | R5F]; | |
15237 | R63 = R43 ^ HEAP[sbox | R5C]; | |
15238 | R64 = R44 ^ R60; | |
15239 | R65 = R45 ^ R61; | |
15240 | R66 = R46 ^ R62; | |
15241 | R67 = R47 ^ R63; | |
15242 | R68 = R48 ^ R64; | |
15243 | R69 = R49 ^ R65; | |
15244 | R6A = R4A ^ R66; | |
15245 | R6B = R4B ^ R67; | |
15246 | R6C = R4C ^ R68; | |
15247 | R6D = R4D ^ R69; | |
15248 | R6E = R4E ^ R6A; | |
15249 | R6F = R4F ^ R6B; | |
15250 | R70 = R50 ^ HEAP[sbox | R6C]; | |
15251 | R71 = R51 ^ HEAP[sbox | R6D]; | |
15252 | R72 = R52 ^ HEAP[sbox | R6E]; | |
15253 | R73 = R53 ^ HEAP[sbox | R6F]; | |
15254 | R74 = R54 ^ R70; | |
15255 | R75 = R55 ^ R71; | |
15256 | R76 = R56 ^ R72; | |
15257 | R77 = R57 ^ R73; | |
15258 | R78 = R58 ^ R74; | |
15259 | R79 = R59 ^ R75; | |
15260 | R7A = R5A ^ R76; | |
15261 | R7B = R5B ^ R77; | |
15262 | R7C = R5C ^ R78; | |
15263 | R7D = R5D ^ R79; | |
15264 | R7E = R5E ^ R7A; | |
15265 | R7F = R5F ^ R7B; | |
15266 | R80 = R60 ^ HEAP[sbox | R7D] ^ 8; | |
15267 | R81 = R61 ^ HEAP[sbox | R7E]; | |
15268 | R82 = R62 ^ HEAP[sbox | R7F]; | |
15269 | R83 = R63 ^ HEAP[sbox | R7C]; | |
15270 | R84 = R64 ^ R80; | |
15271 | R85 = R65 ^ R81; | |
15272 | R86 = R66 ^ R82; | |
15273 | R87 = R67 ^ R83; | |
15274 | R88 = R68 ^ R84; | |
15275 | R89 = R69 ^ R85; | |
15276 | R8A = R6A ^ R86; | |
15277 | R8B = R6B ^ R87; | |
15278 | R8C = R6C ^ R88; | |
15279 | R8D = R6D ^ R89; | |
15280 | R8E = R6E ^ R8A; | |
15281 | R8F = R6F ^ R8B; | |
15282 | R90 = R70 ^ HEAP[sbox | R8C]; | |
15283 | R91 = R71 ^ HEAP[sbox | R8D]; | |
15284 | R92 = R72 ^ HEAP[sbox | R8E]; | |
15285 | R93 = R73 ^ HEAP[sbox | R8F]; | |
15286 | R94 = R74 ^ R90; | |
15287 | R95 = R75 ^ R91; | |
15288 | R96 = R76 ^ R92; | |
15289 | R97 = R77 ^ R93; | |
15290 | R98 = R78 ^ R94; | |
15291 | R99 = R79 ^ R95; | |
15292 | R9A = R7A ^ R96; | |
15293 | R9B = R7B ^ R97; | |
15294 | R9C = R7C ^ R98; | |
15295 | R9D = R7D ^ R99; | |
15296 | R9E = R7E ^ R9A; | |
15297 | R9F = R7F ^ R9B; | |
15298 | RA0 = R80 ^ HEAP[sbox | R9D] ^ 16; | |
15299 | RA1 = R81 ^ HEAP[sbox | R9E]; | |
15300 | RA2 = R82 ^ HEAP[sbox | R9F]; | |
15301 | RA3 = R83 ^ HEAP[sbox | R9C]; | |
15302 | RA4 = R84 ^ RA0; | |
15303 | RA5 = R85 ^ RA1; | |
15304 | RA6 = R86 ^ RA2; | |
15305 | RA7 = R87 ^ RA3; | |
15306 | RA8 = R88 ^ RA4; | |
15307 | RA9 = R89 ^ RA5; | |
15308 | RAA = R8A ^ RA6; | |
15309 | RAB = R8B ^ RA7; | |
15310 | RAC = R8C ^ RA8; | |
15311 | RAD = R8D ^ RA9; | |
15312 | RAE = R8E ^ RAA; | |
15313 | RAF = R8F ^ RAB; | |
15314 | RB0 = R90 ^ HEAP[sbox | RAC]; | |
15315 | RB1 = R91 ^ HEAP[sbox | RAD]; | |
15316 | RB2 = R92 ^ HEAP[sbox | RAE]; | |
15317 | RB3 = R93 ^ HEAP[sbox | RAF]; | |
15318 | RB4 = R94 ^ RB0; | |
15319 | RB5 = R95 ^ RB1; | |
15320 | RB6 = R96 ^ RB2; | |
15321 | RB7 = R97 ^ RB3; | |
15322 | RB8 = R98 ^ RB4; | |
15323 | RB9 = R99 ^ RB5; | |
15324 | RBA = R9A ^ RB6; | |
15325 | RBB = R9B ^ RB7; | |
15326 | RBC = R9C ^ RB8; | |
15327 | RBD = R9D ^ RB9; | |
15328 | RBE = R9E ^ RBA; | |
15329 | RBF = R9F ^ RBB; | |
15330 | RC0 = RA0 ^ HEAP[sbox | RBD] ^ 32; | |
15331 | RC1 = RA1 ^ HEAP[sbox | RBE]; | |
15332 | RC2 = RA2 ^ HEAP[sbox | RBF]; | |
15333 | RC3 = RA3 ^ HEAP[sbox | RBC]; | |
15334 | RC4 = RA4 ^ RC0; | |
15335 | RC5 = RA5 ^ RC1; | |
15336 | RC6 = RA6 ^ RC2; | |
15337 | RC7 = RA7 ^ RC3; | |
15338 | RC8 = RA8 ^ RC4; | |
15339 | RC9 = RA9 ^ RC5; | |
15340 | RCA = RAA ^ RC6; | |
15341 | RCB = RAB ^ RC7; | |
15342 | RCC = RAC ^ RC8; | |
15343 | RCD = RAD ^ RC9; | |
15344 | RCE = RAE ^ RCA; | |
15345 | RCF = RAF ^ RCB; | |
15346 | RD0 = RB0 ^ HEAP[sbox | RCC]; | |
15347 | RD1 = RB1 ^ HEAP[sbox | RCD]; | |
15348 | RD2 = RB2 ^ HEAP[sbox | RCE]; | |
15349 | RD3 = RB3 ^ HEAP[sbox | RCF]; | |
15350 | RD4 = RB4 ^ RD0; | |
15351 | RD5 = RB5 ^ RD1; | |
15352 | RD6 = RB6 ^ RD2; | |
15353 | RD7 = RB7 ^ RD3; | |
15354 | RD8 = RB8 ^ RD4; | |
15355 | RD9 = RB9 ^ RD5; | |
15356 | RDA = RBA ^ RD6; | |
15357 | RDB = RBB ^ RD7; | |
15358 | RDC = RBC ^ RD8; | |
15359 | RDD = RBD ^ RD9; | |
15360 | RDE = RBE ^ RDA; | |
15361 | RDF = RBF ^ RDB; | |
15362 | RE0 = RC0 ^ HEAP[sbox | RDD] ^ 64; | |
15363 | RE1 = RC1 ^ HEAP[sbox | RDE]; | |
15364 | RE2 = RC2 ^ HEAP[sbox | RDF]; | |
15365 | RE3 = RC3 ^ HEAP[sbox | RDC]; | |
15366 | RE4 = RC4 ^ RE0; | |
15367 | RE5 = RC5 ^ RE1; | |
15368 | RE6 = RC6 ^ RE2; | |
15369 | RE7 = RC7 ^ RE3; | |
15370 | RE8 = RC8 ^ RE4; | |
15371 | RE9 = RC9 ^ RE5; | |
15372 | REA = RCA ^ RE6; | |
15373 | REB = RCB ^ RE7; | |
15374 | REC = RCC ^ RE8; | |
15375 | RED = RCD ^ RE9; | |
15376 | REE = RCE ^ REA; | |
15377 | REF = RCF ^ REB; | |
15378 | } | |
15379 | function _encrypt(s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF) { | |
15380 | s0 = s0 | 0; | |
15381 | s1 = s1 | 0; | |
15382 | s2 = s2 | 0; | |
15383 | s3 = s3 | 0; | |
15384 | s4 = s4 | 0; | |
15385 | s5 = s5 | 0; | |
15386 | s6 = s6 | 0; | |
15387 | s7 = s7 | 0; | |
15388 | s8 = s8 | 0; | |
15389 | s9 = s9 | 0; | |
15390 | sA = sA | 0; | |
15391 | sB = sB | 0; | |
15392 | sC = sC | 0; | |
15393 | sD = sD | 0; | |
15394 | sE = sE | 0; | |
15395 | sF = sF | 0; | |
15396 | var t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, t8 = 0, t9 = 0, tA = 0, tB = 0, tC = 0, tD = 0, tE = 0, tF = 0, sbox = 0, x2_sbox = 512, x3_sbox = 768; | |
15397 | s0 = s0 ^ R00; | |
15398 | s1 = s1 ^ R01; | |
15399 | s2 = s2 ^ R02; | |
15400 | s3 = s3 ^ R03; | |
15401 | s4 = s4 ^ R04; | |
15402 | s5 = s5 ^ R05; | |
15403 | s6 = s6 ^ R06; | |
15404 | s7 = s7 ^ R07; | |
15405 | s8 = s8 ^ R08; | |
15406 | s9 = s9 ^ R09; | |
15407 | sA = sA ^ R0A; | |
15408 | sB = sB ^ R0B; | |
15409 | sC = sC ^ R0C; | |
15410 | sD = sD ^ R0D; | |
15411 | sE = sE ^ R0E; | |
15412 | sF = sF ^ R0F; | |
15413 | t0 = HEAP[x2_sbox | s0] ^ HEAP[x3_sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[sbox | sF] ^ R10; | |
15414 | t1 = HEAP[sbox | s0] ^ HEAP[x2_sbox | s5] ^ HEAP[x3_sbox | sA] ^ HEAP[sbox | sF] ^ R11; | |
15415 | t2 = HEAP[sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[x2_sbox | sA] ^ HEAP[x3_sbox | sF] ^ R12; | |
15416 | t3 = HEAP[x3_sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[x2_sbox | sF] ^ R13; | |
15417 | t4 = HEAP[x2_sbox | s4] ^ HEAP[x3_sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[sbox | s3] ^ R14; | |
15418 | t5 = HEAP[sbox | s4] ^ HEAP[x2_sbox | s9] ^ HEAP[x3_sbox | sE] ^ HEAP[sbox | s3] ^ R15; | |
15419 | t6 = HEAP[sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[x2_sbox | sE] ^ HEAP[x3_sbox | s3] ^ R16; | |
15420 | t7 = HEAP[x3_sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[x2_sbox | s3] ^ R17; | |
15421 | t8 = HEAP[x2_sbox | s8] ^ HEAP[x3_sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[sbox | s7] ^ R18; | |
15422 | t9 = HEAP[sbox | s8] ^ HEAP[x2_sbox | sD] ^ HEAP[x3_sbox | s2] ^ HEAP[sbox | s7] ^ R19; | |
15423 | tA = HEAP[sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[x2_sbox | s2] ^ HEAP[x3_sbox | s7] ^ R1A; | |
15424 | tB = HEAP[x3_sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[x2_sbox | s7] ^ R1B; | |
15425 | tC = HEAP[x2_sbox | sC] ^ HEAP[x3_sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[sbox | sB] ^ R1C; | |
15426 | tD = HEAP[sbox | sC] ^ HEAP[x2_sbox | s1] ^ HEAP[x3_sbox | s6] ^ HEAP[sbox | sB] ^ R1D; | |
15427 | tE = HEAP[sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[x2_sbox | s6] ^ HEAP[x3_sbox | sB] ^ R1E; | |
15428 | tF = HEAP[x3_sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[x2_sbox | sB] ^ R1F; | |
15429 | s0 = HEAP[x2_sbox | t0] ^ HEAP[x3_sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[sbox | tF] ^ R20; | |
15430 | s1 = HEAP[sbox | t0] ^ HEAP[x2_sbox | t5] ^ HEAP[x3_sbox | tA] ^ HEAP[sbox | tF] ^ R21; | |
15431 | s2 = HEAP[sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[x2_sbox | tA] ^ HEAP[x3_sbox | tF] ^ R22; | |
15432 | s3 = HEAP[x3_sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[x2_sbox | tF] ^ R23; | |
15433 | s4 = HEAP[x2_sbox | t4] ^ HEAP[x3_sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[sbox | t3] ^ R24; | |
15434 | s5 = HEAP[sbox | t4] ^ HEAP[x2_sbox | t9] ^ HEAP[x3_sbox | tE] ^ HEAP[sbox | t3] ^ R25; | |
15435 | s6 = HEAP[sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[x2_sbox | tE] ^ HEAP[x3_sbox | t3] ^ R26; | |
15436 | s7 = HEAP[x3_sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[x2_sbox | t3] ^ R27; | |
15437 | s8 = HEAP[x2_sbox | t8] ^ HEAP[x3_sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[sbox | t7] ^ R28; | |
15438 | s9 = HEAP[sbox | t8] ^ HEAP[x2_sbox | tD] ^ HEAP[x3_sbox | t2] ^ HEAP[sbox | t7] ^ R29; | |
15439 | sA = HEAP[sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[x2_sbox | t2] ^ HEAP[x3_sbox | t7] ^ R2A; | |
15440 | sB = HEAP[x3_sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[x2_sbox | t7] ^ R2B; | |
15441 | sC = HEAP[x2_sbox | tC] ^ HEAP[x3_sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[sbox | tB] ^ R2C; | |
15442 | sD = HEAP[sbox | tC] ^ HEAP[x2_sbox | t1] ^ HEAP[x3_sbox | t6] ^ HEAP[sbox | tB] ^ R2D; | |
15443 | sE = HEAP[sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[x2_sbox | t6] ^ HEAP[x3_sbox | tB] ^ R2E; | |
15444 | sF = HEAP[x3_sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[x2_sbox | tB] ^ R2F; | |
15445 | t0 = HEAP[x2_sbox | s0] ^ HEAP[x3_sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[sbox | sF] ^ R30; | |
15446 | t1 = HEAP[sbox | s0] ^ HEAP[x2_sbox | s5] ^ HEAP[x3_sbox | sA] ^ HEAP[sbox | sF] ^ R31; | |
15447 | t2 = HEAP[sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[x2_sbox | sA] ^ HEAP[x3_sbox | sF] ^ R32; | |
15448 | t3 = HEAP[x3_sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[x2_sbox | sF] ^ R33; | |
15449 | t4 = HEAP[x2_sbox | s4] ^ HEAP[x3_sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[sbox | s3] ^ R34; | |
15450 | t5 = HEAP[sbox | s4] ^ HEAP[x2_sbox | s9] ^ HEAP[x3_sbox | sE] ^ HEAP[sbox | s3] ^ R35; | |
15451 | t6 = HEAP[sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[x2_sbox | sE] ^ HEAP[x3_sbox | s3] ^ R36; | |
15452 | t7 = HEAP[x3_sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[x2_sbox | s3] ^ R37; | |
15453 | t8 = HEAP[x2_sbox | s8] ^ HEAP[x3_sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[sbox | s7] ^ R38; | |
15454 | t9 = HEAP[sbox | s8] ^ HEAP[x2_sbox | sD] ^ HEAP[x3_sbox | s2] ^ HEAP[sbox | s7] ^ R39; | |
15455 | tA = HEAP[sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[x2_sbox | s2] ^ HEAP[x3_sbox | s7] ^ R3A; | |
15456 | tB = HEAP[x3_sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[x2_sbox | s7] ^ R3B; | |
15457 | tC = HEAP[x2_sbox | sC] ^ HEAP[x3_sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[sbox | sB] ^ R3C; | |
15458 | tD = HEAP[sbox | sC] ^ HEAP[x2_sbox | s1] ^ HEAP[x3_sbox | s6] ^ HEAP[sbox | sB] ^ R3D; | |
15459 | tE = HEAP[sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[x2_sbox | s6] ^ HEAP[x3_sbox | sB] ^ R3E; | |
15460 | tF = HEAP[x3_sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[x2_sbox | sB] ^ R3F; | |
15461 | s0 = HEAP[x2_sbox | t0] ^ HEAP[x3_sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[sbox | tF] ^ R40; | |
15462 | s1 = HEAP[sbox | t0] ^ HEAP[x2_sbox | t5] ^ HEAP[x3_sbox | tA] ^ HEAP[sbox | tF] ^ R41; | |
15463 | s2 = HEAP[sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[x2_sbox | tA] ^ HEAP[x3_sbox | tF] ^ R42; | |
15464 | s3 = HEAP[x3_sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[x2_sbox | tF] ^ R43; | |
15465 | s4 = HEAP[x2_sbox | t4] ^ HEAP[x3_sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[sbox | t3] ^ R44; | |
15466 | s5 = HEAP[sbox | t4] ^ HEAP[x2_sbox | t9] ^ HEAP[x3_sbox | tE] ^ HEAP[sbox | t3] ^ R45; | |
15467 | s6 = HEAP[sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[x2_sbox | tE] ^ HEAP[x3_sbox | t3] ^ R46; | |
15468 | s7 = HEAP[x3_sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[x2_sbox | t3] ^ R47; | |
15469 | s8 = HEAP[x2_sbox | t8] ^ HEAP[x3_sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[sbox | t7] ^ R48; | |
15470 | s9 = HEAP[sbox | t8] ^ HEAP[x2_sbox | tD] ^ HEAP[x3_sbox | t2] ^ HEAP[sbox | t7] ^ R49; | |
15471 | sA = HEAP[sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[x2_sbox | t2] ^ HEAP[x3_sbox | t7] ^ R4A; | |
15472 | sB = HEAP[x3_sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[x2_sbox | t7] ^ R4B; | |
15473 | sC = HEAP[x2_sbox | tC] ^ HEAP[x3_sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[sbox | tB] ^ R4C; | |
15474 | sD = HEAP[sbox | tC] ^ HEAP[x2_sbox | t1] ^ HEAP[x3_sbox | t6] ^ HEAP[sbox | tB] ^ R4D; | |
15475 | sE = HEAP[sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[x2_sbox | t6] ^ HEAP[x3_sbox | tB] ^ R4E; | |
15476 | sF = HEAP[x3_sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[x2_sbox | tB] ^ R4F; | |
15477 | t0 = HEAP[x2_sbox | s0] ^ HEAP[x3_sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[sbox | sF] ^ R50; | |
15478 | t1 = HEAP[sbox | s0] ^ HEAP[x2_sbox | s5] ^ HEAP[x3_sbox | sA] ^ HEAP[sbox | sF] ^ R51; | |
15479 | t2 = HEAP[sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[x2_sbox | sA] ^ HEAP[x3_sbox | sF] ^ R52; | |
15480 | t3 = HEAP[x3_sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[x2_sbox | sF] ^ R53; | |
15481 | t4 = HEAP[x2_sbox | s4] ^ HEAP[x3_sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[sbox | s3] ^ R54; | |
15482 | t5 = HEAP[sbox | s4] ^ HEAP[x2_sbox | s9] ^ HEAP[x3_sbox | sE] ^ HEAP[sbox | s3] ^ R55; | |
15483 | t6 = HEAP[sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[x2_sbox | sE] ^ HEAP[x3_sbox | s3] ^ R56; | |
15484 | t7 = HEAP[x3_sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[x2_sbox | s3] ^ R57; | |
15485 | t8 = HEAP[x2_sbox | s8] ^ HEAP[x3_sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[sbox | s7] ^ R58; | |
15486 | t9 = HEAP[sbox | s8] ^ HEAP[x2_sbox | sD] ^ HEAP[x3_sbox | s2] ^ HEAP[sbox | s7] ^ R59; | |
15487 | tA = HEAP[sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[x2_sbox | s2] ^ HEAP[x3_sbox | s7] ^ R5A; | |
15488 | tB = HEAP[x3_sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[x2_sbox | s7] ^ R5B; | |
15489 | tC = HEAP[x2_sbox | sC] ^ HEAP[x3_sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[sbox | sB] ^ R5C; | |
15490 | tD = HEAP[sbox | sC] ^ HEAP[x2_sbox | s1] ^ HEAP[x3_sbox | s6] ^ HEAP[sbox | sB] ^ R5D; | |
15491 | tE = HEAP[sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[x2_sbox | s6] ^ HEAP[x3_sbox | sB] ^ R5E; | |
15492 | tF = HEAP[x3_sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[x2_sbox | sB] ^ R5F; | |
15493 | s0 = HEAP[x2_sbox | t0] ^ HEAP[x3_sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[sbox | tF] ^ R60; | |
15494 | s1 = HEAP[sbox | t0] ^ HEAP[x2_sbox | t5] ^ HEAP[x3_sbox | tA] ^ HEAP[sbox | tF] ^ R61; | |
15495 | s2 = HEAP[sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[x2_sbox | tA] ^ HEAP[x3_sbox | tF] ^ R62; | |
15496 | s3 = HEAP[x3_sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[x2_sbox | tF] ^ R63; | |
15497 | s4 = HEAP[x2_sbox | t4] ^ HEAP[x3_sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[sbox | t3] ^ R64; | |
15498 | s5 = HEAP[sbox | t4] ^ HEAP[x2_sbox | t9] ^ HEAP[x3_sbox | tE] ^ HEAP[sbox | t3] ^ R65; | |
15499 | s6 = HEAP[sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[x2_sbox | tE] ^ HEAP[x3_sbox | t3] ^ R66; | |
15500 | s7 = HEAP[x3_sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[x2_sbox | t3] ^ R67; | |
15501 | s8 = HEAP[x2_sbox | t8] ^ HEAP[x3_sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[sbox | t7] ^ R68; | |
15502 | s9 = HEAP[sbox | t8] ^ HEAP[x2_sbox | tD] ^ HEAP[x3_sbox | t2] ^ HEAP[sbox | t7] ^ R69; | |
15503 | sA = HEAP[sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[x2_sbox | t2] ^ HEAP[x3_sbox | t7] ^ R6A; | |
15504 | sB = HEAP[x3_sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[x2_sbox | t7] ^ R6B; | |
15505 | sC = HEAP[x2_sbox | tC] ^ HEAP[x3_sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[sbox | tB] ^ R6C; | |
15506 | sD = HEAP[sbox | tC] ^ HEAP[x2_sbox | t1] ^ HEAP[x3_sbox | t6] ^ HEAP[sbox | tB] ^ R6D; | |
15507 | sE = HEAP[sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[x2_sbox | t6] ^ HEAP[x3_sbox | tB] ^ R6E; | |
15508 | sF = HEAP[x3_sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[x2_sbox | tB] ^ R6F; | |
15509 | t0 = HEAP[x2_sbox | s0] ^ HEAP[x3_sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[sbox | sF] ^ R70; | |
15510 | t1 = HEAP[sbox | s0] ^ HEAP[x2_sbox | s5] ^ HEAP[x3_sbox | sA] ^ HEAP[sbox | sF] ^ R71; | |
15511 | t2 = HEAP[sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[x2_sbox | sA] ^ HEAP[x3_sbox | sF] ^ R72; | |
15512 | t3 = HEAP[x3_sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[x2_sbox | sF] ^ R73; | |
15513 | t4 = HEAP[x2_sbox | s4] ^ HEAP[x3_sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[sbox | s3] ^ R74; | |
15514 | t5 = HEAP[sbox | s4] ^ HEAP[x2_sbox | s9] ^ HEAP[x3_sbox | sE] ^ HEAP[sbox | s3] ^ R75; | |
15515 | t6 = HEAP[sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[x2_sbox | sE] ^ HEAP[x3_sbox | s3] ^ R76; | |
15516 | t7 = HEAP[x3_sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[x2_sbox | s3] ^ R77; | |
15517 | t8 = HEAP[x2_sbox | s8] ^ HEAP[x3_sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[sbox | s7] ^ R78; | |
15518 | t9 = HEAP[sbox | s8] ^ HEAP[x2_sbox | sD] ^ HEAP[x3_sbox | s2] ^ HEAP[sbox | s7] ^ R79; | |
15519 | tA = HEAP[sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[x2_sbox | s2] ^ HEAP[x3_sbox | s7] ^ R7A; | |
15520 | tB = HEAP[x3_sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[x2_sbox | s7] ^ R7B; | |
15521 | tC = HEAP[x2_sbox | sC] ^ HEAP[x3_sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[sbox | sB] ^ R7C; | |
15522 | tD = HEAP[sbox | sC] ^ HEAP[x2_sbox | s1] ^ HEAP[x3_sbox | s6] ^ HEAP[sbox | sB] ^ R7D; | |
15523 | tE = HEAP[sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[x2_sbox | s6] ^ HEAP[x3_sbox | sB] ^ R7E; | |
15524 | tF = HEAP[x3_sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[x2_sbox | sB] ^ R7F; | |
15525 | s0 = HEAP[x2_sbox | t0] ^ HEAP[x3_sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[sbox | tF] ^ R80; | |
15526 | s1 = HEAP[sbox | t0] ^ HEAP[x2_sbox | t5] ^ HEAP[x3_sbox | tA] ^ HEAP[sbox | tF] ^ R81; | |
15527 | s2 = HEAP[sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[x2_sbox | tA] ^ HEAP[x3_sbox | tF] ^ R82; | |
15528 | s3 = HEAP[x3_sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[x2_sbox | tF] ^ R83; | |
15529 | s4 = HEAP[x2_sbox | t4] ^ HEAP[x3_sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[sbox | t3] ^ R84; | |
15530 | s5 = HEAP[sbox | t4] ^ HEAP[x2_sbox | t9] ^ HEAP[x3_sbox | tE] ^ HEAP[sbox | t3] ^ R85; | |
15531 | s6 = HEAP[sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[x2_sbox | tE] ^ HEAP[x3_sbox | t3] ^ R86; | |
15532 | s7 = HEAP[x3_sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[x2_sbox | t3] ^ R87; | |
15533 | s8 = HEAP[x2_sbox | t8] ^ HEAP[x3_sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[sbox | t7] ^ R88; | |
15534 | s9 = HEAP[sbox | t8] ^ HEAP[x2_sbox | tD] ^ HEAP[x3_sbox | t2] ^ HEAP[sbox | t7] ^ R89; | |
15535 | sA = HEAP[sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[x2_sbox | t2] ^ HEAP[x3_sbox | t7] ^ R8A; | |
15536 | sB = HEAP[x3_sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[x2_sbox | t7] ^ R8B; | |
15537 | sC = HEAP[x2_sbox | tC] ^ HEAP[x3_sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[sbox | tB] ^ R8C; | |
15538 | sD = HEAP[sbox | tC] ^ HEAP[x2_sbox | t1] ^ HEAP[x3_sbox | t6] ^ HEAP[sbox | tB] ^ R8D; | |
15539 | sE = HEAP[sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[x2_sbox | t6] ^ HEAP[x3_sbox | tB] ^ R8E; | |
15540 | sF = HEAP[x3_sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[x2_sbox | tB] ^ R8F; | |
15541 | t0 = HEAP[x2_sbox | s0] ^ HEAP[x3_sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[sbox | sF] ^ R90; | |
15542 | t1 = HEAP[sbox | s0] ^ HEAP[x2_sbox | s5] ^ HEAP[x3_sbox | sA] ^ HEAP[sbox | sF] ^ R91; | |
15543 | t2 = HEAP[sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[x2_sbox | sA] ^ HEAP[x3_sbox | sF] ^ R92; | |
15544 | t3 = HEAP[x3_sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[x2_sbox | sF] ^ R93; | |
15545 | t4 = HEAP[x2_sbox | s4] ^ HEAP[x3_sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[sbox | s3] ^ R94; | |
15546 | t5 = HEAP[sbox | s4] ^ HEAP[x2_sbox | s9] ^ HEAP[x3_sbox | sE] ^ HEAP[sbox | s3] ^ R95; | |
15547 | t6 = HEAP[sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[x2_sbox | sE] ^ HEAP[x3_sbox | s3] ^ R96; | |
15548 | t7 = HEAP[x3_sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[x2_sbox | s3] ^ R97; | |
15549 | t8 = HEAP[x2_sbox | s8] ^ HEAP[x3_sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[sbox | s7] ^ R98; | |
15550 | t9 = HEAP[sbox | s8] ^ HEAP[x2_sbox | sD] ^ HEAP[x3_sbox | s2] ^ HEAP[sbox | s7] ^ R99; | |
15551 | tA = HEAP[sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[x2_sbox | s2] ^ HEAP[x3_sbox | s7] ^ R9A; | |
15552 | tB = HEAP[x3_sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[x2_sbox | s7] ^ R9B; | |
15553 | tC = HEAP[x2_sbox | sC] ^ HEAP[x3_sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[sbox | sB] ^ R9C; | |
15554 | tD = HEAP[sbox | sC] ^ HEAP[x2_sbox | s1] ^ HEAP[x3_sbox | s6] ^ HEAP[sbox | sB] ^ R9D; | |
15555 | tE = HEAP[sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[x2_sbox | s6] ^ HEAP[x3_sbox | sB] ^ R9E; | |
15556 | tF = HEAP[x3_sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[x2_sbox | sB] ^ R9F; | |
15557 | if ((keySize | 0) == 16) { | |
15558 | S0 = HEAP[sbox | t0] ^ RA0; | |
15559 | S1 = HEAP[sbox | t5] ^ RA1; | |
15560 | S2 = HEAP[sbox | tA] ^ RA2; | |
15561 | S3 = HEAP[sbox | tF] ^ RA3; | |
15562 | S4 = HEAP[sbox | t4] ^ RA4; | |
15563 | S5 = HEAP[sbox | t9] ^ RA5; | |
15564 | S6 = HEAP[sbox | tE] ^ RA6; | |
15565 | S7 = HEAP[sbox | t3] ^ RA7; | |
15566 | S8 = HEAP[sbox | t8] ^ RA8; | |
15567 | S9 = HEAP[sbox | tD] ^ RA9; | |
15568 | SA = HEAP[sbox | t2] ^ RAA; | |
15569 | SB = HEAP[sbox | t7] ^ RAB; | |
15570 | SC = HEAP[sbox | tC] ^ RAC; | |
15571 | SD = HEAP[sbox | t1] ^ RAD; | |
15572 | SE = HEAP[sbox | t6] ^ RAE; | |
15573 | SF = HEAP[sbox | tB] ^ RAF; | |
15574 | return; | |
15575 | } | |
15576 | s0 = HEAP[x2_sbox | t0] ^ HEAP[x3_sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[sbox | tF] ^ RA0; | |
15577 | s1 = HEAP[sbox | t0] ^ HEAP[x2_sbox | t5] ^ HEAP[x3_sbox | tA] ^ HEAP[sbox | tF] ^ RA1; | |
15578 | s2 = HEAP[sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[x2_sbox | tA] ^ HEAP[x3_sbox | tF] ^ RA2; | |
15579 | s3 = HEAP[x3_sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[x2_sbox | tF] ^ RA3; | |
15580 | s4 = HEAP[x2_sbox | t4] ^ HEAP[x3_sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[sbox | t3] ^ RA4; | |
15581 | s5 = HEAP[sbox | t4] ^ HEAP[x2_sbox | t9] ^ HEAP[x3_sbox | tE] ^ HEAP[sbox | t3] ^ RA5; | |
15582 | s6 = HEAP[sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[x2_sbox | tE] ^ HEAP[x3_sbox | t3] ^ RA6; | |
15583 | s7 = HEAP[x3_sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[x2_sbox | t3] ^ RA7; | |
15584 | s8 = HEAP[x2_sbox | t8] ^ HEAP[x3_sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[sbox | t7] ^ RA8; | |
15585 | s9 = HEAP[sbox | t8] ^ HEAP[x2_sbox | tD] ^ HEAP[x3_sbox | t2] ^ HEAP[sbox | t7] ^ RA9; | |
15586 | sA = HEAP[sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[x2_sbox | t2] ^ HEAP[x3_sbox | t7] ^ RAA; | |
15587 | sB = HEAP[x3_sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[x2_sbox | t7] ^ RAB; | |
15588 | sC = HEAP[x2_sbox | tC] ^ HEAP[x3_sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[sbox | tB] ^ RAC; | |
15589 | sD = HEAP[sbox | tC] ^ HEAP[x2_sbox | t1] ^ HEAP[x3_sbox | t6] ^ HEAP[sbox | tB] ^ RAD; | |
15590 | sE = HEAP[sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[x2_sbox | t6] ^ HEAP[x3_sbox | tB] ^ RAE; | |
15591 | sF = HEAP[x3_sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[x2_sbox | tB] ^ RAF; | |
15592 | t0 = HEAP[x2_sbox | s0] ^ HEAP[x3_sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[sbox | sF] ^ RB0; | |
15593 | t1 = HEAP[sbox | s0] ^ HEAP[x2_sbox | s5] ^ HEAP[x3_sbox | sA] ^ HEAP[sbox | sF] ^ RB1; | |
15594 | t2 = HEAP[sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[x2_sbox | sA] ^ HEAP[x3_sbox | sF] ^ RB2; | |
15595 | t3 = HEAP[x3_sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[x2_sbox | sF] ^ RB3; | |
15596 | t4 = HEAP[x2_sbox | s4] ^ HEAP[x3_sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[sbox | s3] ^ RB4; | |
15597 | t5 = HEAP[sbox | s4] ^ HEAP[x2_sbox | s9] ^ HEAP[x3_sbox | sE] ^ HEAP[sbox | s3] ^ RB5; | |
15598 | t6 = HEAP[sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[x2_sbox | sE] ^ HEAP[x3_sbox | s3] ^ RB6; | |
15599 | t7 = HEAP[x3_sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[x2_sbox | s3] ^ RB7; | |
15600 | t8 = HEAP[x2_sbox | s8] ^ HEAP[x3_sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[sbox | s7] ^ RB8; | |
15601 | t9 = HEAP[sbox | s8] ^ HEAP[x2_sbox | sD] ^ HEAP[x3_sbox | s2] ^ HEAP[sbox | s7] ^ RB9; | |
15602 | tA = HEAP[sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[x2_sbox | s2] ^ HEAP[x3_sbox | s7] ^ RBA; | |
15603 | tB = HEAP[x3_sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[x2_sbox | s7] ^ RBB; | |
15604 | tC = HEAP[x2_sbox | sC] ^ HEAP[x3_sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[sbox | sB] ^ RBC; | |
15605 | tD = HEAP[sbox | sC] ^ HEAP[x2_sbox | s1] ^ HEAP[x3_sbox | s6] ^ HEAP[sbox | sB] ^ RBD; | |
15606 | tE = HEAP[sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[x2_sbox | s6] ^ HEAP[x3_sbox | sB] ^ RBE; | |
15607 | tF = HEAP[x3_sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[x2_sbox | sB] ^ RBF; | |
15608 | s0 = HEAP[x2_sbox | t0] ^ HEAP[x3_sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[sbox | tF] ^ RC0; | |
15609 | s1 = HEAP[sbox | t0] ^ HEAP[x2_sbox | t5] ^ HEAP[x3_sbox | tA] ^ HEAP[sbox | tF] ^ RC1; | |
15610 | s2 = HEAP[sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[x2_sbox | tA] ^ HEAP[x3_sbox | tF] ^ RC2; | |
15611 | s3 = HEAP[x3_sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[x2_sbox | tF] ^ RC3; | |
15612 | s4 = HEAP[x2_sbox | t4] ^ HEAP[x3_sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[sbox | t3] ^ RC4; | |
15613 | s5 = HEAP[sbox | t4] ^ HEAP[x2_sbox | t9] ^ HEAP[x3_sbox | tE] ^ HEAP[sbox | t3] ^ RC5; | |
15614 | s6 = HEAP[sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[x2_sbox | tE] ^ HEAP[x3_sbox | t3] ^ RC6; | |
15615 | s7 = HEAP[x3_sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[x2_sbox | t3] ^ RC7; | |
15616 | s8 = HEAP[x2_sbox | t8] ^ HEAP[x3_sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[sbox | t7] ^ RC8; | |
15617 | s9 = HEAP[sbox | t8] ^ HEAP[x2_sbox | tD] ^ HEAP[x3_sbox | t2] ^ HEAP[sbox | t7] ^ RC9; | |
15618 | sA = HEAP[sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[x2_sbox | t2] ^ HEAP[x3_sbox | t7] ^ RCA; | |
15619 | sB = HEAP[x3_sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[x2_sbox | t7] ^ RCB; | |
15620 | sC = HEAP[x2_sbox | tC] ^ HEAP[x3_sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[sbox | tB] ^ RCC; | |
15621 | sD = HEAP[sbox | tC] ^ HEAP[x2_sbox | t1] ^ HEAP[x3_sbox | t6] ^ HEAP[sbox | tB] ^ RCD; | |
15622 | sE = HEAP[sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[x2_sbox | t6] ^ HEAP[x3_sbox | tB] ^ RCE; | |
15623 | sF = HEAP[x3_sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[x2_sbox | tB] ^ RCF; | |
15624 | t0 = HEAP[x2_sbox | s0] ^ HEAP[x3_sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[sbox | sF] ^ RD0; | |
15625 | t1 = HEAP[sbox | s0] ^ HEAP[x2_sbox | s5] ^ HEAP[x3_sbox | sA] ^ HEAP[sbox | sF] ^ RD1; | |
15626 | t2 = HEAP[sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[x2_sbox | sA] ^ HEAP[x3_sbox | sF] ^ RD2; | |
15627 | t3 = HEAP[x3_sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[x2_sbox | sF] ^ RD3; | |
15628 | t4 = HEAP[x2_sbox | s4] ^ HEAP[x3_sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[sbox | s3] ^ RD4; | |
15629 | t5 = HEAP[sbox | s4] ^ HEAP[x2_sbox | s9] ^ HEAP[x3_sbox | sE] ^ HEAP[sbox | s3] ^ RD5; | |
15630 | t6 = HEAP[sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[x2_sbox | sE] ^ HEAP[x3_sbox | s3] ^ RD6; | |
15631 | t7 = HEAP[x3_sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[x2_sbox | s3] ^ RD7; | |
15632 | t8 = HEAP[x2_sbox | s8] ^ HEAP[x3_sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[sbox | s7] ^ RD8; | |
15633 | t9 = HEAP[sbox | s8] ^ HEAP[x2_sbox | sD] ^ HEAP[x3_sbox | s2] ^ HEAP[sbox | s7] ^ RD9; | |
15634 | tA = HEAP[sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[x2_sbox | s2] ^ HEAP[x3_sbox | s7] ^ RDA; | |
15635 | tB = HEAP[x3_sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[x2_sbox | s7] ^ RDB; | |
15636 | tC = HEAP[x2_sbox | sC] ^ HEAP[x3_sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[sbox | sB] ^ RDC; | |
15637 | tD = HEAP[sbox | sC] ^ HEAP[x2_sbox | s1] ^ HEAP[x3_sbox | s6] ^ HEAP[sbox | sB] ^ RDD; | |
15638 | tE = HEAP[sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[x2_sbox | s6] ^ HEAP[x3_sbox | sB] ^ RDE; | |
15639 | tF = HEAP[x3_sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[x2_sbox | sB] ^ RDF; | |
15640 | S0 = HEAP[sbox | t0] ^ RE0; | |
15641 | S1 = HEAP[sbox | t5] ^ RE1; | |
15642 | S2 = HEAP[sbox | tA] ^ RE2; | |
15643 | S3 = HEAP[sbox | tF] ^ RE3; | |
15644 | S4 = HEAP[sbox | t4] ^ RE4; | |
15645 | S5 = HEAP[sbox | t9] ^ RE5; | |
15646 | S6 = HEAP[sbox | tE] ^ RE6; | |
15647 | S7 = HEAP[sbox | t3] ^ RE7; | |
15648 | S8 = HEAP[sbox | t8] ^ RE8; | |
15649 | S9 = HEAP[sbox | tD] ^ RE9; | |
15650 | SA = HEAP[sbox | t2] ^ REA; | |
15651 | SB = HEAP[sbox | t7] ^ REB; | |
15652 | SC = HEAP[sbox | tC] ^ REC; | |
15653 | SD = HEAP[sbox | t1] ^ RED; | |
15654 | SE = HEAP[sbox | t6] ^ REE; | |
15655 | SF = HEAP[sbox | tB] ^ REF; | |
15656 | } | |
15657 | function _decrypt(s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF) { | |
15658 | s0 = s0 | 0; | |
15659 | s1 = s1 | 0; | |
15660 | s2 = s2 | 0; | |
15661 | s3 = s3 | 0; | |
15662 | s4 = s4 | 0; | |
15663 | s5 = s5 | 0; | |
15664 | s6 = s6 | 0; | |
15665 | s7 = s7 | 0; | |
15666 | s8 = s8 | 0; | |
15667 | s9 = s9 | 0; | |
15668 | sA = sA | 0; | |
15669 | sB = sB | 0; | |
15670 | sC = sC | 0; | |
15671 | sD = sD | 0; | |
15672 | sE = sE | 0; | |
15673 | sF = sF | 0; | |
15674 | var t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, t8 = 0, t9 = 0, tA = 0, tB = 0, tC = 0, tD = 0, tE = 0, tF = 0, inv_sbox = 256, x9 = 1024, xB = 1280, xD = 1536, xE = 1792; | |
15675 | if ((keySize | 0) == 32) { | |
15676 | t0 = HEAP[inv_sbox | s0 ^ RE0] ^ RD0; | |
15677 | t1 = HEAP[inv_sbox | sD ^ RED] ^ RD1; | |
15678 | t2 = HEAP[inv_sbox | sA ^ REA] ^ RD2; | |
15679 | t3 = HEAP[inv_sbox | s7 ^ RE7] ^ RD3; | |
15680 | t4 = HEAP[inv_sbox | s4 ^ RE4] ^ RD4; | |
15681 | t5 = HEAP[inv_sbox | s1 ^ RE1] ^ RD5; | |
15682 | t6 = HEAP[inv_sbox | sE ^ REE] ^ RD6; | |
15683 | t7 = HEAP[inv_sbox | sB ^ REB] ^ RD7; | |
15684 | t8 = HEAP[inv_sbox | s8 ^ RE8] ^ RD8; | |
15685 | t9 = HEAP[inv_sbox | s5 ^ RE5] ^ RD9; | |
15686 | tA = HEAP[inv_sbox | s2 ^ RE2] ^ RDA; | |
15687 | tB = HEAP[inv_sbox | sF ^ REF] ^ RDB; | |
15688 | tC = HEAP[inv_sbox | sC ^ REC] ^ RDC; | |
15689 | tD = HEAP[inv_sbox | s9 ^ RE9] ^ RDD; | |
15690 | tE = HEAP[inv_sbox | s6 ^ RE6] ^ RDE; | |
15691 | tF = HEAP[inv_sbox | s3 ^ RE3] ^ RDF; | |
15692 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15693 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15694 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15695 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15696 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15697 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15698 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15699 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15700 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15701 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15702 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15703 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15704 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15705 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15706 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15707 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15708 | t0 = HEAP[inv_sbox | s0] ^ RC0; | |
15709 | t1 = HEAP[inv_sbox | s1] ^ RC1; | |
15710 | t2 = HEAP[inv_sbox | s2] ^ RC2; | |
15711 | t3 = HEAP[inv_sbox | s3] ^ RC3; | |
15712 | t4 = HEAP[inv_sbox | s4] ^ RC4; | |
15713 | t5 = HEAP[inv_sbox | s5] ^ RC5; | |
15714 | t6 = HEAP[inv_sbox | s6] ^ RC6; | |
15715 | t7 = HEAP[inv_sbox | s7] ^ RC7; | |
15716 | t8 = HEAP[inv_sbox | s8] ^ RC8; | |
15717 | t9 = HEAP[inv_sbox | s9] ^ RC9; | |
15718 | tA = HEAP[inv_sbox | sA] ^ RCA; | |
15719 | tB = HEAP[inv_sbox | sB] ^ RCB; | |
15720 | tC = HEAP[inv_sbox | sC] ^ RCC; | |
15721 | tD = HEAP[inv_sbox | sD] ^ RCD; | |
15722 | tE = HEAP[inv_sbox | sE] ^ RCE; | |
15723 | tF = HEAP[inv_sbox | sF] ^ RCF; | |
15724 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15725 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15726 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15727 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15728 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15729 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15730 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15731 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15732 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15733 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15734 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15735 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15736 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15737 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15738 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15739 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15740 | t0 = HEAP[inv_sbox | s0] ^ RB0; | |
15741 | t1 = HEAP[inv_sbox | s1] ^ RB1; | |
15742 | t2 = HEAP[inv_sbox | s2] ^ RB2; | |
15743 | t3 = HEAP[inv_sbox | s3] ^ RB3; | |
15744 | t4 = HEAP[inv_sbox | s4] ^ RB4; | |
15745 | t5 = HEAP[inv_sbox | s5] ^ RB5; | |
15746 | t6 = HEAP[inv_sbox | s6] ^ RB6; | |
15747 | t7 = HEAP[inv_sbox | s7] ^ RB7; | |
15748 | t8 = HEAP[inv_sbox | s8] ^ RB8; | |
15749 | t9 = HEAP[inv_sbox | s9] ^ RB9; | |
15750 | tA = HEAP[inv_sbox | sA] ^ RBA; | |
15751 | tB = HEAP[inv_sbox | sB] ^ RBB; | |
15752 | tC = HEAP[inv_sbox | sC] ^ RBC; | |
15753 | tD = HEAP[inv_sbox | sD] ^ RBD; | |
15754 | tE = HEAP[inv_sbox | sE] ^ RBE; | |
15755 | tF = HEAP[inv_sbox | sF] ^ RBF; | |
15756 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15757 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15758 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15759 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15760 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15761 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15762 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15763 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15764 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15765 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15766 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15767 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15768 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15769 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15770 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15771 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15772 | t0 = HEAP[inv_sbox | s0] ^ RA0; | |
15773 | t1 = HEAP[inv_sbox | s1] ^ RA1; | |
15774 | t2 = HEAP[inv_sbox | s2] ^ RA2; | |
15775 | t3 = HEAP[inv_sbox | s3] ^ RA3; | |
15776 | t4 = HEAP[inv_sbox | s4] ^ RA4; | |
15777 | t5 = HEAP[inv_sbox | s5] ^ RA5; | |
15778 | t6 = HEAP[inv_sbox | s6] ^ RA6; | |
15779 | t7 = HEAP[inv_sbox | s7] ^ RA7; | |
15780 | t8 = HEAP[inv_sbox | s8] ^ RA8; | |
15781 | t9 = HEAP[inv_sbox | s9] ^ RA9; | |
15782 | tA = HEAP[inv_sbox | sA] ^ RAA; | |
15783 | tB = HEAP[inv_sbox | sB] ^ RAB; | |
15784 | tC = HEAP[inv_sbox | sC] ^ RAC; | |
15785 | tD = HEAP[inv_sbox | sD] ^ RAD; | |
15786 | tE = HEAP[inv_sbox | sE] ^ RAE; | |
15787 | tF = HEAP[inv_sbox | sF] ^ RAF; | |
15788 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15789 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15790 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15791 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15792 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15793 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15794 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15795 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15796 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15797 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15798 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15799 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15800 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15801 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15802 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15803 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15804 | t0 = HEAP[inv_sbox | s0] ^ R90; | |
15805 | t1 = HEAP[inv_sbox | s1] ^ R91; | |
15806 | t2 = HEAP[inv_sbox | s2] ^ R92; | |
15807 | t3 = HEAP[inv_sbox | s3] ^ R93; | |
15808 | t4 = HEAP[inv_sbox | s4] ^ R94; | |
15809 | t5 = HEAP[inv_sbox | s5] ^ R95; | |
15810 | t6 = HEAP[inv_sbox | s6] ^ R96; | |
15811 | t7 = HEAP[inv_sbox | s7] ^ R97; | |
15812 | t8 = HEAP[inv_sbox | s8] ^ R98; | |
15813 | t9 = HEAP[inv_sbox | s9] ^ R99; | |
15814 | tA = HEAP[inv_sbox | sA] ^ R9A; | |
15815 | tB = HEAP[inv_sbox | sB] ^ R9B; | |
15816 | tC = HEAP[inv_sbox | sC] ^ R9C; | |
15817 | tD = HEAP[inv_sbox | sD] ^ R9D; | |
15818 | tE = HEAP[inv_sbox | sE] ^ R9E; | |
15819 | tF = HEAP[inv_sbox | sF] ^ R9F; | |
15820 | } else { | |
15821 | t0 = HEAP[inv_sbox | s0 ^ RA0] ^ R90; | |
15822 | t1 = HEAP[inv_sbox | sD ^ RAD] ^ R91; | |
15823 | t2 = HEAP[inv_sbox | sA ^ RAA] ^ R92; | |
15824 | t3 = HEAP[inv_sbox | s7 ^ RA7] ^ R93; | |
15825 | t4 = HEAP[inv_sbox | s4 ^ RA4] ^ R94; | |
15826 | t5 = HEAP[inv_sbox | s1 ^ RA1] ^ R95; | |
15827 | t6 = HEAP[inv_sbox | sE ^ RAE] ^ R96; | |
15828 | t7 = HEAP[inv_sbox | sB ^ RAB] ^ R97; | |
15829 | t8 = HEAP[inv_sbox | s8 ^ RA8] ^ R98; | |
15830 | t9 = HEAP[inv_sbox | s5 ^ RA5] ^ R99; | |
15831 | tA = HEAP[inv_sbox | s2 ^ RA2] ^ R9A; | |
15832 | tB = HEAP[inv_sbox | sF ^ RAF] ^ R9B; | |
15833 | tC = HEAP[inv_sbox | sC ^ RAC] ^ R9C; | |
15834 | tD = HEAP[inv_sbox | s9 ^ RA9] ^ R9D; | |
15835 | tE = HEAP[inv_sbox | s6 ^ RA6] ^ R9E; | |
15836 | tF = HEAP[inv_sbox | s3 ^ RA3] ^ R9F; | |
15837 | } | |
15838 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15839 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15840 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15841 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15842 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15843 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15844 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15845 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15846 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15847 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15848 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15849 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15850 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15851 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15852 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15853 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15854 | t0 = HEAP[inv_sbox | s0] ^ R80; | |
15855 | t1 = HEAP[inv_sbox | s1] ^ R81; | |
15856 | t2 = HEAP[inv_sbox | s2] ^ R82; | |
15857 | t3 = HEAP[inv_sbox | s3] ^ R83; | |
15858 | t4 = HEAP[inv_sbox | s4] ^ R84; | |
15859 | t5 = HEAP[inv_sbox | s5] ^ R85; | |
15860 | t6 = HEAP[inv_sbox | s6] ^ R86; | |
15861 | t7 = HEAP[inv_sbox | s7] ^ R87; | |
15862 | t8 = HEAP[inv_sbox | s8] ^ R88; | |
15863 | t9 = HEAP[inv_sbox | s9] ^ R89; | |
15864 | tA = HEAP[inv_sbox | sA] ^ R8A; | |
15865 | tB = HEAP[inv_sbox | sB] ^ R8B; | |
15866 | tC = HEAP[inv_sbox | sC] ^ R8C; | |
15867 | tD = HEAP[inv_sbox | sD] ^ R8D; | |
15868 | tE = HEAP[inv_sbox | sE] ^ R8E; | |
15869 | tF = HEAP[inv_sbox | sF] ^ R8F; | |
15870 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15871 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15872 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15873 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15874 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15875 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15876 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15877 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15878 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15879 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15880 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15881 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15882 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15883 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15884 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15885 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15886 | t0 = HEAP[inv_sbox | s0] ^ R70; | |
15887 | t1 = HEAP[inv_sbox | s1] ^ R71; | |
15888 | t2 = HEAP[inv_sbox | s2] ^ R72; | |
15889 | t3 = HEAP[inv_sbox | s3] ^ R73; | |
15890 | t4 = HEAP[inv_sbox | s4] ^ R74; | |
15891 | t5 = HEAP[inv_sbox | s5] ^ R75; | |
15892 | t6 = HEAP[inv_sbox | s6] ^ R76; | |
15893 | t7 = HEAP[inv_sbox | s7] ^ R77; | |
15894 | t8 = HEAP[inv_sbox | s8] ^ R78; | |
15895 | t9 = HEAP[inv_sbox | s9] ^ R79; | |
15896 | tA = HEAP[inv_sbox | sA] ^ R7A; | |
15897 | tB = HEAP[inv_sbox | sB] ^ R7B; | |
15898 | tC = HEAP[inv_sbox | sC] ^ R7C; | |
15899 | tD = HEAP[inv_sbox | sD] ^ R7D; | |
15900 | tE = HEAP[inv_sbox | sE] ^ R7E; | |
15901 | tF = HEAP[inv_sbox | sF] ^ R7F; | |
15902 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15903 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15904 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15905 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15906 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15907 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15908 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15909 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15910 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15911 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15912 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15913 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15914 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15915 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15916 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15917 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15918 | t0 = HEAP[inv_sbox | s0] ^ R60; | |
15919 | t1 = HEAP[inv_sbox | s1] ^ R61; | |
15920 | t2 = HEAP[inv_sbox | s2] ^ R62; | |
15921 | t3 = HEAP[inv_sbox | s3] ^ R63; | |
15922 | t4 = HEAP[inv_sbox | s4] ^ R64; | |
15923 | t5 = HEAP[inv_sbox | s5] ^ R65; | |
15924 | t6 = HEAP[inv_sbox | s6] ^ R66; | |
15925 | t7 = HEAP[inv_sbox | s7] ^ R67; | |
15926 | t8 = HEAP[inv_sbox | s8] ^ R68; | |
15927 | t9 = HEAP[inv_sbox | s9] ^ R69; | |
15928 | tA = HEAP[inv_sbox | sA] ^ R6A; | |
15929 | tB = HEAP[inv_sbox | sB] ^ R6B; | |
15930 | tC = HEAP[inv_sbox | sC] ^ R6C; | |
15931 | tD = HEAP[inv_sbox | sD] ^ R6D; | |
15932 | tE = HEAP[inv_sbox | sE] ^ R6E; | |
15933 | tF = HEAP[inv_sbox | sF] ^ R6F; | |
15934 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15935 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15936 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15937 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15938 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15939 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15940 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15941 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15942 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15943 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15944 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15945 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15946 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15947 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15948 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15949 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15950 | t0 = HEAP[inv_sbox | s0] ^ R50; | |
15951 | t1 = HEAP[inv_sbox | s1] ^ R51; | |
15952 | t2 = HEAP[inv_sbox | s2] ^ R52; | |
15953 | t3 = HEAP[inv_sbox | s3] ^ R53; | |
15954 | t4 = HEAP[inv_sbox | s4] ^ R54; | |
15955 | t5 = HEAP[inv_sbox | s5] ^ R55; | |
15956 | t6 = HEAP[inv_sbox | s6] ^ R56; | |
15957 | t7 = HEAP[inv_sbox | s7] ^ R57; | |
15958 | t8 = HEAP[inv_sbox | s8] ^ R58; | |
15959 | t9 = HEAP[inv_sbox | s9] ^ R59; | |
15960 | tA = HEAP[inv_sbox | sA] ^ R5A; | |
15961 | tB = HEAP[inv_sbox | sB] ^ R5B; | |
15962 | tC = HEAP[inv_sbox | sC] ^ R5C; | |
15963 | tD = HEAP[inv_sbox | sD] ^ R5D; | |
15964 | tE = HEAP[inv_sbox | sE] ^ R5E; | |
15965 | tF = HEAP[inv_sbox | sF] ^ R5F; | |
15966 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15967 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15968 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15969 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15970 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15971 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15972 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15973 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15974 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15975 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15976 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15977 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15978 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15979 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15980 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15981 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15982 | t0 = HEAP[inv_sbox | s0] ^ R40; | |
15983 | t1 = HEAP[inv_sbox | s1] ^ R41; | |
15984 | t2 = HEAP[inv_sbox | s2] ^ R42; | |
15985 | t3 = HEAP[inv_sbox | s3] ^ R43; | |
15986 | t4 = HEAP[inv_sbox | s4] ^ R44; | |
15987 | t5 = HEAP[inv_sbox | s5] ^ R45; | |
15988 | t6 = HEAP[inv_sbox | s6] ^ R46; | |
15989 | t7 = HEAP[inv_sbox | s7] ^ R47; | |
15990 | t8 = HEAP[inv_sbox | s8] ^ R48; | |
15991 | t9 = HEAP[inv_sbox | s9] ^ R49; | |
15992 | tA = HEAP[inv_sbox | sA] ^ R4A; | |
15993 | tB = HEAP[inv_sbox | sB] ^ R4B; | |
15994 | tC = HEAP[inv_sbox | sC] ^ R4C; | |
15995 | tD = HEAP[inv_sbox | sD] ^ R4D; | |
15996 | tE = HEAP[inv_sbox | sE] ^ R4E; | |
15997 | tF = HEAP[inv_sbox | sF] ^ R4F; | |
15998 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15999 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
16000 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
16001 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
16002 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
16003 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
16004 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
16005 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
16006 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
16007 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
16008 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
16009 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
16010 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
16011 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
16012 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
16013 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
16014 | t0 = HEAP[inv_sbox | s0] ^ R30; | |
16015 | t1 = HEAP[inv_sbox | s1] ^ R31; | |
16016 | t2 = HEAP[inv_sbox | s2] ^ R32; | |
16017 | t3 = HEAP[inv_sbox | s3] ^ R33; | |
16018 | t4 = HEAP[inv_sbox | s4] ^ R34; | |
16019 | t5 = HEAP[inv_sbox | s5] ^ R35; | |
16020 | t6 = HEAP[inv_sbox | s6] ^ R36; | |
16021 | t7 = HEAP[inv_sbox | s7] ^ R37; | |
16022 | t8 = HEAP[inv_sbox | s8] ^ R38; | |
16023 | t9 = HEAP[inv_sbox | s9] ^ R39; | |
16024 | tA = HEAP[inv_sbox | sA] ^ R3A; | |
16025 | tB = HEAP[inv_sbox | sB] ^ R3B; | |
16026 | tC = HEAP[inv_sbox | sC] ^ R3C; | |
16027 | tD = HEAP[inv_sbox | sD] ^ R3D; | |
16028 | tE = HEAP[inv_sbox | sE] ^ R3E; | |
16029 | tF = HEAP[inv_sbox | sF] ^ R3F; | |
16030 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
16031 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
16032 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
16033 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
16034 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
16035 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
16036 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
16037 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
16038 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
16039 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
16040 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
16041 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
16042 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
16043 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
16044 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
16045 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
16046 | t0 = HEAP[inv_sbox | s0] ^ R20; | |
16047 | t1 = HEAP[inv_sbox | s1] ^ R21; | |
16048 | t2 = HEAP[inv_sbox | s2] ^ R22; | |
16049 | t3 = HEAP[inv_sbox | s3] ^ R23; | |
16050 | t4 = HEAP[inv_sbox | s4] ^ R24; | |
16051 | t5 = HEAP[inv_sbox | s5] ^ R25; | |
16052 | t6 = HEAP[inv_sbox | s6] ^ R26; | |
16053 | t7 = HEAP[inv_sbox | s7] ^ R27; | |
16054 | t8 = HEAP[inv_sbox | s8] ^ R28; | |
16055 | t9 = HEAP[inv_sbox | s9] ^ R29; | |
16056 | tA = HEAP[inv_sbox | sA] ^ R2A; | |
16057 | tB = HEAP[inv_sbox | sB] ^ R2B; | |
16058 | tC = HEAP[inv_sbox | sC] ^ R2C; | |
16059 | tD = HEAP[inv_sbox | sD] ^ R2D; | |
16060 | tE = HEAP[inv_sbox | sE] ^ R2E; | |
16061 | tF = HEAP[inv_sbox | sF] ^ R2F; | |
16062 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
16063 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
16064 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
16065 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
16066 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
16067 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
16068 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
16069 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
16070 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
16071 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
16072 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
16073 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
16074 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
16075 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
16076 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
16077 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
16078 | t0 = HEAP[inv_sbox | s0] ^ R10; | |
16079 | t1 = HEAP[inv_sbox | s1] ^ R11; | |
16080 | t2 = HEAP[inv_sbox | s2] ^ R12; | |
16081 | t3 = HEAP[inv_sbox | s3] ^ R13; | |
16082 | t4 = HEAP[inv_sbox | s4] ^ R14; | |
16083 | t5 = HEAP[inv_sbox | s5] ^ R15; | |
16084 | t6 = HEAP[inv_sbox | s6] ^ R16; | |
16085 | t7 = HEAP[inv_sbox | s7] ^ R17; | |
16086 | t8 = HEAP[inv_sbox | s8] ^ R18; | |
16087 | t9 = HEAP[inv_sbox | s9] ^ R19; | |
16088 | tA = HEAP[inv_sbox | sA] ^ R1A; | |
16089 | tB = HEAP[inv_sbox | sB] ^ R1B; | |
16090 | tC = HEAP[inv_sbox | sC] ^ R1C; | |
16091 | tD = HEAP[inv_sbox | sD] ^ R1D; | |
16092 | tE = HEAP[inv_sbox | sE] ^ R1E; | |
16093 | tF = HEAP[inv_sbox | sF] ^ R1F; | |
16094 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
16095 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
16096 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
16097 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
16098 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
16099 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
16100 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
16101 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
16102 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
16103 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
16104 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
16105 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
16106 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
16107 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
16108 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
16109 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
16110 | S0 = HEAP[inv_sbox | s0] ^ R00; | |
16111 | S1 = HEAP[inv_sbox | s1] ^ R01; | |
16112 | S2 = HEAP[inv_sbox | s2] ^ R02; | |
16113 | S3 = HEAP[inv_sbox | s3] ^ R03; | |
16114 | S4 = HEAP[inv_sbox | s4] ^ R04; | |
16115 | S5 = HEAP[inv_sbox | s5] ^ R05; | |
16116 | S6 = HEAP[inv_sbox | s6] ^ R06; | |
16117 | S7 = HEAP[inv_sbox | s7] ^ R07; | |
16118 | S8 = HEAP[inv_sbox | s8] ^ R08; | |
16119 | S9 = HEAP[inv_sbox | s9] ^ R09; | |
16120 | SA = HEAP[inv_sbox | sA] ^ R0A; | |
16121 | SB = HEAP[inv_sbox | sB] ^ R0B; | |
16122 | SC = HEAP[inv_sbox | sC] ^ R0C; | |
16123 | SD = HEAP[inv_sbox | sD] ^ R0D; | |
16124 | SE = HEAP[inv_sbox | sE] ^ R0E; | |
16125 | SF = HEAP[inv_sbox | sF] ^ R0F; | |
16126 | } | |
16127 | function init_state(s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF) { | |
16128 | s0 = s0 | 0; | |
16129 | s1 = s1 | 0; | |
16130 | s2 = s2 | 0; | |
16131 | s3 = s3 | 0; | |
16132 | s4 = s4 | 0; | |
16133 | s5 = s5 | 0; | |
16134 | s6 = s6 | 0; | |
16135 | s7 = s7 | 0; | |
16136 | s8 = s8 | 0; | |
16137 | s9 = s9 | 0; | |
16138 | sA = sA | 0; | |
16139 | sB = sB | 0; | |
16140 | sC = sC | 0; | |
16141 | sD = sD | 0; | |
16142 | sE = sE | 0; | |
16143 | sF = sF | 0; | |
16144 | S0 = s0; | |
16145 | S1 = s1; | |
16146 | S2 = s2; | |
16147 | S3 = s3; | |
16148 | S4 = s4; | |
16149 | S5 = s5; | |
16150 | S6 = s6; | |
16151 | S7 = s7; | |
16152 | S8 = s8; | |
16153 | S9 = s9; | |
16154 | SA = sA; | |
16155 | SB = sB; | |
16156 | SC = sC; | |
16157 | SD = sD; | |
16158 | SE = sE; | |
16159 | SF = sF; | |
16160 | } | |
16161 | function save_state(offset) { | |
16162 | offset = offset | 0; | |
16163 | HEAP[offset] = S0; | |
16164 | HEAP[offset | 1] = S1; | |
16165 | HEAP[offset | 2] = S2; | |
16166 | HEAP[offset | 3] = S3; | |
16167 | HEAP[offset | 4] = S4; | |
16168 | HEAP[offset | 5] = S5; | |
16169 | HEAP[offset | 6] = S6; | |
16170 | HEAP[offset | 7] = S7; | |
16171 | HEAP[offset | 8] = S8; | |
16172 | HEAP[offset | 9] = S9; | |
16173 | HEAP[offset | 10] = SA; | |
16174 | HEAP[offset | 11] = SB; | |
16175 | HEAP[offset | 12] = SC; | |
16176 | HEAP[offset | 13] = SD; | |
16177 | HEAP[offset | 14] = SE; | |
16178 | HEAP[offset | 15] = SF; | |
16179 | } | |
16180 | function init_key_128(k0, k1, k2, k3, k4, k5, k6, k7, k8, k9, kA, kB, kC, kD, kE, kF) { | |
16181 | k0 = k0 | 0; | |
16182 | k1 = k1 | 0; | |
16183 | k2 = k2 | 0; | |
16184 | k3 = k3 | 0; | |
16185 | k4 = k4 | 0; | |
16186 | k5 = k5 | 0; | |
16187 | k6 = k6 | 0; | |
16188 | k7 = k7 | 0; | |
16189 | k8 = k8 | 0; | |
16190 | k9 = k9 | 0; | |
16191 | kA = kA | 0; | |
16192 | kB = kB | 0; | |
16193 | kC = kC | 0; | |
16194 | kD = kD | 0; | |
16195 | kE = kE | 0; | |
16196 | kF = kF | 0; | |
16197 | R00 = k0; | |
16198 | R01 = k1; | |
16199 | R02 = k2; | |
16200 | R03 = k3; | |
16201 | R04 = k4; | |
16202 | R05 = k5; | |
16203 | R06 = k6; | |
16204 | R07 = k7; | |
16205 | R08 = k8; | |
16206 | R09 = k9; | |
16207 | R0A = kA; | |
16208 | R0B = kB; | |
16209 | R0C = kC; | |
16210 | R0D = kD; | |
16211 | R0E = kE; | |
16212 | R0F = kF; | |
16213 | keySize = 16; | |
16214 | _expand_key_128(); | |
16215 | } | |
16216 | function init_key_256(k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, k0F, k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E, k1F) { | |
16217 | k00 = k00 | 0; | |
16218 | k01 = k01 | 0; | |
16219 | k02 = k02 | 0; | |
16220 | k03 = k03 | 0; | |
16221 | k04 = k04 | 0; | |
16222 | k05 = k05 | 0; | |
16223 | k06 = k06 | 0; | |
16224 | k07 = k07 | 0; | |
16225 | k08 = k08 | 0; | |
16226 | k09 = k09 | 0; | |
16227 | k0A = k0A | 0; | |
16228 | k0B = k0B | 0; | |
16229 | k0C = k0C | 0; | |
16230 | k0D = k0D | 0; | |
16231 | k0E = k0E | 0; | |
16232 | k0F = k0F | 0; | |
16233 | k10 = k10 | 0; | |
16234 | k11 = k11 | 0; | |
16235 | k12 = k12 | 0; | |
16236 | k13 = k13 | 0; | |
16237 | k14 = k14 | 0; | |
16238 | k15 = k15 | 0; | |
16239 | k16 = k16 | 0; | |
16240 | k17 = k17 | 0; | |
16241 | k18 = k18 | 0; | |
16242 | k19 = k19 | 0; | |
16243 | k1A = k1A | 0; | |
16244 | k1B = k1B | 0; | |
16245 | k1C = k1C | 0; | |
16246 | k1D = k1D | 0; | |
16247 | k1E = k1E | 0; | |
16248 | k1F = k1F | 0; | |
16249 | R00 = k00; | |
16250 | R01 = k01; | |
16251 | R02 = k02; | |
16252 | R03 = k03; | |
16253 | R04 = k04; | |
16254 | R05 = k05; | |
16255 | R06 = k06; | |
16256 | R07 = k07; | |
16257 | R08 = k08; | |
16258 | R09 = k09; | |
16259 | R0A = k0A; | |
16260 | R0B = k0B; | |
16261 | R0C = k0C; | |
16262 | R0D = k0D; | |
16263 | R0E = k0E; | |
16264 | R0F = k0F; | |
16265 | R10 = k10; | |
16266 | R11 = k11; | |
16267 | R12 = k12; | |
16268 | R13 = k13; | |
16269 | R14 = k14; | |
16270 | R15 = k15; | |
16271 | R16 = k16; | |
16272 | R17 = k17; | |
16273 | R18 = k18; | |
16274 | R19 = k19; | |
16275 | R1A = k1A; | |
16276 | R1B = k1B; | |
16277 | R1C = k1C; | |
16278 | R1D = k1D; | |
16279 | R1E = k1E; | |
16280 | R1F = k1F; | |
16281 | keySize = 32; | |
16282 | _expand_key_256(); | |
16283 | } | |
16284 | function cbc_encrypt(offset, length) { | |
16285 | offset = offset | 0; | |
16286 | length = length | 0; | |
16287 | var encrypted = 0; | |
16288 | if (offset & 15) return -1; | |
16289 | while ((length | 0) >= 16) { | |
16290 | _encrypt(S0 ^ HEAP[offset], S1 ^ HEAP[offset | 1], S2 ^ HEAP[offset | 2], S3 ^ HEAP[offset | 3], S4 ^ HEAP[offset | 4], S5 ^ HEAP[offset | 5], S6 ^ HEAP[offset | 6], S7 ^ HEAP[offset | 7], S8 ^ HEAP[offset | 8], S9 ^ HEAP[offset | 9], SA ^ HEAP[offset | 10], SB ^ HEAP[offset | 11], SC ^ HEAP[offset | 12], SD ^ HEAP[offset | 13], SE ^ HEAP[offset | 14], SF ^ HEAP[offset | 15]); | |
16291 | HEAP[offset] = S0; | |
16292 | HEAP[offset | 1] = S1; | |
16293 | HEAP[offset | 2] = S2; | |
16294 | HEAP[offset | 3] = S3; | |
16295 | HEAP[offset | 4] = S4; | |
16296 | HEAP[offset | 5] = S5; | |
16297 | HEAP[offset | 6] = S6; | |
16298 | HEAP[offset | 7] = S7; | |
16299 | HEAP[offset | 8] = S8; | |
16300 | HEAP[offset | 9] = S9; | |
16301 | HEAP[offset | 10] = SA; | |
16302 | HEAP[offset | 11] = SB; | |
16303 | HEAP[offset | 12] = SC; | |
16304 | HEAP[offset | 13] = SD; | |
16305 | HEAP[offset | 14] = SE; | |
16306 | HEAP[offset | 15] = SF; | |
16307 | offset = offset + 16 | 0; | |
16308 | length = length - 16 | 0; | |
16309 | encrypted = encrypted + 16 | 0; | |
16310 | } | |
16311 | return encrypted | 0; | |
16312 | } | |
16313 | function cbc_decrypt(offset, length) { | |
16314 | offset = offset | 0; | |
16315 | length = length | 0; | |
16316 | var iv0 = 0, iv1 = 0, iv2 = 0, iv3 = 0, iv4 = 0, iv5 = 0, iv6 = 0, iv7 = 0, iv8 = 0, iv9 = 0, ivA = 0, ivB = 0, ivC = 0, ivD = 0, ivE = 0, ivF = 0, decrypted = 0; | |
16317 | if (offset & 15) return -1; | |
16318 | iv0 = S0; | |
16319 | iv1 = S1; | |
16320 | iv2 = S2; | |
16321 | iv3 = S3; | |
16322 | iv4 = S4; | |
16323 | iv5 = S5; | |
16324 | iv6 = S6; | |
16325 | iv7 = S7; | |
16326 | iv8 = S8; | |
16327 | iv9 = S9; | |
16328 | ivA = SA; | |
16329 | ivB = SB; | |
16330 | ivC = SC; | |
16331 | ivD = SD; | |
16332 | ivE = SE; | |
16333 | ivF = SF; | |
16334 | while ((length | 0) >= 16) { | |
16335 | _decrypt(HEAP[offset] | 0, HEAP[offset | 1] | 0, HEAP[offset | 2] | 0, HEAP[offset | 3] | 0, HEAP[offset | 4] | 0, HEAP[offset | 5] | 0, HEAP[offset | 6] | 0, HEAP[offset | 7] | 0, HEAP[offset | 8] | 0, HEAP[offset | 9] | 0, HEAP[offset | 10] | 0, HEAP[offset | 11] | 0, HEAP[offset | 12] | 0, HEAP[offset | 13] | 0, HEAP[offset | 14] | 0, HEAP[offset | 15] | 0); | |
16336 | S0 = S0 ^ iv0; | |
16337 | iv0 = HEAP[offset] | 0; | |
16338 | S1 = S1 ^ iv1; | |
16339 | iv1 = HEAP[offset | 1] | 0; | |
16340 | S2 = S2 ^ iv2; | |
16341 | iv2 = HEAP[offset | 2] | 0; | |
16342 | S3 = S3 ^ iv3; | |
16343 | iv3 = HEAP[offset | 3] | 0; | |
16344 | S4 = S4 ^ iv4; | |
16345 | iv4 = HEAP[offset | 4] | 0; | |
16346 | S5 = S5 ^ iv5; | |
16347 | iv5 = HEAP[offset | 5] | 0; | |
16348 | S6 = S6 ^ iv6; | |
16349 | iv6 = HEAP[offset | 6] | 0; | |
16350 | S7 = S7 ^ iv7; | |
16351 | iv7 = HEAP[offset | 7] | 0; | |
16352 | S8 = S8 ^ iv8; | |
16353 | iv8 = HEAP[offset | 8] | 0; | |
16354 | S9 = S9 ^ iv9; | |
16355 | iv9 = HEAP[offset | 9] | 0; | |
16356 | SA = SA ^ ivA; | |
16357 | ivA = HEAP[offset | 10] | 0; | |
16358 | SB = SB ^ ivB; | |
16359 | ivB = HEAP[offset | 11] | 0; | |
16360 | SC = SC ^ ivC; | |
16361 | ivC = HEAP[offset | 12] | 0; | |
16362 | SD = SD ^ ivD; | |
16363 | ivD = HEAP[offset | 13] | 0; | |
16364 | SE = SE ^ ivE; | |
16365 | ivE = HEAP[offset | 14] | 0; | |
16366 | SF = SF ^ ivF; | |
16367 | ivF = HEAP[offset | 15] | 0; | |
16368 | HEAP[offset] = S0; | |
16369 | HEAP[offset | 1] = S1; | |
16370 | HEAP[offset | 2] = S2; | |
16371 | HEAP[offset | 3] = S3; | |
16372 | HEAP[offset | 4] = S4; | |
16373 | HEAP[offset | 5] = S5; | |
16374 | HEAP[offset | 6] = S6; | |
16375 | HEAP[offset | 7] = S7; | |
16376 | HEAP[offset | 8] = S8; | |
16377 | HEAP[offset | 9] = S9; | |
16378 | HEAP[offset | 10] = SA; | |
16379 | HEAP[offset | 11] = SB; | |
16380 | HEAP[offset | 12] = SC; | |
16381 | HEAP[offset | 13] = SD; | |
16382 | HEAP[offset | 14] = SE; | |
16383 | HEAP[offset | 15] = SF; | |
16384 | offset = offset + 16 | 0; | |
16385 | length = length - 16 | 0; | |
16386 | decrypted = decrypted + 16 | 0; | |
16387 | } | |
16388 | S0 = iv0; | |
16389 | S1 = iv1; | |
16390 | S2 = iv2; | |
16391 | S3 = iv3; | |
16392 | S4 = iv4; | |
16393 | S5 = iv5; | |
16394 | S6 = iv6; | |
16395 | S7 = iv7; | |
16396 | S8 = iv8; | |
16397 | S9 = iv9; | |
16398 | SA = ivA; | |
16399 | SB = ivB; | |
16400 | SC = ivC; | |
16401 | SD = ivD; | |
16402 | SE = ivE; | |
16403 | SF = ivF; | |
16404 | return decrypted | 0; | |
16405 | } | |
16406 | function cbc_mac(offset, length, output) { | |
16407 | offset = offset | 0; | |
16408 | length = length | 0; | |
16409 | output = output | 0; | |
16410 | if (offset & 15) return -1; | |
16411 | if (~output) if (output & 31) return -1; | |
16412 | while ((length | 0) >= 16) { | |
16413 | _encrypt(S0 ^ HEAP[offset], S1 ^ HEAP[offset | 1], S2 ^ HEAP[offset | 2], S3 ^ HEAP[offset | 3], S4 ^ HEAP[offset | 4], S5 ^ HEAP[offset | 5], S6 ^ HEAP[offset | 6], S7 ^ HEAP[offset | 7], S8 ^ HEAP[offset | 8], S9 ^ HEAP[offset | 9], SA ^ HEAP[offset | 10], SB ^ HEAP[offset | 11], SC ^ HEAP[offset | 12], SD ^ HEAP[offset | 13], SE ^ HEAP[offset | 14], SF ^ HEAP[offset | 15]); | |
16414 | offset = offset + 16 | 0; | |
16415 | length = length - 16 | 0; | |
16416 | } | |
16417 | if ((length | 0) > 0) { | |
16418 | S0 = S0 ^ HEAP[offset]; | |
16419 | if ((length | 0) > 1) S1 = S1 ^ HEAP[offset | 1]; | |
16420 | if ((length | 0) > 2) S2 = S2 ^ HEAP[offset | 2]; | |
16421 | if ((length | 0) > 3) S3 = S3 ^ HEAP[offset | 3]; | |
16422 | if ((length | 0) > 4) S4 = S4 ^ HEAP[offset | 4]; | |
16423 | if ((length | 0) > 5) S5 = S5 ^ HEAP[offset | 5]; | |
16424 | if ((length | 0) > 6) S6 = S6 ^ HEAP[offset | 6]; | |
16425 | if ((length | 0) > 7) S7 = S7 ^ HEAP[offset | 7]; | |
16426 | if ((length | 0) > 8) S8 = S8 ^ HEAP[offset | 8]; | |
16427 | if ((length | 0) > 9) S9 = S9 ^ HEAP[offset | 9]; | |
16428 | if ((length | 0) > 10) SA = SA ^ HEAP[offset | 10]; | |
16429 | if ((length | 0) > 11) SB = SB ^ HEAP[offset | 11]; | |
16430 | if ((length | 0) > 12) SC = SC ^ HEAP[offset | 12]; | |
16431 | if ((length | 0) > 13) SD = SD ^ HEAP[offset | 13]; | |
16432 | if ((length | 0) > 14) SE = SE ^ HEAP[offset | 14]; | |
16433 | _encrypt(S0, S1, S2, S3, S4, S5, S6, S7, S8, S9, SA, SB, SC, SD, SE, SF); | |
16434 | offset = offset + length | 0; | |
16435 | length = 0; | |
16436 | } | |
16437 | if (~output) { | |
16438 | HEAP[output | 0] = S0; | |
16439 | HEAP[output | 1] = S1; | |
16440 | HEAP[output | 2] = S2; | |
16441 | HEAP[output | 3] = S3; | |
16442 | HEAP[output | 4] = S4; | |
16443 | HEAP[output | 5] = S5; | |
16444 | HEAP[output | 6] = S6; | |
16445 | HEAP[output | 7] = S7; | |
16446 | HEAP[output | 8] = S8; | |
16447 | HEAP[output | 9] = S9; | |
16448 | HEAP[output | 10] = SA; | |
16449 | HEAP[output | 11] = SB; | |
16450 | HEAP[output | 12] = SC; | |
16451 | HEAP[output | 13] = SD; | |
16452 | HEAP[output | 14] = SE; | |
16453 | HEAP[output | 15] = SF; | |
16454 | } | |
16455 | return 0; | |
16456 | } | |
16457 | function ccm_encrypt(offset, length, nonce0, nonce1, nonce2, nonce3, nonce4, nonce5, nonce6, nonce7, nonce8, nonce9, nonceA, nonceB, nonceC, nonceD, counter0, counter1) { | |
16458 | offset = offset | 0; | |
16459 | length = length | 0; | |
16460 | nonce0 = nonce0 | 0; | |
16461 | nonce1 = nonce1 | 0; | |
16462 | nonce2 = nonce2 | 0; | |
16463 | nonce3 = nonce3 | 0; | |
16464 | nonce4 = nonce4 | 0; | |
16465 | nonce5 = nonce5 | 0; | |
16466 | nonce6 = nonce6 | 0; | |
16467 | nonce7 = nonce7 | 0; | |
16468 | nonce8 = nonce8 | 0; | |
16469 | nonce9 = nonce9 | 0; | |
16470 | nonceA = nonceA | 0; | |
16471 | nonceB = nonceB | 0; | |
16472 | nonceC = nonceC | 0; | |
16473 | nonceD = nonceD | 0; | |
16474 | counter0 = counter0 | 0; | |
16475 | counter1 = counter1 | 0; | |
16476 | var iv0 = 0, iv1 = 0, iv2 = 0, iv3 = 0, iv4 = 0, iv5 = 0, iv6 = 0, iv7 = 0, iv8 = 0, iv9 = 0, ivA = 0, ivB = 0, ivC = 0, ivD = 0, ivE = 0, ivF = 0, s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0, s8 = 0, s9 = 0, sA = 0, sB = 0, sC = 0, sD = 0, sE = 0, sF = 0, encrypted = 0; | |
16477 | if (offset & 15) return -1; | |
16478 | iv0 = S0, iv1 = S1, iv2 = S2, iv3 = S3, iv4 = S4, iv5 = S5, iv6 = S6, iv7 = S7, | |
16479 | iv8 = S8, iv9 = S9, ivA = SA, ivB = SB, ivC = SC, ivD = SD, ivE = SE, ivF = SF; | |
16480 | while ((length | 0) >= 16) { | |
16481 | s0 = HEAP[offset] | 0; | |
16482 | s1 = HEAP[offset | 1] | 0; | |
16483 | s2 = HEAP[offset | 2] | 0; | |
16484 | s3 = HEAP[offset | 3] | 0; | |
16485 | s4 = HEAP[offset | 4] | 0; | |
16486 | s5 = HEAP[offset | 5] | 0; | |
16487 | s6 = HEAP[offset | 6] | 0; | |
16488 | s7 = HEAP[offset | 7] | 0; | |
16489 | s8 = HEAP[offset | 8] | 0; | |
16490 | s9 = HEAP[offset | 9] | 0; | |
16491 | sA = HEAP[offset | 10] | 0; | |
16492 | sB = HEAP[offset | 11] | 0; | |
16493 | sC = HEAP[offset | 12] | 0; | |
16494 | sD = HEAP[offset | 13] | 0; | |
16495 | sE = HEAP[offset | 14] | 0; | |
16496 | sF = HEAP[offset | 15] | 0; | |
16497 | _encrypt(nonce0, nonce1, nonce2, nonce3, nonce4, nonce5, nonce6, nonce7, nonce8 ^ counter0 >>> 24, nonce9 ^ counter0 >>> 16 & 255, nonceA ^ counter0 >>> 8 & 255, nonceB ^ counter0 & 255, nonceC ^ counter1 >>> 24, nonceD ^ counter1 >>> 16 & 255, counter1 >>> 8 & 255, counter1 & 255); | |
16498 | HEAP[offset] = s0 ^ S0; | |
16499 | HEAP[offset | 1] = s1 ^ S1; | |
16500 | HEAP[offset | 2] = s2 ^ S2; | |
16501 | HEAP[offset | 3] = s3 ^ S3; | |
16502 | HEAP[offset | 4] = s4 ^ S4; | |
16503 | HEAP[offset | 5] = s5 ^ S5; | |
16504 | HEAP[offset | 6] = s6 ^ S6; | |
16505 | HEAP[offset | 7] = s7 ^ S7; | |
16506 | HEAP[offset | 8] = s8 ^ S8; | |
16507 | HEAP[offset | 9] = s9 ^ S9; | |
16508 | HEAP[offset | 10] = sA ^ SA; | |
16509 | HEAP[offset | 11] = sB ^ SB; | |
16510 | HEAP[offset | 12] = sC ^ SC; | |
16511 | HEAP[offset | 13] = sD ^ SD; | |
16512 | HEAP[offset | 14] = sE ^ SE; | |
16513 | HEAP[offset | 15] = sF ^ SF; | |
16514 | _encrypt(s0 ^ iv0, s1 ^ iv1, s2 ^ iv2, s3 ^ iv3, s4 ^ iv4, s5 ^ iv5, s6 ^ iv6, s7 ^ iv7, s8 ^ iv8, s9 ^ iv9, sA ^ ivA, sB ^ ivB, sC ^ ivC, sD ^ ivD, sE ^ ivE, sF ^ ivF); | |
16515 | iv0 = S0, iv1 = S1, iv2 = S2, iv3 = S3, iv4 = S4, iv5 = S5, iv6 = S6, iv7 = S7, | |
16516 | iv8 = S8, iv9 = S9, ivA = SA, ivB = SB, ivC = SC, ivD = SD, ivE = SE, ivF = SF; | |
16517 | encrypted = encrypted + 16 | 0; | |
16518 | offset = offset + 16 | 0; | |
16519 | length = length - 16 | 0; | |
16520 | counter1 = counter1 + 1 | 0; | |
16521 | if ((counter1 | 0) == 0) counter0 = counter0 + 1 | 0; | |
16522 | } | |
16523 | if ((length | 0) > 0) { | |
16524 | s0 = HEAP[offset] | 0; | |
16525 | s1 = (length | 0) > 1 ? HEAP[offset | 1] | 0 : 0; | |
16526 | s2 = (length | 0) > 2 ? HEAP[offset | 2] | 0 : 0; | |
16527 | s3 = (length | 0) > 3 ? HEAP[offset | 3] | 0 : 0; | |
16528 | s4 = (length | 0) > 4 ? HEAP[offset | 4] | 0 : 0; | |
16529 | s5 = (length | 0) > 5 ? HEAP[offset | 5] | 0 : 0; | |
16530 | s6 = (length | 0) > 6 ? HEAP[offset | 6] | 0 : 0; | |
16531 | s7 = (length | 0) > 7 ? HEAP[offset | 7] | 0 : 0; | |
16532 | s8 = (length | 0) > 8 ? HEAP[offset | 8] | 0 : 0; | |
16533 | s9 = (length | 0) > 9 ? HEAP[offset | 9] | 0 : 0; | |
16534 | sA = (length | 0) > 10 ? HEAP[offset | 10] | 0 : 0; | |
16535 | sB = (length | 0) > 11 ? HEAP[offset | 11] | 0 : 0; | |
16536 | sC = (length | 0) > 12 ? HEAP[offset | 12] | 0 : 0; | |
16537 | sD = (length | 0) > 13 ? HEAP[offset | 13] | 0 : 0; | |
16538 | sE = (length | 0) > 14 ? HEAP[offset | 14] | 0 : 0; | |
16539 | _encrypt(nonce0, nonce1, nonce2, nonce3, nonce4, nonce5, nonce6, nonce7, nonce8 ^ counter0 >>> 24, nonce9 ^ counter0 >>> 16 & 255, nonceA ^ counter0 >>> 8 & 255, nonceB ^ counter0 & 255, nonceC ^ counter1 >>> 24, nonceD ^ counter1 >>> 16 & 255, counter1 >>> 8 & 255, counter1 & 255); | |
16540 | HEAP[offset] = s0 ^ S0; | |
16541 | if ((length | 0) > 1) HEAP[offset | 1] = s1 ^ S1; | |
16542 | if ((length | 0) > 2) HEAP[offset | 2] = s2 ^ S2; | |
16543 | if ((length | 0) > 3) HEAP[offset | 3] = s3 ^ S3; | |
16544 | if ((length | 0) > 4) HEAP[offset | 4] = s4 ^ S4; | |
16545 | if ((length | 0) > 5) HEAP[offset | 5] = s5 ^ S5; | |
16546 | if ((length | 0) > 6) HEAP[offset | 6] = s6 ^ S6; | |
16547 | if ((length | 0) > 7) HEAP[offset | 7] = s7 ^ S7; | |
16548 | if ((length | 0) > 8) HEAP[offset | 8] = s8 ^ S8; | |
16549 | if ((length | 0) > 9) HEAP[offset | 9] = s9 ^ S9; | |
16550 | if ((length | 0) > 10) HEAP[offset | 10] = sA ^ SA; | |
16551 | if ((length | 0) > 11) HEAP[offset | 11] = sB ^ SB; | |
16552 | if ((length | 0) > 12) HEAP[offset | 12] = sC ^ SC; | |
16553 | if ((length | 0) > 13) HEAP[offset | 13] = sD ^ SD; | |
16554 | if ((length | 0) > 14) HEAP[offset | 14] = sE ^ SE; | |
16555 | _encrypt(s0 ^ iv0, s1 ^ iv1, s2 ^ iv2, s3 ^ iv3, s4 ^ iv4, s5 ^ iv5, s6 ^ iv6, s7 ^ iv7, s8 ^ iv8, s9 ^ iv9, sA ^ ivA, sB ^ ivB, sC ^ ivC, sD ^ ivD, sE ^ ivE, ivF); | |
16556 | iv0 = S0, iv1 = S1, iv2 = S2, iv3 = S3, iv4 = S4, iv5 = S5, iv6 = S6, iv7 = S7, | |
16557 | iv8 = S8, iv9 = S9, ivA = SA, ivB = SB, ivC = SC, ivD = SD, ivE = SE, ivF = SF; | |
16558 | encrypted = encrypted + length | 0; | |
16559 | offset = offset + length | 0; | |
16560 | length = 0; | |
16561 | counter1 = counter1 + 1 | 0; | |
16562 | if ((counter1 | 0) == 0) counter0 = counter0 + 1 | 0; | |
16563 | } | |
16564 | return encrypted | 0; | |
16565 | } | |
16566 | function ccm_decrypt(offset, length, nonce0, nonce1, nonce2, nonce3, nonce4, nonce5, nonce6, nonce7, nonce8, nonce9, nonceA, nonceB, nonceC, nonceD, counter0, counter1) { | |
16567 | offset = offset | 0; | |
16568 | length = length | 0; | |
16569 | nonce0 = nonce0 | 0; | |
16570 | nonce1 = nonce1 | 0; | |
16571 | nonce2 = nonce2 | 0; | |
16572 | nonce3 = nonce3 | 0; | |
16573 | nonce4 = nonce4 | 0; | |
16574 | nonce5 = nonce5 | 0; | |
16575 | nonce6 = nonce6 | 0; | |
16576 | nonce7 = nonce7 | 0; | |
16577 | nonce8 = nonce8 | 0; | |
16578 | nonce9 = nonce9 | 0; | |
16579 | nonceA = nonceA | 0; | |
16580 | nonceB = nonceB | 0; | |
16581 | nonceC = nonceC | 0; | |
16582 | nonceD = nonceD | 0; | |
16583 | counter0 = counter0 | 0; | |
16584 | counter1 = counter1 | 0; | |
16585 | var iv0 = 0, iv1 = 0, iv2 = 0, iv3 = 0, iv4 = 0, iv5 = 0, iv6 = 0, iv7 = 0, iv8 = 0, iv9 = 0, ivA = 0, ivB = 0, ivC = 0, ivD = 0, ivE = 0, ivF = 0, s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0, s8 = 0, s9 = 0, sA = 0, sB = 0, sC = 0, sD = 0, sE = 0, sF = 0, decrypted = 0; | |
16586 | if (offset & 15) return -1; | |
16587 | iv0 = S0, iv1 = S1, iv2 = S2, iv3 = S3, iv4 = S4, iv5 = S5, iv6 = S6, iv7 = S7, | |
16588 | iv8 = S8, iv9 = S9, ivA = SA, ivB = SB, ivC = SC, ivD = SD, ivE = SE, ivF = SF; | |
16589 | while ((length | 0) >= 16) { | |
16590 | _encrypt(nonce0, nonce1, nonce2, nonce3, nonce4, nonce5, nonce6, nonce7, nonce8 ^ counter0 >>> 24, nonce9 ^ counter0 >>> 16 & 255, nonceA ^ counter0 >>> 8 & 255, nonceB ^ counter0 & 255, nonceC ^ counter1 >>> 24, nonceD ^ counter1 >>> 16 & 255, counter1 >>> 8 & 255, counter1 & 255); | |
16591 | HEAP[offset] = s0 = HEAP[offset] ^ S0; | |
16592 | HEAP[offset | 1] = s1 = HEAP[offset | 1] ^ S1; | |
16593 | HEAP[offset | 2] = s2 = HEAP[offset | 2] ^ S2; | |
16594 | HEAP[offset | 3] = s3 = HEAP[offset | 3] ^ S3; | |
16595 | HEAP[offset | 4] = s4 = HEAP[offset | 4] ^ S4; | |
16596 | HEAP[offset | 5] = s5 = HEAP[offset | 5] ^ S5; | |
16597 | HEAP[offset | 6] = s6 = HEAP[offset | 6] ^ S6; | |
16598 | HEAP[offset | 7] = s7 = HEAP[offset | 7] ^ S7; | |
16599 | HEAP[offset | 8] = s8 = HEAP[offset | 8] ^ S8; | |
16600 | HEAP[offset | 9] = s9 = HEAP[offset | 9] ^ S9; | |
16601 | HEAP[offset | 10] = sA = HEAP[offset | 10] ^ SA; | |
16602 | HEAP[offset | 11] = sB = HEAP[offset | 11] ^ SB; | |
16603 | HEAP[offset | 12] = sC = HEAP[offset | 12] ^ SC; | |
16604 | HEAP[offset | 13] = sD = HEAP[offset | 13] ^ SD; | |
16605 | HEAP[offset | 14] = sE = HEAP[offset | 14] ^ SE; | |
16606 | HEAP[offset | 15] = sF = HEAP[offset | 15] ^ SF; | |
16607 | _encrypt(s0 ^ iv0, s1 ^ iv1, s2 ^ iv2, s3 ^ iv3, s4 ^ iv4, s5 ^ iv5, s6 ^ iv6, s7 ^ iv7, s8 ^ iv8, s9 ^ iv9, sA ^ ivA, sB ^ ivB, sC ^ ivC, sD ^ ivD, sE ^ ivE, sF ^ ivF); | |
16608 | iv0 = S0, iv1 = S1, iv2 = S2, iv3 = S3, iv4 = S4, iv5 = S5, iv6 = S6, iv7 = S7, | |
16609 | iv8 = S8, iv9 = S9, ivA = SA, ivB = SB, ivC = SC, ivD = SD, ivE = SE, ivF = SF; | |
16610 | decrypted = decrypted + 16 | 0; | |
16611 | offset = offset + 16 | 0; | |
16612 | length = length - 16 | 0; | |
16613 | counter1 = counter1 + 1 | 0; | |
16614 | if ((counter1 | 0) == 0) counter0 = counter0 + 1 | 0; | |
16615 | } | |
16616 | if ((length | 0) > 0) { | |
16617 | _encrypt(nonce0, nonce1, nonce2, nonce3, nonce4, nonce5, nonce6, nonce7, nonce8 ^ counter0 >>> 24, nonce9 ^ counter0 >>> 16 & 255, nonceA ^ counter0 >>> 8 & 255, nonceB ^ counter0 & 255, nonceC ^ counter1 >>> 24, nonceD ^ counter1 >>> 16 & 255, counter1 >>> 8 & 255, counter1 & 255); | |
16618 | s0 = HEAP[offset] ^ S0; | |
16619 | s1 = (length | 0) > 1 ? HEAP[offset | 1] ^ S1 : 0; | |
16620 | s2 = (length | 0) > 2 ? HEAP[offset | 2] ^ S2 : 0; | |
16621 | s3 = (length | 0) > 3 ? HEAP[offset | 3] ^ S3 : 0; | |
16622 | s4 = (length | 0) > 4 ? HEAP[offset | 4] ^ S4 : 0; | |
16623 | s5 = (length | 0) > 5 ? HEAP[offset | 5] ^ S5 : 0; | |
16624 | s6 = (length | 0) > 6 ? HEAP[offset | 6] ^ S6 : 0; | |
16625 | s7 = (length | 0) > 7 ? HEAP[offset | 7] ^ S7 : 0; | |
16626 | s8 = (length | 0) > 8 ? HEAP[offset | 8] ^ S8 : 0; | |
16627 | s9 = (length | 0) > 9 ? HEAP[offset | 9] ^ S9 : 0; | |
16628 | sA = (length | 0) > 10 ? HEAP[offset | 10] ^ SA : 0; | |
16629 | sB = (length | 0) > 11 ? HEAP[offset | 11] ^ SB : 0; | |
16630 | sC = (length | 0) > 12 ? HEAP[offset | 12] ^ SC : 0; | |
16631 | sD = (length | 0) > 13 ? HEAP[offset | 13] ^ SD : 0; | |
16632 | sE = (length | 0) > 14 ? HEAP[offset | 14] ^ SE : 0; | |
16633 | sF = (length | 0) > 15 ? HEAP[offset | 15] ^ SF : 0; | |
16634 | HEAP[offset] = s0; | |
16635 | if ((length | 0) > 1) HEAP[offset | 1] = s1; | |
16636 | if ((length | 0) > 2) HEAP[offset | 2] = s2; | |
16637 | if ((length | 0) > 3) HEAP[offset | 3] = s3; | |
16638 | if ((length | 0) > 4) HEAP[offset | 4] = s4; | |
16639 | if ((length | 0) > 5) HEAP[offset | 5] = s5; | |
16640 | if ((length | 0) > 6) HEAP[offset | 6] = s6; | |
16641 | if ((length | 0) > 7) HEAP[offset | 7] = s7; | |
16642 | if ((length | 0) > 8) HEAP[offset | 8] = s8; | |
16643 | if ((length | 0) > 9) HEAP[offset | 9] = s9; | |
16644 | if ((length | 0) > 10) HEAP[offset | 10] = sA; | |
16645 | if ((length | 0) > 11) HEAP[offset | 11] = sB; | |
16646 | if ((length | 0) > 12) HEAP[offset | 12] = sC; | |
16647 | if ((length | 0) > 13) HEAP[offset | 13] = sD; | |
16648 | if ((length | 0) > 14) HEAP[offset | 14] = sE; | |
16649 | _encrypt(s0 ^ iv0, s1 ^ iv1, s2 ^ iv2, s3 ^ iv3, s4 ^ iv4, s5 ^ iv5, s6 ^ iv6, s7 ^ iv7, s8 ^ iv8, s9 ^ iv9, sA ^ ivA, sB ^ ivB, sC ^ ivC, sD ^ ivD, sE ^ ivE, sF ^ ivF); | |
16650 | iv0 = S0, iv1 = S1, iv2 = S2, iv3 = S3, iv4 = S4, iv5 = S5, iv6 = S6, iv7 = S7, | |
16651 | iv8 = S8, iv9 = S9, ivA = SA, ivB = SB, ivC = SC, ivD = SD, ivE = SE, ivF = SF; | |
16652 | decrypted = decrypted + length | 0; | |
16653 | offset = offset + length | 0; | |
16654 | length = 0; | |
16655 | counter1 = counter1 + 1 | 0; | |
16656 | if ((counter1 | 0) == 0) counter0 = counter0 + 1 | 0; | |
16657 | } | |
16658 | return decrypted | 0; | |
16659 | } | |
16660 | function cfb_encrypt(offset, length) { | |
16661 | offset = offset | 0; | |
16662 | length = length | 0; | |
16663 | var encrypted = 0; | |
16664 | if (offset & 15) return -1; | |
16665 | while ((length | 0) >= 16) { | |
16666 | _encrypt(S0, S1, S2, S3, S4, S5, S6, S7, S8, S9, SA, SB, SC, SD, SE, SF); | |
16667 | S0 = S0 ^ HEAP[offset]; | |
16668 | S1 = S1 ^ HEAP[offset | 1]; | |
16669 | S2 = S2 ^ HEAP[offset | 2]; | |
16670 | S3 = S3 ^ HEAP[offset | 3]; | |
16671 | S4 = S4 ^ HEAP[offset | 4]; | |
16672 | S5 = S5 ^ HEAP[offset | 5]; | |
16673 | S6 = S6 ^ HEAP[offset | 6]; | |
16674 | S7 = S7 ^ HEAP[offset | 7]; | |
16675 | S8 = S8 ^ HEAP[offset | 8]; | |
16676 | S9 = S9 ^ HEAP[offset | 9]; | |
16677 | SA = SA ^ HEAP[offset | 10]; | |
16678 | SB = SB ^ HEAP[offset | 11]; | |
16679 | SC = SC ^ HEAP[offset | 12]; | |
16680 | SD = SD ^ HEAP[offset | 13]; | |
16681 | SE = SE ^ HEAP[offset | 14]; | |
16682 | SF = SF ^ HEAP[offset | 15]; | |
16683 | HEAP[offset] = S0; | |
16684 | HEAP[offset | 1] = S1; | |
16685 | HEAP[offset | 2] = S2; | |
16686 | HEAP[offset | 3] = S3; | |
16687 | HEAP[offset | 4] = S4; | |
16688 | HEAP[offset | 5] = S5; | |
16689 | HEAP[offset | 6] = S6; | |
16690 | HEAP[offset | 7] = S7; | |
16691 | HEAP[offset | 8] = S8; | |
16692 | HEAP[offset | 9] = S9; | |
16693 | HEAP[offset | 10] = SA; | |
16694 | HEAP[offset | 11] = SB; | |
16695 | HEAP[offset | 12] = SC; | |
16696 | HEAP[offset | 13] = SD; | |
16697 | HEAP[offset | 14] = SE; | |
16698 | HEAP[offset | 15] = SF; | |
16699 | offset = offset + 16 | 0; | |
16700 | length = length - 16 | 0; | |
16701 | encrypted = encrypted + 16 | 0; | |
16702 | } | |
16703 | if ((length | 0) > 0) { | |
16704 | _encrypt(S0, S1, S2, S3, S4, S5, S6, S7, S8, S9, SA, SB, SC, SD, SE, SF); | |
16705 | HEAP[offset] = HEAP[offset] ^ S0; | |
16706 | if ((length | 0) > 1) HEAP[offset | 1] = HEAP[offset | 1] ^ S1; | |
16707 | if ((length | 0) > 2) HEAP[offset | 2] = HEAP[offset | 2] ^ S2; | |
16708 | if ((length | 0) > 3) HEAP[offset | 3] = HEAP[offset | 3] ^ S3; | |
16709 | if ((length | 0) > 4) HEAP[offset | 4] = HEAP[offset | 4] ^ S4; | |
16710 | if ((length | 0) > 5) HEAP[offset | 5] = HEAP[offset | 5] ^ S5; | |
16711 | if ((length | 0) > 6) HEAP[offset | 6] = HEAP[offset | 6] ^ S6; | |
16712 | if ((length | 0) > 7) HEAP[offset | 7] = HEAP[offset | 7] ^ S7; | |
16713 | if ((length | 0) > 8) HEAP[offset | 8] = HEAP[offset | 8] ^ S8; | |
16714 | if ((length | 0) > 9) HEAP[offset | 9] = HEAP[offset | 9] ^ S9; | |
16715 | if ((length | 0) > 10) HEAP[offset | 10] = HEAP[offset | 10] ^ SA; | |
16716 | if ((length | 0) > 11) HEAP[offset | 11] = HEAP[offset | 11] ^ SB; | |
16717 | if ((length | 0) > 12) HEAP[offset | 12] = HEAP[offset | 12] ^ SC; | |
16718 | if ((length | 0) > 13) HEAP[offset | 13] = HEAP[offset | 13] ^ SD; | |
16719 | if ((length | 0) > 14) HEAP[offset | 14] = HEAP[offset | 14] ^ SE; | |
16720 | encrypted = encrypted + length | 0; | |
16721 | offset = offset + length | 0; | |
16722 | length = 0; | |
16723 | } | |
16724 | return encrypted | 0; | |
16725 | } | |
16726 | function cfb_decrypt(offset, length) { | |
16727 | offset = offset | 0; | |
16728 | length = length | 0; | |
16729 | var iv0 = 0, iv1 = 0, iv2 = 0, iv3 = 0, iv4 = 0, iv5 = 0, iv6 = 0, iv7 = 0, iv8 = 0, iv9 = 0, ivA = 0, ivB = 0, ivC = 0, ivD = 0, ivE = 0, ivF = 0, decrypted = 0; | |
16730 | if (offset & 15) return -1; | |
16731 | while ((length | 0) >= 16) { | |
16732 | _encrypt(S0, S1, S2, S3, S4, S5, S6, S7, S8, S9, SA, SB, SC, SD, SE, SF); | |
16733 | iv0 = HEAP[offset] | 0; | |
16734 | iv1 = HEAP[offset | 1] | 0; | |
16735 | iv2 = HEAP[offset | 2] | 0; | |
16736 | iv3 = HEAP[offset | 3] | 0; | |
16737 | iv4 = HEAP[offset | 4] | 0; | |
16738 | iv5 = HEAP[offset | 5] | 0; | |
16739 | iv6 = HEAP[offset | 6] | 0; | |
16740 | iv7 = HEAP[offset | 7] | 0; | |
16741 | iv8 = HEAP[offset | 8] | 0; | |
16742 | iv9 = HEAP[offset | 9] | 0; | |
16743 | ivA = HEAP[offset | 10] | 0; | |
16744 | ivB = HEAP[offset | 11] | 0; | |
16745 | ivC = HEAP[offset | 12] | 0; | |
16746 | ivD = HEAP[offset | 13] | 0; | |
16747 | ivE = HEAP[offset | 14] | 0; | |
16748 | ivF = HEAP[offset | 15] | 0; | |
16749 | HEAP[offset] = S0 ^ iv0; | |
16750 | HEAP[offset | 1] = S1 ^ iv1; | |
16751 | HEAP[offset | 2] = S2 ^ iv2; | |
16752 | HEAP[offset | 3] = S3 ^ iv3; | |
16753 | HEAP[offset | 4] = S4 ^ iv4; | |
16754 | HEAP[offset | 5] = S5 ^ iv5; | |
16755 | HEAP[offset | 6] = S6 ^ iv6; | |
16756 | HEAP[offset | 7] = S7 ^ iv7; | |
16757 | HEAP[offset | 8] = S8 ^ iv8; | |
16758 | HEAP[offset | 9] = S9 ^ iv9; | |
16759 | HEAP[offset | 10] = SA ^ ivA; | |
16760 | HEAP[offset | 11] = SB ^ ivB; | |
16761 | HEAP[offset | 12] = SC ^ ivC; | |
16762 | HEAP[offset | 13] = SD ^ ivD; | |
16763 | HEAP[offset | 14] = SE ^ ivE; | |
16764 | HEAP[offset | 15] = SF ^ ivF; | |
16765 | S0 = iv0; | |
16766 | S1 = iv1; | |
16767 | S2 = iv2; | |
16768 | S3 = iv3; | |
16769 | S4 = iv4; | |
16770 | S5 = iv5; | |
16771 | S6 = iv6; | |
16772 | S7 = iv7; | |
16773 | S8 = iv8; | |
16774 | S9 = iv9; | |
16775 | SA = ivA; | |
16776 | SB = ivB; | |
16777 | SC = ivC; | |
16778 | SD = ivD; | |
16779 | SE = ivE; | |
16780 | SF = ivF; | |
16781 | offset = offset + 16 | 0; | |
16782 | length = length - 16 | 0; | |
16783 | decrypted = decrypted + 16 | 0; | |
16784 | } | |
16785 | if ((length | 0) > 0) { | |
16786 | _encrypt(S0, S1, S2, S3, S4, S5, S6, S7, S8, S9, SA, SB, SC, SD, SE, SF); | |
16787 | HEAP[offset] = HEAP[offset] ^ S0; | |
16788 | if ((length | 0) > 1) HEAP[offset | 1] = HEAP[offset | 1] ^ S1; | |
16789 | if ((length | 0) > 2) HEAP[offset | 2] = HEAP[offset | 2] ^ S2; | |
16790 | if ((length | 0) > 3) HEAP[offset | 3] = HEAP[offset | 3] ^ S3; | |
16791 | if ((length | 0) > 4) HEAP[offset | 4] = HEAP[offset | 4] ^ S4; | |
16792 | if ((length | 0) > 5) HEAP[offset | 5] = HEAP[offset | 5] ^ S5; | |
16793 | if ((length | 0) > 6) HEAP[offset | 6] = HEAP[offset | 6] ^ S6; | |
16794 | if ((length | 0) > 7) HEAP[offset | 7] = HEAP[offset | 7] ^ S7; | |
16795 | if ((length | 0) > 8) HEAP[offset | 8] = HEAP[offset | 8] ^ S8; | |
16796 | if ((length | 0) > 9) HEAP[offset | 9] = HEAP[offset | 9] ^ S9; | |
16797 | if ((length | 0) > 10) HEAP[offset | 10] = HEAP[offset | 10] ^ SA; | |
16798 | if ((length | 0) > 11) HEAP[offset | 11] = HEAP[offset | 11] ^ SB; | |
16799 | if ((length | 0) > 12) HEAP[offset | 12] = HEAP[offset | 12] ^ SC; | |
16800 | if ((length | 0) > 13) HEAP[offset | 13] = HEAP[offset | 13] ^ SD; | |
16801 | if ((length | 0) > 14) HEAP[offset | 14] = HEAP[offset | 14] ^ SE; | |
16802 | decrypted = decrypted + length | 0; | |
16803 | offset = offset + length | 0; | |
16804 | length = 0; | |
16805 | } | |
16806 | return decrypted | 0; | |
16807 | } | |
16808 | return { | |
16809 | init_state: init_state, | |
16810 | save_state: save_state, | |
16811 | init_key_128: init_key_128, | |
16812 | init_key_256: init_key_256, | |
16813 | cbc_encrypt: cbc_encrypt, | |
16814 | cbc_decrypt: cbc_decrypt, | |
16815 | cbc_mac: cbc_mac, | |
16816 | ccm_encrypt: ccm_encrypt, | |
16817 | ccm_decrypt: ccm_decrypt, | |
16818 | cfb_encrypt: cfb_encrypt, | |
16819 | cfb_decrypt: cfb_decrypt | |
16820 | }; | |
16821 | } | |
16822 | function aes_asm(stdlib, foreign, buffer) { | |
16823 | var heap = new Uint8Array(buffer); | |
16824 | heap.set(_aes_tables); | |
16825 | return _aes_asm(stdlib, foreign, buffer); | |
16826 | } | |
16827 | var _aes_block_size = 16; | |
16828 | function _aes_constructor(options) { | |
16829 | options = options || {}; | |
16830 | options.heapSize = options.heapSize || 4096; | |
16831 | if (options.heapSize <= 0 || options.heapSize % 4096) throw new IllegalArgumentError("heapSize must be a positive number and multiple of 4096"); | |
16832 | this.BLOCK_SIZE = _aes_block_size; | |
16833 | this.heap = options.heap || new Uint8Array(options.heapSize); | |
16834 | this.asm = options.asm || aes_asm(global, null, this.heap.buffer); | |
16835 | this.pos = _aes_heap_start; | |
16836 | this.len = 0; | |
16837 | this.key = null; | |
16838 | this.result = null; | |
16839 | this.reset(options); | |
16840 | } | |
16841 | function _aes_reset(options) { | |
16842 | options = options || {}; | |
16843 | this.result = null; | |
16844 | this.pos = _aes_heap_start; | |
16845 | this.len = 0; | |
16846 | var asm = this.asm; | |
16847 | var key = options.key; | |
16848 | if (key !== undefined) { | |
16849 | if (is_buffer(key) || is_bytes(key)) { | |
16850 | key = new Uint8Array(key); | |
16851 | } else if (is_string(key)) { | |
16852 | var str = key; | |
16853 | key = new Uint8Array(str.length); | |
16854 | for (var i = 0; i < str.length; ++i) key[i] = str.charCodeAt(i); | |
16855 | } else { | |
16856 | throw new TypeError("unexpected key type"); | |
16857 | } | |
16858 | if (key.length === 16) { | |
16859 | this.key = key; | |
16860 | asm.init_key_128.call(asm, key[0], key[1], key[2], key[3], key[4], key[5], key[6], key[7], key[8], key[9], key[10], key[11], key[12], key[13], key[14], key[15]); | |
16861 | } else if (key.length === 24) { | |
16862 | throw new IllegalArgumentError("illegal key size"); | |
16863 | } else if (key.length === 32) { | |
16864 | this.key = key; | |
16865 | asm.init_key_256.call(asm, key[0], key[1], key[2], key[3], key[4], key[5], key[6], key[7], key[8], key[9], key[10], key[11], key[12], key[13], key[14], key[15], key[16], key[17], key[18], key[19], key[20], key[21], key[22], key[23], key[24], key[25], key[26], key[27], key[28], key[29], key[30], key[31]); | |
16866 | } else { | |
16867 | throw new IllegalArgumentError("illegal key size"); | |
16868 | } | |
16869 | } | |
16870 | return this; | |
16871 | } | |
16872 | function _aes_init_iv(iv) { | |
16873 | var asm = this.asm; | |
16874 | if (iv !== undefined) { | |
16875 | if (is_buffer(iv) || is_bytes(iv)) { | |
16876 | iv = new Uint8Array(iv); | |
16877 | } else if (is_string(iv)) { | |
16878 | var str = iv; | |
16879 | iv = new Uint8Array(str.length); | |
16880 | for (var i = 0; i < str.length; ++i) iv[i] = str.charCodeAt(i); | |
16881 | } else { | |
16882 | throw new TypeError("unexpected iv type"); | |
16883 | } | |
16884 | if (iv.length !== _aes_block_size) throw new IllegalArgumentError("illegal iv size"); | |
16885 | this.iv = iv; | |
16886 | asm.init_state.call(asm, iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7], iv[8], iv[9], iv[10], iv[11], iv[12], iv[13], iv[14], iv[15]); | |
16887 | } else { | |
16888 | this.iv = null; | |
16889 | asm.init_state.call(asm, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); | |
16890 | } | |
16891 | } | |
16892 | function _aes_heap_write(heap, hpos, data, dpos, dlen) { | |
16893 | var hlen = heap.byteLength - hpos, wlen = hlen < dlen ? hlen : dlen; | |
16894 | if (is_buffer(data) || is_bytes(data)) { | |
16895 | heap.set(new Uint8Array(data.buffer || data, dpos, wlen), hpos); | |
16896 | } else if (is_string(data)) { | |
16897 | for (var i = 0; i < wlen; ++i) heap[hpos + i] = data.charCodeAt(dpos + i); | |
16898 | } else { | |
16899 | throw new TypeError("unexpected data type"); | |
16900 | } | |
16901 | return wlen; | |
16902 | } | |
16903 | function cbc_aes_constructor(options) { | |
16904 | this.padding = true; | |
16905 | this.mode = "cbc"; | |
16906 | this.iv = null; | |
16907 | _aes_constructor.call(this, options); | |
16908 | } | |
16909 | function cbc_aes_encrypt_constructor(options) { | |
16910 | cbc_aes_constructor.call(this, options); | |
16911 | } | |
16912 | function cbc_aes_decrypt_constructor(options) { | |
16913 | cbc_aes_constructor.call(this, options); | |
16914 | } | |
16915 | function cbc_aes_reset(options) { | |
16916 | options = options || {}; | |
16917 | _aes_reset.call(this, options); | |
16918 | var padding = options.padding; | |
16919 | if (padding !== undefined) { | |
16920 | this.padding = !!padding; | |
16921 | } else { | |
16922 | this.padding = true; | |
16923 | } | |
16924 | _aes_init_iv.call(this, options.iv); | |
16925 | return this; | |
16926 | } | |
16927 | function cbc_aes_encrypt_process(data) { | |
16928 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
16929 | var dpos = data.byteOffset || 0, dlen = data.byteLength || data.length || 0, asm = this.asm, heap = this.heap, pos = this.pos, len = this.len, rpos = 0, rlen = _aes_block_size * Math.floor((len + dlen) / _aes_block_size), wlen = 0; | |
16930 | var result = new Uint8Array(rlen); | |
16931 | while (dlen > 0) { | |
16932 | wlen = _aes_heap_write(heap, pos + len, data, dpos, dlen); | |
16933 | len += wlen; | |
16934 | dpos += wlen; | |
16935 | dlen -= wlen; | |
16936 | wlen = asm.cbc_encrypt(pos, len); | |
16937 | result.set(heap.subarray(pos, pos + wlen), rpos); | |
16938 | rpos += wlen; | |
16939 | if (wlen < len) { | |
16940 | pos += wlen; | |
16941 | len -= wlen; | |
16942 | } else { | |
16943 | pos = _aes_heap_start; | |
16944 | len = 0; | |
16945 | } | |
16946 | } | |
16947 | this.result = result; | |
16948 | this.pos = pos; | |
16949 | this.len = len; | |
16950 | return this; | |
16951 | } | |
16952 | function cbc_aes_encrypt_finish() { | |
16953 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
16954 | var asm = this.asm, heap = this.heap, padding = this.padding, pos = this.pos, len = this.len, rlen = _aes_block_size * Math.ceil(len / _aes_block_size); | |
16955 | if (len % _aes_block_size === 0) { | |
16956 | if (padding) rlen += _aes_block_size; | |
16957 | } else if (!padding) { | |
16958 | throw new IllegalArgumentError("data length must be a multiple of " + _aes_block_size); | |
16959 | } | |
16960 | var result = new Uint8Array(rlen); | |
16961 | if (len < rlen) { | |
16962 | var plen = _aes_block_size - len % _aes_block_size; | |
16963 | for (var p = 0; p < plen; ++p) heap[pos + len + p] = plen; | |
16964 | len += plen; | |
16965 | } | |
16966 | asm.cbc_encrypt(pos, len); | |
16967 | result.set(heap.subarray(pos, pos + len)); | |
16968 | this.result = result; | |
16969 | this.pos = _aes_heap_start; | |
16970 | this.len = 0; | |
16971 | return this; | |
16972 | } | |
16973 | function cbc_aes_encrypt(data) { | |
16974 | var result1 = cbc_aes_encrypt_process.call(this, data).result, result2 = cbc_aes_encrypt_finish.call(this).result, result; | |
16975 | result = new Uint8Array(result1.length + result2.length); | |
16976 | result.set(result1); | |
16977 | result.set(result2, result1.length); | |
16978 | this.result = result; | |
16979 | return this; | |
16980 | } | |
16981 | function cbc_aes_decrypt_process(data) { | |
16982 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
16983 | var dpos = data.byteOffset || 0, dlen = data.byteLength || data.length || 0, asm = this.asm, heap = this.heap, padding = this.padding, pos = this.pos, len = this.len, rpos = 0, rlen = _aes_block_size * Math.floor((len + dlen) / _aes_block_size), wlen = 0; | |
16984 | var result = new Uint8Array(rlen); | |
16985 | while (dlen > 0) { | |
16986 | wlen = _aes_heap_write(heap, pos + len, data, dpos, dlen); | |
16987 | len += wlen; | |
16988 | dpos += wlen; | |
16989 | dlen -= wlen; | |
16990 | wlen = asm.cbc_decrypt(pos, len - (padding && dlen === 0 && len % _aes_block_size === 0 ? _aes_block_size : 0)); | |
16991 | result.set(heap.subarray(pos, pos + wlen), rpos); | |
16992 | rpos += wlen; | |
16993 | if (wlen < len) { | |
16994 | pos += wlen; | |
16995 | len -= wlen; | |
16996 | } else { | |
16997 | pos = _aes_heap_start; | |
16998 | len = 0; | |
16999 | } | |
17000 | } | |
17001 | this.result = result.subarray(0, rpos); | |
17002 | this.pos = pos; | |
17003 | this.len = len; | |
17004 | return this; | |
17005 | } | |
17006 | function cbc_aes_decrypt_finish() { | |
17007 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17008 | var asm = this.asm, heap = this.heap, padding = this.padding, pos = this.pos, len = this.len; | |
17009 | if (len === 0) { | |
17010 | if (!padding) { | |
17011 | this.result = new Uint8Array(0); | |
17012 | this.pos = _aes_heap_start; | |
17013 | this.len = 0; | |
17014 | return this; | |
17015 | } else { | |
17016 | throw new IllegalStateError("padding not found"); | |
17017 | } | |
17018 | } | |
17019 | if (len % _aes_block_size !== 0) throw new IllegalArgumentError("data length must be a multiple of " + _aes_block_size); | |
17020 | var result = new Uint8Array(len); | |
17021 | asm.cbc_decrypt(pos, len); | |
17022 | result.set(heap.subarray(pos, pos + len)); | |
17023 | if (padding) { | |
17024 | var pad = result[len - 1]; | |
17025 | result = result.subarray(0, len - pad); | |
17026 | } | |
17027 | this.result = result; | |
17028 | this.pos = _aes_heap_start; | |
17029 | this.len = 0; | |
17030 | return this; | |
17031 | } | |
17032 | function cbc_aes_decrypt(data) { | |
17033 | var result1 = cbc_aes_decrypt_process.call(this, data).result, result2 = cbc_aes_decrypt_finish.call(this).result, result; | |
17034 | result = new Uint8Array(result1.length + result2.length); | |
17035 | result.set(result1); | |
17036 | result.set(result2, result1.length); | |
17037 | this.result = result; | |
17038 | return this; | |
17039 | } | |
17040 | var cbc_aes_encrypt_prototype = cbc_aes_encrypt_constructor.prototype; | |
17041 | cbc_aes_encrypt_prototype.reset = cbc_aes_reset; | |
17042 | cbc_aes_encrypt_prototype.process = cbc_aes_encrypt_process; | |
17043 | cbc_aes_encrypt_prototype.finish = cbc_aes_encrypt_finish; | |
17044 | var cbc_aes_decrypt_prototype = cbc_aes_decrypt_constructor.prototype; | |
17045 | cbc_aes_decrypt_prototype.reset = cbc_aes_reset; | |
17046 | cbc_aes_decrypt_prototype.process = cbc_aes_decrypt_process; | |
17047 | cbc_aes_decrypt_prototype.finish = cbc_aes_decrypt_finish; | |
17048 | var cbc_aes_prototype = cbc_aes_constructor.prototype; | |
17049 | cbc_aes_prototype.reset = cbc_aes_reset; | |
17050 | cbc_aes_prototype.encrypt = cbc_aes_encrypt; | |
17051 | cbc_aes_prototype.decrypt = cbc_aes_decrypt; | |
17052 | function _cbc_mac_process(data) { | |
17053 | var dpos = data.byteOffset || 0, dlen = data.byteLength || data.length || 0, wlen = 0; | |
17054 | while (dlen > 0) { | |
17055 | wlen = _aes_heap_write(this.heap, _aes_heap_start, data, dpos, dlen); | |
17056 | this.asm.cbc_mac(_aes_heap_start, wlen, -1); | |
17057 | dpos += wlen; | |
17058 | dlen -= wlen; | |
17059 | } | |
17060 | } | |
17061 | var _ccm_adata_maxLength = 65279, _ccm_data_maxLength = 68719476720; | |
17062 | function ccm_aes_constructor(options) { | |
17063 | this.padding = false; | |
17064 | this.mode = "ccm"; | |
17065 | this.tagSize = _aes_block_size; | |
17066 | this.lengthSize = 4; | |
17067 | this.nonce = null; | |
17068 | this.adata = null; | |
17069 | this.iv = null; | |
17070 | this.dataLength = -1; | |
17071 | this.dataLeft = -1; | |
17072 | this.counter = 1; | |
17073 | _aes_constructor.call(this, options); | |
17074 | } | |
17075 | function ccm_aes_encrypt_constructor(options) { | |
17076 | ccm_aes_constructor.call(this, options); | |
17077 | } | |
17078 | function ccm_aes_decrypt_constructor(options) { | |
17079 | ccm_aes_constructor.call(this, options); | |
17080 | } | |
17081 | function _ccm_calculate_iv() { | |
17082 | var nonce = this.nonce, adata = this.adata, tagSize = this.tagSize, lengthSize = this.lengthSize, dataLength = this.dataLength; | |
17083 | var data = new Uint8Array(_aes_block_size + (adata ? 2 + adata.byteLength : 0)); | |
17084 | data[0] = (adata ? 64 : 0) | tagSize - 2 << 2 | lengthSize - 1; | |
17085 | data.set(nonce, 1); | |
17086 | if (lengthSize > 4) data[11] = (dataLength - (dataLength >>> 0)) / 4294967296 & 15; | |
17087 | if (lengthSize > 3) data[12] = dataLength >>> 24; | |
17088 | if (lengthSize > 2) data[13] = dataLength >>> 16 & 255; | |
17089 | data[14] = dataLength >>> 8 & 255; | |
17090 | data[15] = dataLength & 255; | |
17091 | if (adata) { | |
17092 | data[16] = adata.byteLength >>> 8 & 255; | |
17093 | data[17] = adata.byteLength & 255; | |
17094 | data.set(adata, 18); | |
17095 | } | |
17096 | _cbc_mac_process.call(this, data); | |
17097 | this.asm.save_state(_aes_heap_start); | |
17098 | this.iv = new Uint8Array(this.heap.subarray(_aes_heap_start, _aes_heap_start + _aes_block_size)); | |
17099 | } | |
17100 | function ccm_aes_reset(options) { | |
17101 | options = options || {}; | |
17102 | _aes_reset.call(this, options); | |
17103 | _aes_init_iv.call(this, options.iv); | |
17104 | var tagSize = options.tagSize; | |
17105 | if (tagSize !== undefined) { | |
17106 | if (!is_number(tagSize)) throw new TypeError("tagSize must be a number"); | |
17107 | if (tagSize < 4 || tagSize > 16 || tagSize & 1) throw new IllegalArgumentError("illegal tagSize value"); | |
17108 | this.tagSize = tagSize; | |
17109 | } else { | |
17110 | this.tagSize = _aes_block_size; | |
17111 | } | |
17112 | var lengthSize = options.lengthSize, nonce = options.nonce; | |
17113 | if (nonce !== undefined) { | |
17114 | if (is_buffer(nonce) || is_bytes(nonce)) { | |
17115 | nonce = new Uint8Array(nonce); | |
17116 | } else if (is_string(nonce)) { | |
17117 | var str = nonce; | |
17118 | nonce = new Uint8Array(str.length); | |
17119 | for (var i = 0; i < str.length; ++i) nonce[i] = str.charCodeAt(i); | |
17120 | } else { | |
17121 | throw new TypeError("unexpected nonce type"); | |
17122 | } | |
17123 | if (nonce.length < 10 || nonce.length > 13) throw new IllegalArgumentError("illegal nonce length"); | |
17124 | lengthSize = lengthSize || 15 - nonce.length; | |
17125 | this.nonce = nonce; | |
17126 | } else { | |
17127 | this.nonce = null; | |
17128 | } | |
17129 | if (lengthSize !== undefined) { | |
17130 | if (!is_number(lengthSize)) throw new TypeError("lengthSize must be a number"); | |
17131 | if (lengthSize < 2 || lengthSize > 5 || nonce.length + lengthSize !== 15) throw new IllegalArgumentError("illegal lengthSize value"); | |
17132 | this.lengthSize = lengthSize; | |
17133 | } else { | |
17134 | this.lengthSize = lengthSize = 4; | |
17135 | } | |
17136 | var iv = this.iv; | |
17137 | var counter = options.counter; | |
17138 | if (counter !== undefined) { | |
17139 | if (iv === null) throw new IllegalStateError("iv is also required"); | |
17140 | if (!is_number(counter)) throw new TypeError("counter must be a number"); | |
17141 | this.counter = counter; | |
17142 | } else { | |
17143 | this.counter = 1; | |
17144 | } | |
17145 | var dataLength = options.dataLength; | |
17146 | if (dataLength !== undefined) { | |
17147 | if (!is_number(dataLength)) throw new TypeError("dataLength must be a number"); | |
17148 | if (dataLength < 0 || dataLength > _ccm_data_maxLength || dataLength > Math.pow(2, 8 * lengthSize) - 1) throw new IllegalArgumentError("illegal dataLength value"); | |
17149 | this.dataLength = dataLength; | |
17150 | var dataLeft = options.dataLeft || dataLength; | |
17151 | if (!is_number(dataLeft)) throw new TypeError("dataLeft must be a number"); | |
17152 | if (dataLeft < 0 || dataLeft > dataLength) throw new IllegalArgumentError("illegal dataLeft value"); | |
17153 | this.dataLeft = dataLeft; | |
17154 | } else { | |
17155 | this.dataLength = dataLength = -1; | |
17156 | this.dataLeft = dataLength; | |
17157 | } | |
17158 | var adata = options.adata; | |
17159 | if (adata !== undefined) { | |
17160 | if (iv !== null) throw new IllegalStateError("you must specify either adata or iv, not both"); | |
17161 | if (is_buffer(adata) || is_bytes(adata)) { | |
17162 | adata = new Uint8Array(adata); | |
17163 | } else if (is_string(adata)) { | |
17164 | var str = adata; | |
17165 | adata = new Uint8Array(str.length); | |
17166 | for (var i = 0; i < str.length; ++i) adata[i] = str.charCodeAt(i); | |
17167 | } else { | |
17168 | throw new TypeError("unexpected adata type"); | |
17169 | } | |
17170 | if (adata.byteLength === 0 || adata.byteLength > _ccm_adata_maxLength) throw new IllegalArgumentError("illegal adata length"); | |
17171 | this.adata = adata; | |
17172 | this.counter = 1; | |
17173 | } else { | |
17174 | this.adata = adata = null; | |
17175 | } | |
17176 | if (dataLength !== -1) _ccm_calculate_iv.call(this); | |
17177 | return this; | |
17178 | } | |
17179 | function ccm_aes_encrypt_process(data) { | |
17180 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17181 | var dpos = data.byteOffset || 0, dlen = data.byteLength || data.length || 0, asm = this.asm, heap = this.heap, nonce = this.nonce, counter = this.counter, pos = this.pos, len = this.len, rpos = 0, rlen = _aes_block_size * Math.floor((len + dlen) / _aes_block_size), wlen = 0; | |
17182 | if ((counter - 1 << 4) + len + dlen > _ccm_data_maxLength) throw new RangeError("counter overflow"); | |
17183 | var result = new Uint8Array(rlen); | |
17184 | var asm_args = [ 0, 0, this.lengthSize - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; | |
17185 | for (var i = 0; i < nonce.length; i++) asm_args[3 + i] = nonce[i]; | |
17186 | while (dlen > 0) { | |
17187 | wlen = _aes_heap_write(heap, pos + len, data, dpos, dlen); | |
17188 | len += wlen; | |
17189 | dpos += wlen; | |
17190 | dlen -= wlen; | |
17191 | asm_args[0] = pos; | |
17192 | asm_args[1] = len & ~15; | |
17193 | asm_args[16] = counter / 4294967296 >>> 0; | |
17194 | asm_args[17] = counter >>> 0; | |
17195 | wlen = asm.ccm_encrypt.apply(asm, asm_args); | |
17196 | result.set(heap.subarray(pos, pos + wlen), rpos); | |
17197 | counter += wlen >>> 4; | |
17198 | rpos += wlen; | |
17199 | if (wlen < len) { | |
17200 | pos += wlen; | |
17201 | len -= wlen; | |
17202 | } else { | |
17203 | pos = _aes_heap_start; | |
17204 | len = 0; | |
17205 | } | |
17206 | } | |
17207 | this.result = result; | |
17208 | this.counter = counter; | |
17209 | this.pos = pos; | |
17210 | this.len = len; | |
17211 | return this; | |
17212 | } | |
17213 | function ccm_aes_encrypt_finish() { | |
17214 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17215 | var asm = this.asm, heap = this.heap, nonce = this.nonce, counter = this.counter, tagSize = this.tagSize, pos = this.pos, len = this.len, wlen = 0; | |
17216 | var result = new Uint8Array(len + tagSize); | |
17217 | var asm_args = [ 0, 0, this.lengthSize - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; | |
17218 | for (var i = 0; i < nonce.length; i++) asm_args[3 + i] = nonce[i]; | |
17219 | asm_args[0] = pos; | |
17220 | asm_args[1] = len; | |
17221 | asm_args[16] = counter / 4294967296 >>> 0; | |
17222 | asm_args[17] = counter >>> 0; | |
17223 | wlen = asm.ccm_encrypt.apply(asm, asm_args); | |
17224 | result.set(heap.subarray(pos, pos + wlen)); | |
17225 | counter = 1; | |
17226 | pos = _aes_heap_start; | |
17227 | len = 0; | |
17228 | asm.save_state(_aes_heap_start); | |
17229 | asm_args[0] = _aes_heap_start, asm_args[1] = _aes_block_size, asm_args[16] = 0; | |
17230 | asm_args[17] = 0; | |
17231 | asm.ccm_encrypt.apply(asm, asm_args); | |
17232 | result.set(heap.subarray(_aes_heap_start, _aes_heap_start + tagSize), wlen); | |
17233 | this.result = result; | |
17234 | this.counter = counter; | |
17235 | this.pos = pos; | |
17236 | this.len = len; | |
17237 | return this; | |
17238 | } | |
17239 | function ccm_aes_encrypt(data) { | |
17240 | this.dataLength = this.dataLeft = data.byteLength || data.length || 0; | |
17241 | var result1 = ccm_aes_encrypt_process.call(this, data).result, result2 = ccm_aes_encrypt_finish.call(this).result, result; | |
17242 | result = new Uint8Array(result1.length + result2.length); | |
17243 | result.set(result1); | |
17244 | result.set(result2, result1.length); | |
17245 | this.result = result; | |
17246 | return this; | |
17247 | } | |
17248 | function ccm_aes_decrypt_process(data) { | |
17249 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17250 | var dpos = data.byteOffset || 0, dlen = data.byteLength || data.length || 0, asm = this.asm, heap = this.heap, nonce = this.nonce, counter = this.counter, tagSize = this.tagSize, pos = this.pos, len = this.len, rpos = 0, rlen = _aes_block_size * Math.floor((len + dlen) / _aes_block_size), wlen = 0; | |
17251 | if ((counter - 1 << 4) + len + dlen > _ccm_data_maxLength) throw new RangeError("counter overflow"); | |
17252 | var result = new Uint8Array(rlen); | |
17253 | var asm_args = [ 0, 0, this.lengthSize - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; | |
17254 | for (var i = 0; i < nonce.length; i++) asm_args[3 + i] = nonce[i]; | |
17255 | while (dlen > 0) { | |
17256 | wlen = _aes_heap_write(heap, pos + len, data, dpos, dlen); | |
17257 | len += wlen; | |
17258 | dpos += wlen; | |
17259 | dlen -= wlen; | |
17260 | asm_args[0] = pos; | |
17261 | asm_args[1] = len + dlen - tagSize >= _aes_block_size ? dlen >= tagSize ? len & ~15 : len + dlen - tagSize & ~15 : 0; | |
17262 | asm_args[16] = counter / 4294967296 >>> 0; | |
17263 | asm_args[17] = counter >>> 0; | |
17264 | wlen = asm.ccm_decrypt.apply(asm, asm_args); | |
17265 | result.set(heap.subarray(pos, pos + wlen), rpos); | |
17266 | counter += wlen >>> 4; | |
17267 | rpos += wlen; | |
17268 | if (wlen < len) { | |
17269 | pos += wlen; | |
17270 | len -= wlen; | |
17271 | } else { | |
17272 | pos = _aes_heap_start; | |
17273 | len = 0; | |
17274 | } | |
17275 | } | |
17276 | this.result = result.subarray(0, rpos); | |
17277 | this.counter = counter; | |
17278 | this.pos = pos; | |
17279 | this.len = len; | |
17280 | return this; | |
17281 | } | |
17282 | function ccm_aes_decrypt_finish() { | |
17283 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17284 | var asm = this.asm, heap = this.heap, nonce = this.nonce, counter = this.counter, tagSize = this.tagSize, pos = this.pos, len = this.len, rlen = len - tagSize, wlen = 0; | |
17285 | if (len < tagSize) throw new IllegalStateError("authentication tag not found"); | |
17286 | var result = new Uint8Array(rlen), atag = new Uint8Array(heap.subarray(pos + rlen, pos + len)); | |
17287 | var asm_args = [ 0, 0, this.lengthSize - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; | |
17288 | for (var i = 0; i < nonce.length; i++) asm_args[3 + i] = nonce[i]; | |
17289 | asm_args[0] = pos; | |
17290 | asm_args[1] = rlen; | |
17291 | asm_args[16] = counter / 4294967296 >>> 0; | |
17292 | asm_args[17] = counter >>> 0; | |
17293 | wlen = asm.ccm_decrypt.apply(asm, asm_args); | |
17294 | result.set(heap.subarray(pos, pos + wlen)); | |
17295 | counter = 1; | |
17296 | pos = _aes_heap_start; | |
17297 | len = 0; | |
17298 | asm.save_state(_aes_heap_start); | |
17299 | asm_args[0] = _aes_heap_start, asm_args[1] = _aes_block_size, asm_args[16] = 0; | |
17300 | asm_args[17] = 0; | |
17301 | asm.ccm_encrypt.apply(asm, asm_args); | |
17302 | var acheck = 0; | |
17303 | for (var i = 0; i < tagSize; ++i) acheck |= atag[i] ^ heap[_aes_heap_start + i]; | |
17304 | if (acheck) throw new SecurityError("data integrity check failed"); | |
17305 | this.result = result; | |
17306 | this.counter = counter; | |
17307 | this.pos = pos; | |
17308 | this.len = len; | |
17309 | return this; | |
17310 | } | |
17311 | function ccm_aes_decrypt(data) { | |
17312 | this.dataLength = this.dataLeft = data.byteLength || data.length || 0; | |
17313 | var result1 = ccm_aes_decrypt_process.call(this, data).result, result2 = ccm_aes_decrypt_finish.call(this).result, result; | |
17314 | result = new Uint8Array(result1.length + result2.length); | |
17315 | result.set(result1); | |
17316 | result.set(result2, result1.length); | |
17317 | this.result = result; | |
17318 | return this; | |
17319 | } | |
17320 | var ccm_aes_prototype = ccm_aes_constructor.prototype; | |
17321 | ccm_aes_prototype.reset = ccm_aes_reset; | |
17322 | ccm_aes_prototype.encrypt = ccm_aes_encrypt; | |
17323 | ccm_aes_prototype.decrypt = ccm_aes_decrypt; | |
17324 | var ccm_aes_encrypt_prototype = ccm_aes_encrypt_constructor.prototype; | |
17325 | ccm_aes_encrypt_prototype.reset = ccm_aes_reset; | |
17326 | ccm_aes_encrypt_prototype.process = ccm_aes_encrypt_process; | |
17327 | ccm_aes_encrypt_prototype.finish = ccm_aes_encrypt_finish; | |
17328 | var ccm_aes_decrypt_prototype = ccm_aes_decrypt_constructor.prototype; | |
17329 | ccm_aes_decrypt_prototype.reset = ccm_aes_reset; | |
17330 | ccm_aes_decrypt_prototype.process = ccm_aes_decrypt_process; | |
17331 | ccm_aes_decrypt_prototype.finish = ccm_aes_decrypt_finish; | |
17332 | function cfb_aes_constructor(options) { | |
17333 | this.padding = false; | |
17334 | this.mode = "cfb"; | |
17335 | this.iv = null; | |
17336 | _aes_constructor.call(this, options); | |
17337 | } | |
17338 | function cfb_aes_encrypt_constructor(options) { | |
17339 | cfb_aes_constructor.call(this, options); | |
17340 | } | |
17341 | function cfb_aes_decrypt_constructor(options) { | |
17342 | cfb_aes_constructor.call(this, options); | |
17343 | } | |
17344 | function cfb_aes_reset(options) { | |
17345 | options = options || {}; | |
17346 | _aes_reset.call(this, options); | |
17347 | _aes_init_iv.call(this, options.iv); | |
17348 | return this; | |
17349 | } | |
17350 | function cfb_aes_encrypt_process(data) { | |
17351 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17352 | var dpos = data.byteOffset || 0, dlen = data.byteLength || data.length || 0, asm = this.asm, heap = this.heap, pos = this.pos, len = this.len, rpos = 0, rlen = _aes_block_size * Math.floor((len + dlen) / _aes_block_size), wlen = 0; | |
17353 | var result = new Uint8Array(rlen); | |
17354 | while (dlen > 0) { | |
17355 | wlen = _aes_heap_write(heap, pos + len, data, dpos, dlen); | |
17356 | len += wlen; | |
17357 | dpos += wlen; | |
17358 | dlen -= wlen; | |
17359 | wlen = asm.cfb_encrypt(pos, _aes_block_size * Math.floor(len / _aes_block_size)); | |
17360 | result.set(heap.subarray(pos, pos + wlen), rpos); | |
17361 | rpos += wlen; | |
17362 | if (wlen < len) { | |
17363 | pos += wlen; | |
17364 | len -= wlen; | |
17365 | } else { | |
17366 | pos = _aes_heap_start; | |
17367 | len = 0; | |
17368 | } | |
17369 | } | |
17370 | this.result = result; | |
17371 | this.pos = pos; | |
17372 | this.len = len; | |
17373 | return this; | |
17374 | } | |
17375 | function cfb_aes_encrypt_finish() { | |
17376 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17377 | var asm = this.asm, heap = this.heap, pos = this.pos, len = this.len; | |
17378 | var result = new Uint8Array(len); | |
17379 | asm.cfb_encrypt(pos, len); | |
17380 | result.set(heap.subarray(pos, pos + len)); | |
17381 | this.result = result; | |
17382 | this.pos = _aes_heap_start; | |
17383 | this.len = 0; | |
17384 | return this; | |
17385 | } | |
17386 | function cfb_aes_encrypt(data) { | |
17387 | var result1 = cfb_aes_encrypt_process.call(this, data).result, result2 = cfb_aes_encrypt_finish.call(this).result, result; | |
17388 | result = new Uint8Array(result1.length + result2.length); | |
17389 | result.set(result1); | |
17390 | result.set(result2, result1.length); | |
17391 | this.result = result; | |
17392 | return this; | |
17393 | } | |
17394 | function cfb_aes_decrypt_process(data) { | |
17395 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17396 | var dpos = data.byteOffset || 0, dlen = data.byteLength || data.length || 0, asm = this.asm, heap = this.heap, pos = this.pos, len = this.len, rpos = 0, rlen = _aes_block_size * Math.floor((len + dlen) / _aes_block_size), wlen = 0; | |
17397 | var result = new Uint8Array(rlen); | |
17398 | while (dlen > 0) { | |
17399 | wlen = _aes_heap_write(heap, pos + len, data, dpos, dlen); | |
17400 | len += wlen; | |
17401 | dpos += wlen; | |
17402 | dlen -= wlen; | |
17403 | wlen = asm.cfb_decrypt(pos, _aes_block_size * Math.floor(len / _aes_block_size)); | |
17404 | result.set(heap.subarray(pos, pos + wlen), rpos); | |
17405 | rpos += wlen; | |
17406 | if (wlen < len) { | |
17407 | pos += wlen; | |
17408 | len -= wlen; | |
17409 | } else { | |
17410 | pos = _aes_heap_start; | |
17411 | len = 0; | |
17412 | } | |
17413 | } | |
17414 | this.result = result.subarray(0, rpos); | |
17415 | this.pos = pos; | |
17416 | this.len = len; | |
17417 | return this; | |
17418 | } | |
17419 | function cfb_aes_decrypt_finish() { | |
17420 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17421 | var asm = this.asm, heap = this.heap, pos = this.pos, len = this.len; | |
17422 | if (len === 0) { | |
17423 | this.result = new Uint8Array(0); | |
17424 | this.pos = _aes_heap_start; | |
17425 | this.len = 0; | |
17426 | return this; | |
17427 | } | |
17428 | var result = new Uint8Array(len); | |
17429 | asm.cfb_decrypt(pos, len); | |
17430 | result.set(heap.subarray(pos, pos + len)); | |
17431 | this.result = result; | |
17432 | this.pos = _aes_heap_start; | |
17433 | this.len = 0; | |
17434 | return this; | |
17435 | } | |
17436 | function cfb_aes_decrypt(data) { | |
17437 | var result1 = cfb_aes_decrypt_process.call(this, data).result, result2 = cfb_aes_decrypt_finish.call(this).result, result; | |
17438 | result = new Uint8Array(result1.length + result2.length); | |
17439 | result.set(result1); | |
17440 | result.set(result2, result1.length); | |
17441 | this.result = result; | |
17442 | return this; | |
17443 | } | |
17444 | var cfb_aes_encrypt_prototype = cfb_aes_encrypt_constructor.prototype; | |
17445 | cfb_aes_encrypt_prototype.reset = cfb_aes_reset; | |
17446 | cfb_aes_encrypt_prototype.process = cfb_aes_encrypt_process; | |
17447 | cfb_aes_encrypt_prototype.finish = cfb_aes_encrypt_finish; | |
17448 | var cfb_aes_decrypt_prototype = cfb_aes_decrypt_constructor.prototype; | |
17449 | cfb_aes_decrypt_prototype.reset = cfb_aes_reset; | |
17450 | cfb_aes_decrypt_prototype.process = cfb_aes_decrypt_process; | |
17451 | cfb_aes_decrypt_prototype.finish = cfb_aes_decrypt_finish; | |
17452 | var cfb_aes_prototype = cfb_aes_constructor.prototype; | |
17453 | cfb_aes_prototype.reset = cfb_aes_reset; | |
17454 | cfb_aes_prototype.encrypt = cfb_aes_encrypt; | |
17455 | cfb_aes_prototype.decrypt = cfb_aes_decrypt; | |
17456 | function sha256_asm(stdlib, foreign, buffer) { | |
17457 | // Closure Compiler warning - commented out | |
17458 | //"use asm"; | |
17459 | var H0 = 0, H1 = 0, H2 = 0, H3 = 0, H4 = 0, H5 = 0, H6 = 0, H7 = 0, TOTAL = 0; | |
17460 | var I0 = 0, I1 = 0, I2 = 0, I3 = 0, I4 = 0, I5 = 0, I6 = 0, I7 = 0, O0 = 0, O1 = 0, O2 = 0, O3 = 0, O4 = 0, O5 = 0, O6 = 0, O7 = 0; | |
17461 | var HEAP = new stdlib.Uint8Array(buffer); | |
17462 | function _core(w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15) { | |
17463 | w0 = w0 | 0; | |
17464 | w1 = w1 | 0; | |
17465 | w2 = w2 | 0; | |
17466 | w3 = w3 | 0; | |
17467 | w4 = w4 | 0; | |
17468 | w5 = w5 | 0; | |
17469 | w6 = w6 | 0; | |
17470 | w7 = w7 | 0; | |
17471 | w8 = w8 | 0; | |
17472 | w9 = w9 | 0; | |
17473 | w10 = w10 | 0; | |
17474 | w11 = w11 | 0; | |
17475 | w12 = w12 | 0; | |
17476 | w13 = w13 | 0; | |
17477 | w14 = w14 | 0; | |
17478 | w15 = w15 | 0; | |
17479 | var a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, t = 0; | |
17480 | a = H0; | |
17481 | b = H1; | |
17482 | c = H2; | |
17483 | d = H3; | |
17484 | e = H4; | |
17485 | f = H5; | |
17486 | g = H6; | |
17487 | h = H7; | |
17488 | t = w0 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1116352408 | 0; | |
17489 | h = g; | |
17490 | g = f; | |
17491 | f = e; | |
17492 | e = d + t | 0; | |
17493 | d = c; | |
17494 | c = b; | |
17495 | b = a; | |
17496 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17497 | t = w1 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1899447441 | 0; | |
17498 | h = g; | |
17499 | g = f; | |
17500 | f = e; | |
17501 | e = d + t | 0; | |
17502 | d = c; | |
17503 | c = b; | |
17504 | b = a; | |
17505 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17506 | t = w2 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3049323471 | 0; | |
17507 | h = g; | |
17508 | g = f; | |
17509 | f = e; | |
17510 | e = d + t | 0; | |
17511 | d = c; | |
17512 | c = b; | |
17513 | b = a; | |
17514 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17515 | t = w3 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3921009573 | 0; | |
17516 | h = g; | |
17517 | g = f; | |
17518 | f = e; | |
17519 | e = d + t | 0; | |
17520 | d = c; | |
17521 | c = b; | |
17522 | b = a; | |
17523 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17524 | t = w4 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 961987163 | 0; | |
17525 | h = g; | |
17526 | g = f; | |
17527 | f = e; | |
17528 | e = d + t | 0; | |
17529 | d = c; | |
17530 | c = b; | |
17531 | b = a; | |
17532 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17533 | t = w5 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1508970993 | 0; | |
17534 | h = g; | |
17535 | g = f; | |
17536 | f = e; | |
17537 | e = d + t | 0; | |
17538 | d = c; | |
17539 | c = b; | |
17540 | b = a; | |
17541 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17542 | t = w6 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2453635748 | 0; | |
17543 | h = g; | |
17544 | g = f; | |
17545 | f = e; | |
17546 | e = d + t | 0; | |
17547 | d = c; | |
17548 | c = b; | |
17549 | b = a; | |
17550 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17551 | t = w7 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2870763221 | 0; | |
17552 | h = g; | |
17553 | g = f; | |
17554 | f = e; | |
17555 | e = d + t | 0; | |
17556 | d = c; | |
17557 | c = b; | |
17558 | b = a; | |
17559 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17560 | t = w8 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3624381080 | 0; | |
17561 | h = g; | |
17562 | g = f; | |
17563 | f = e; | |
17564 | e = d + t | 0; | |
17565 | d = c; | |
17566 | c = b; | |
17567 | b = a; | |
17568 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17569 | t = w9 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 310598401 | 0; | |
17570 | h = g; | |
17571 | g = f; | |
17572 | f = e; | |
17573 | e = d + t | 0; | |
17574 | d = c; | |
17575 | c = b; | |
17576 | b = a; | |
17577 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17578 | t = w10 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 607225278 | 0; | |
17579 | h = g; | |
17580 | g = f; | |
17581 | f = e; | |
17582 | e = d + t | 0; | |
17583 | d = c; | |
17584 | c = b; | |
17585 | b = a; | |
17586 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17587 | t = w11 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1426881987 | 0; | |
17588 | h = g; | |
17589 | g = f; | |
17590 | f = e; | |
17591 | e = d + t | 0; | |
17592 | d = c; | |
17593 | c = b; | |
17594 | b = a; | |
17595 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17596 | t = w12 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1925078388 | 0; | |
17597 | h = g; | |
17598 | g = f; | |
17599 | f = e; | |
17600 | e = d + t | 0; | |
17601 | d = c; | |
17602 | c = b; | |
17603 | b = a; | |
17604 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17605 | t = w13 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2162078206 | 0; | |
17606 | h = g; | |
17607 | g = f; | |
17608 | f = e; | |
17609 | e = d + t | 0; | |
17610 | d = c; | |
17611 | c = b; | |
17612 | b = a; | |
17613 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17614 | t = w14 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2614888103 | 0; | |
17615 | h = g; | |
17616 | g = f; | |
17617 | f = e; | |
17618 | e = d + t | 0; | |
17619 | d = c; | |
17620 | c = b; | |
17621 | b = a; | |
17622 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17623 | t = w15 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3248222580 | 0; | |
17624 | h = g; | |
17625 | g = f; | |
17626 | f = e; | |
17627 | e = d + t | 0; | |
17628 | d = c; | |
17629 | c = b; | |
17630 | b = a; | |
17631 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17632 | w0 = t = (w1 >>> 7 ^ w1 >>> 18 ^ w1 >>> 3 ^ w1 << 25 ^ w1 << 14) + (w14 >>> 17 ^ w14 >>> 19 ^ w14 >>> 10 ^ w14 << 15 ^ w14 << 13) + w0 + w9 | 0; | |
17633 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3835390401 | 0; | |
17634 | h = g; | |
17635 | g = f; | |
17636 | f = e; | |
17637 | e = d + t | 0; | |
17638 | d = c; | |
17639 | c = b; | |
17640 | b = a; | |
17641 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17642 | w1 = t = (w2 >>> 7 ^ w2 >>> 18 ^ w2 >>> 3 ^ w2 << 25 ^ w2 << 14) + (w15 >>> 17 ^ w15 >>> 19 ^ w15 >>> 10 ^ w15 << 15 ^ w15 << 13) + w1 + w10 | 0; | |
17643 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 4022224774 | 0; | |
17644 | h = g; | |
17645 | g = f; | |
17646 | f = e; | |
17647 | e = d + t | 0; | |
17648 | d = c; | |
17649 | c = b; | |
17650 | b = a; | |
17651 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17652 | w2 = t = (w3 >>> 7 ^ w3 >>> 18 ^ w3 >>> 3 ^ w3 << 25 ^ w3 << 14) + (w0 >>> 17 ^ w0 >>> 19 ^ w0 >>> 10 ^ w0 << 15 ^ w0 << 13) + w2 + w11 | 0; | |
17653 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 264347078 | 0; | |
17654 | h = g; | |
17655 | g = f; | |
17656 | f = e; | |
17657 | e = d + t | 0; | |
17658 | d = c; | |
17659 | c = b; | |
17660 | b = a; | |
17661 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17662 | w3 = t = (w4 >>> 7 ^ w4 >>> 18 ^ w4 >>> 3 ^ w4 << 25 ^ w4 << 14) + (w1 >>> 17 ^ w1 >>> 19 ^ w1 >>> 10 ^ w1 << 15 ^ w1 << 13) + w3 + w12 | 0; | |
17663 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 604807628 | 0; | |
17664 | h = g; | |
17665 | g = f; | |
17666 | f = e; | |
17667 | e = d + t | 0; | |
17668 | d = c; | |
17669 | c = b; | |
17670 | b = a; | |
17671 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17672 | w4 = t = (w5 >>> 7 ^ w5 >>> 18 ^ w5 >>> 3 ^ w5 << 25 ^ w5 << 14) + (w2 >>> 17 ^ w2 >>> 19 ^ w2 >>> 10 ^ w2 << 15 ^ w2 << 13) + w4 + w13 | 0; | |
17673 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 770255983 | 0; | |
17674 | h = g; | |
17675 | g = f; | |
17676 | f = e; | |
17677 | e = d + t | 0; | |
17678 | d = c; | |
17679 | c = b; | |
17680 | b = a; | |
17681 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17682 | w5 = t = (w6 >>> 7 ^ w6 >>> 18 ^ w6 >>> 3 ^ w6 << 25 ^ w6 << 14) + (w3 >>> 17 ^ w3 >>> 19 ^ w3 >>> 10 ^ w3 << 15 ^ w3 << 13) + w5 + w14 | 0; | |
17683 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1249150122 | 0; | |
17684 | h = g; | |
17685 | g = f; | |
17686 | f = e; | |
17687 | e = d + t | 0; | |
17688 | d = c; | |
17689 | c = b; | |
17690 | b = a; | |
17691 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17692 | w6 = t = (w7 >>> 7 ^ w7 >>> 18 ^ w7 >>> 3 ^ w7 << 25 ^ w7 << 14) + (w4 >>> 17 ^ w4 >>> 19 ^ w4 >>> 10 ^ w4 << 15 ^ w4 << 13) + w6 + w15 | 0; | |
17693 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1555081692 | 0; | |
17694 | h = g; | |
17695 | g = f; | |
17696 | f = e; | |
17697 | e = d + t | 0; | |
17698 | d = c; | |
17699 | c = b; | |
17700 | b = a; | |
17701 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17702 | w7 = t = (w8 >>> 7 ^ w8 >>> 18 ^ w8 >>> 3 ^ w8 << 25 ^ w8 << 14) + (w5 >>> 17 ^ w5 >>> 19 ^ w5 >>> 10 ^ w5 << 15 ^ w5 << 13) + w7 + w0 | 0; | |
17703 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1996064986 | 0; | |
17704 | h = g; | |
17705 | g = f; | |
17706 | f = e; | |
17707 | e = d + t | 0; | |
17708 | d = c; | |
17709 | c = b; | |
17710 | b = a; | |
17711 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17712 | w8 = t = (w9 >>> 7 ^ w9 >>> 18 ^ w9 >>> 3 ^ w9 << 25 ^ w9 << 14) + (w6 >>> 17 ^ w6 >>> 19 ^ w6 >>> 10 ^ w6 << 15 ^ w6 << 13) + w8 + w1 | 0; | |
17713 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2554220882 | 0; | |
17714 | h = g; | |
17715 | g = f; | |
17716 | f = e; | |
17717 | e = d + t | 0; | |
17718 | d = c; | |
17719 | c = b; | |
17720 | b = a; | |
17721 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17722 | w9 = t = (w10 >>> 7 ^ w10 >>> 18 ^ w10 >>> 3 ^ w10 << 25 ^ w10 << 14) + (w7 >>> 17 ^ w7 >>> 19 ^ w7 >>> 10 ^ w7 << 15 ^ w7 << 13) + w9 + w2 | 0; | |
17723 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2821834349 | 0; | |
17724 | h = g; | |
17725 | g = f; | |
17726 | f = e; | |
17727 | e = d + t | 0; | |
17728 | d = c; | |
17729 | c = b; | |
17730 | b = a; | |
17731 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17732 | w10 = t = (w11 >>> 7 ^ w11 >>> 18 ^ w11 >>> 3 ^ w11 << 25 ^ w11 << 14) + (w8 >>> 17 ^ w8 >>> 19 ^ w8 >>> 10 ^ w8 << 15 ^ w8 << 13) + w10 + w3 | 0; | |
17733 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2952996808 | 0; | |
17734 | h = g; | |
17735 | g = f; | |
17736 | f = e; | |
17737 | e = d + t | 0; | |
17738 | d = c; | |
17739 | c = b; | |
17740 | b = a; | |
17741 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17742 | w11 = t = (w12 >>> 7 ^ w12 >>> 18 ^ w12 >>> 3 ^ w12 << 25 ^ w12 << 14) + (w9 >>> 17 ^ w9 >>> 19 ^ w9 >>> 10 ^ w9 << 15 ^ w9 << 13) + w11 + w4 | 0; | |
17743 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3210313671 | 0; | |
17744 | h = g; | |
17745 | g = f; | |
17746 | f = e; | |
17747 | e = d + t | 0; | |
17748 | d = c; | |
17749 | c = b; | |
17750 | b = a; | |
17751 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17752 | w12 = t = (w13 >>> 7 ^ w13 >>> 18 ^ w13 >>> 3 ^ w13 << 25 ^ w13 << 14) + (w10 >>> 17 ^ w10 >>> 19 ^ w10 >>> 10 ^ w10 << 15 ^ w10 << 13) + w12 + w5 | 0; | |
17753 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3336571891 | 0; | |
17754 | h = g; | |
17755 | g = f; | |
17756 | f = e; | |
17757 | e = d + t | 0; | |
17758 | d = c; | |
17759 | c = b; | |
17760 | b = a; | |
17761 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17762 | w13 = t = (w14 >>> 7 ^ w14 >>> 18 ^ w14 >>> 3 ^ w14 << 25 ^ w14 << 14) + (w11 >>> 17 ^ w11 >>> 19 ^ w11 >>> 10 ^ w11 << 15 ^ w11 << 13) + w13 + w6 | 0; | |
17763 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3584528711 | 0; | |
17764 | h = g; | |
17765 | g = f; | |
17766 | f = e; | |
17767 | e = d + t | 0; | |
17768 | d = c; | |
17769 | c = b; | |
17770 | b = a; | |
17771 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17772 | w14 = t = (w15 >>> 7 ^ w15 >>> 18 ^ w15 >>> 3 ^ w15 << 25 ^ w15 << 14) + (w12 >>> 17 ^ w12 >>> 19 ^ w12 >>> 10 ^ w12 << 15 ^ w12 << 13) + w14 + w7 | 0; | |
17773 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 113926993 | 0; | |
17774 | h = g; | |
17775 | g = f; | |
17776 | f = e; | |
17777 | e = d + t | 0; | |
17778 | d = c; | |
17779 | c = b; | |
17780 | b = a; | |
17781 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17782 | w15 = t = (w0 >>> 7 ^ w0 >>> 18 ^ w0 >>> 3 ^ w0 << 25 ^ w0 << 14) + (w13 >>> 17 ^ w13 >>> 19 ^ w13 >>> 10 ^ w13 << 15 ^ w13 << 13) + w15 + w8 | 0; | |
17783 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 338241895 | 0; | |
17784 | h = g; | |
17785 | g = f; | |
17786 | f = e; | |
17787 | e = d + t | 0; | |
17788 | d = c; | |
17789 | c = b; | |
17790 | b = a; | |
17791 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17792 | w0 = t = (w1 >>> 7 ^ w1 >>> 18 ^ w1 >>> 3 ^ w1 << 25 ^ w1 << 14) + (w14 >>> 17 ^ w14 >>> 19 ^ w14 >>> 10 ^ w14 << 15 ^ w14 << 13) + w0 + w9 | 0; | |
17793 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 666307205 | 0; | |
17794 | h = g; | |
17795 | g = f; | |
17796 | f = e; | |
17797 | e = d + t | 0; | |
17798 | d = c; | |
17799 | c = b; | |
17800 | b = a; | |
17801 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17802 | w1 = t = (w2 >>> 7 ^ w2 >>> 18 ^ w2 >>> 3 ^ w2 << 25 ^ w2 << 14) + (w15 >>> 17 ^ w15 >>> 19 ^ w15 >>> 10 ^ w15 << 15 ^ w15 << 13) + w1 + w10 | 0; | |
17803 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 773529912 | 0; | |
17804 | h = g; | |
17805 | g = f; | |
17806 | f = e; | |
17807 | e = d + t | 0; | |
17808 | d = c; | |
17809 | c = b; | |
17810 | b = a; | |
17811 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17812 | w2 = t = (w3 >>> 7 ^ w3 >>> 18 ^ w3 >>> 3 ^ w3 << 25 ^ w3 << 14) + (w0 >>> 17 ^ w0 >>> 19 ^ w0 >>> 10 ^ w0 << 15 ^ w0 << 13) + w2 + w11 | 0; | |
17813 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1294757372 | 0; | |
17814 | h = g; | |
17815 | g = f; | |
17816 | f = e; | |
17817 | e = d + t | 0; | |
17818 | d = c; | |
17819 | c = b; | |
17820 | b = a; | |
17821 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17822 | w3 = t = (w4 >>> 7 ^ w4 >>> 18 ^ w4 >>> 3 ^ w4 << 25 ^ w4 << 14) + (w1 >>> 17 ^ w1 >>> 19 ^ w1 >>> 10 ^ w1 << 15 ^ w1 << 13) + w3 + w12 | 0; | |
17823 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1396182291 | 0; | |
17824 | h = g; | |
17825 | g = f; | |
17826 | f = e; | |
17827 | e = d + t | 0; | |
17828 | d = c; | |
17829 | c = b; | |
17830 | b = a; | |
17831 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17832 | w4 = t = (w5 >>> 7 ^ w5 >>> 18 ^ w5 >>> 3 ^ w5 << 25 ^ w5 << 14) + (w2 >>> 17 ^ w2 >>> 19 ^ w2 >>> 10 ^ w2 << 15 ^ w2 << 13) + w4 + w13 | 0; | |
17833 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1695183700 | 0; | |
17834 | h = g; | |
17835 | g = f; | |
17836 | f = e; | |
17837 | e = d + t | 0; | |
17838 | d = c; | |
17839 | c = b; | |
17840 | b = a; | |
17841 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17842 | w5 = t = (w6 >>> 7 ^ w6 >>> 18 ^ w6 >>> 3 ^ w6 << 25 ^ w6 << 14) + (w3 >>> 17 ^ w3 >>> 19 ^ w3 >>> 10 ^ w3 << 15 ^ w3 << 13) + w5 + w14 | 0; | |
17843 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1986661051 | 0; | |
17844 | h = g; | |
17845 | g = f; | |
17846 | f = e; | |
17847 | e = d + t | 0; | |
17848 | d = c; | |
17849 | c = b; | |
17850 | b = a; | |
17851 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17852 | w6 = t = (w7 >>> 7 ^ w7 >>> 18 ^ w7 >>> 3 ^ w7 << 25 ^ w7 << 14) + (w4 >>> 17 ^ w4 >>> 19 ^ w4 >>> 10 ^ w4 << 15 ^ w4 << 13) + w6 + w15 | 0; | |
17853 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2177026350 | 0; | |
17854 | h = g; | |
17855 | g = f; | |
17856 | f = e; | |
17857 | e = d + t | 0; | |
17858 | d = c; | |
17859 | c = b; | |
17860 | b = a; | |
17861 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17862 | w7 = t = (w8 >>> 7 ^ w8 >>> 18 ^ w8 >>> 3 ^ w8 << 25 ^ w8 << 14) + (w5 >>> 17 ^ w5 >>> 19 ^ w5 >>> 10 ^ w5 << 15 ^ w5 << 13) + w7 + w0 | 0; | |
17863 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2456956037 | 0; | |
17864 | h = g; | |
17865 | g = f; | |
17866 | f = e; | |
17867 | e = d + t | 0; | |
17868 | d = c; | |
17869 | c = b; | |
17870 | b = a; | |
17871 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17872 | w8 = t = (w9 >>> 7 ^ w9 >>> 18 ^ w9 >>> 3 ^ w9 << 25 ^ w9 << 14) + (w6 >>> 17 ^ w6 >>> 19 ^ w6 >>> 10 ^ w6 << 15 ^ w6 << 13) + w8 + w1 | 0; | |
17873 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2730485921 | 0; | |
17874 | h = g; | |
17875 | g = f; | |
17876 | f = e; | |
17877 | e = d + t | 0; | |
17878 | d = c; | |
17879 | c = b; | |
17880 | b = a; | |
17881 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17882 | w9 = t = (w10 >>> 7 ^ w10 >>> 18 ^ w10 >>> 3 ^ w10 << 25 ^ w10 << 14) + (w7 >>> 17 ^ w7 >>> 19 ^ w7 >>> 10 ^ w7 << 15 ^ w7 << 13) + w9 + w2 | 0; | |
17883 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2820302411 | 0; | |
17884 | h = g; | |
17885 | g = f; | |
17886 | f = e; | |
17887 | e = d + t | 0; | |
17888 | d = c; | |
17889 | c = b; | |
17890 | b = a; | |
17891 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17892 | w10 = t = (w11 >>> 7 ^ w11 >>> 18 ^ w11 >>> 3 ^ w11 << 25 ^ w11 << 14) + (w8 >>> 17 ^ w8 >>> 19 ^ w8 >>> 10 ^ w8 << 15 ^ w8 << 13) + w10 + w3 | 0; | |
17893 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3259730800 | 0; | |
17894 | h = g; | |
17895 | g = f; | |
17896 | f = e; | |
17897 | e = d + t | 0; | |
17898 | d = c; | |
17899 | c = b; | |
17900 | b = a; | |
17901 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17902 | w11 = t = (w12 >>> 7 ^ w12 >>> 18 ^ w12 >>> 3 ^ w12 << 25 ^ w12 << 14) + (w9 >>> 17 ^ w9 >>> 19 ^ w9 >>> 10 ^ w9 << 15 ^ w9 << 13) + w11 + w4 | 0; | |
17903 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3345764771 | 0; | |
17904 | h = g; | |
17905 | g = f; | |
17906 | f = e; | |
17907 | e = d + t | 0; | |
17908 | d = c; | |
17909 | c = b; | |
17910 | b = a; | |
17911 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17912 | w12 = t = (w13 >>> 7 ^ w13 >>> 18 ^ w13 >>> 3 ^ w13 << 25 ^ w13 << 14) + (w10 >>> 17 ^ w10 >>> 19 ^ w10 >>> 10 ^ w10 << 15 ^ w10 << 13) + w12 + w5 | 0; | |
17913 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3516065817 | 0; | |
17914 | h = g; | |
17915 | g = f; | |
17916 | f = e; | |
17917 | e = d + t | 0; | |
17918 | d = c; | |
17919 | c = b; | |
17920 | b = a; | |
17921 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17922 | w13 = t = (w14 >>> 7 ^ w14 >>> 18 ^ w14 >>> 3 ^ w14 << 25 ^ w14 << 14) + (w11 >>> 17 ^ w11 >>> 19 ^ w11 >>> 10 ^ w11 << 15 ^ w11 << 13) + w13 + w6 | 0; | |
17923 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3600352804 | 0; | |
17924 | h = g; | |
17925 | g = f; | |
17926 | f = e; | |
17927 | e = d + t | 0; | |
17928 | d = c; | |
17929 | c = b; | |
17930 | b = a; | |
17931 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17932 | w14 = t = (w15 >>> 7 ^ w15 >>> 18 ^ w15 >>> 3 ^ w15 << 25 ^ w15 << 14) + (w12 >>> 17 ^ w12 >>> 19 ^ w12 >>> 10 ^ w12 << 15 ^ w12 << 13) + w14 + w7 | 0; | |
17933 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 4094571909 | 0; | |
17934 | h = g; | |
17935 | g = f; | |
17936 | f = e; | |
17937 | e = d + t | 0; | |
17938 | d = c; | |
17939 | c = b; | |
17940 | b = a; | |
17941 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17942 | w15 = t = (w0 >>> 7 ^ w0 >>> 18 ^ w0 >>> 3 ^ w0 << 25 ^ w0 << 14) + (w13 >>> 17 ^ w13 >>> 19 ^ w13 >>> 10 ^ w13 << 15 ^ w13 << 13) + w15 + w8 | 0; | |
17943 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 275423344 | 0; | |
17944 | h = g; | |
17945 | g = f; | |
17946 | f = e; | |
17947 | e = d + t | 0; | |
17948 | d = c; | |
17949 | c = b; | |
17950 | b = a; | |
17951 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17952 | w0 = t = (w1 >>> 7 ^ w1 >>> 18 ^ w1 >>> 3 ^ w1 << 25 ^ w1 << 14) + (w14 >>> 17 ^ w14 >>> 19 ^ w14 >>> 10 ^ w14 << 15 ^ w14 << 13) + w0 + w9 | 0; | |
17953 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 430227734 | 0; | |
17954 | h = g; | |
17955 | g = f; | |
17956 | f = e; | |
17957 | e = d + t | 0; | |
17958 | d = c; | |
17959 | c = b; | |
17960 | b = a; | |
17961 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17962 | w1 = t = (w2 >>> 7 ^ w2 >>> 18 ^ w2 >>> 3 ^ w2 << 25 ^ w2 << 14) + (w15 >>> 17 ^ w15 >>> 19 ^ w15 >>> 10 ^ w15 << 15 ^ w15 << 13) + w1 + w10 | 0; | |
17963 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 506948616 | 0; | |
17964 | h = g; | |
17965 | g = f; | |
17966 | f = e; | |
17967 | e = d + t | 0; | |
17968 | d = c; | |
17969 | c = b; | |
17970 | b = a; | |
17971 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17972 | w2 = t = (w3 >>> 7 ^ w3 >>> 18 ^ w3 >>> 3 ^ w3 << 25 ^ w3 << 14) + (w0 >>> 17 ^ w0 >>> 19 ^ w0 >>> 10 ^ w0 << 15 ^ w0 << 13) + w2 + w11 | 0; | |
17973 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 659060556 | 0; | |
17974 | h = g; | |
17975 | g = f; | |
17976 | f = e; | |
17977 | e = d + t | 0; | |
17978 | d = c; | |
17979 | c = b; | |
17980 | b = a; | |
17981 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17982 | w3 = t = (w4 >>> 7 ^ w4 >>> 18 ^ w4 >>> 3 ^ w4 << 25 ^ w4 << 14) + (w1 >>> 17 ^ w1 >>> 19 ^ w1 >>> 10 ^ w1 << 15 ^ w1 << 13) + w3 + w12 | 0; | |
17983 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 883997877 | 0; | |
17984 | h = g; | |
17985 | g = f; | |
17986 | f = e; | |
17987 | e = d + t | 0; | |
17988 | d = c; | |
17989 | c = b; | |
17990 | b = a; | |
17991 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17992 | w4 = t = (w5 >>> 7 ^ w5 >>> 18 ^ w5 >>> 3 ^ w5 << 25 ^ w5 << 14) + (w2 >>> 17 ^ w2 >>> 19 ^ w2 >>> 10 ^ w2 << 15 ^ w2 << 13) + w4 + w13 | 0; | |
17993 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 958139571 | 0; | |
17994 | h = g; | |
17995 | g = f; | |
17996 | f = e; | |
17997 | e = d + t | 0; | |
17998 | d = c; | |
17999 | c = b; | |
18000 | b = a; | |
18001 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
18002 | w5 = t = (w6 >>> 7 ^ w6 >>> 18 ^ w6 >>> 3 ^ w6 << 25 ^ w6 << 14) + (w3 >>> 17 ^ w3 >>> 19 ^ w3 >>> 10 ^ w3 << 15 ^ w3 << 13) + w5 + w14 | 0; | |
18003 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1322822218 | 0; | |
18004 | h = g; | |
18005 | g = f; | |
18006 | f = e; | |
18007 | e = d + t | 0; | |
18008 | d = c; | |
18009 | c = b; | |
18010 | b = a; | |
18011 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
18012 | w6 = t = (w7 >>> 7 ^ w7 >>> 18 ^ w7 >>> 3 ^ w7 << 25 ^ w7 << 14) + (w4 >>> 17 ^ w4 >>> 19 ^ w4 >>> 10 ^ w4 << 15 ^ w4 << 13) + w6 + w15 | 0; | |
18013 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1537002063 | 0; | |
18014 | h = g; | |
18015 | g = f; | |
18016 | f = e; | |
18017 | e = d + t | 0; | |
18018 | d = c; | |
18019 | c = b; | |
18020 | b = a; | |
18021 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
18022 | w7 = t = (w8 >>> 7 ^ w8 >>> 18 ^ w8 >>> 3 ^ w8 << 25 ^ w8 << 14) + (w5 >>> 17 ^ w5 >>> 19 ^ w5 >>> 10 ^ w5 << 15 ^ w5 << 13) + w7 + w0 | 0; | |
18023 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1747873779 | 0; | |
18024 | h = g; | |
18025 | g = f; | |
18026 | f = e; | |
18027 | e = d + t | 0; | |
18028 | d = c; | |
18029 | c = b; | |
18030 | b = a; | |
18031 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
18032 | w8 = t = (w9 >>> 7 ^ w9 >>> 18 ^ w9 >>> 3 ^ w9 << 25 ^ w9 << 14) + (w6 >>> 17 ^ w6 >>> 19 ^ w6 >>> 10 ^ w6 << 15 ^ w6 << 13) + w8 + w1 | 0; | |
18033 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1955562222 | 0; | |
18034 | h = g; | |
18035 | g = f; | |
18036 | f = e; | |
18037 | e = d + t | 0; | |
18038 | d = c; | |
18039 | c = b; | |
18040 | b = a; | |
18041 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
18042 | w9 = t = (w10 >>> 7 ^ w10 >>> 18 ^ w10 >>> 3 ^ w10 << 25 ^ w10 << 14) + (w7 >>> 17 ^ w7 >>> 19 ^ w7 >>> 10 ^ w7 << 15 ^ w7 << 13) + w9 + w2 | 0; | |
18043 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2024104815 | 0; | |
18044 | h = g; | |
18045 | g = f; | |
18046 | f = e; | |
18047 | e = d + t | 0; | |
18048 | d = c; | |
18049 | c = b; | |
18050 | b = a; | |
18051 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
18052 | w10 = t = (w11 >>> 7 ^ w11 >>> 18 ^ w11 >>> 3 ^ w11 << 25 ^ w11 << 14) + (w8 >>> 17 ^ w8 >>> 19 ^ w8 >>> 10 ^ w8 << 15 ^ w8 << 13) + w10 + w3 | 0; | |
18053 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2227730452 | 0; | |
18054 | h = g; | |
18055 | g = f; | |
18056 | f = e; | |
18057 | e = d + t | 0; | |
18058 | d = c; | |
18059 | c = b; | |
18060 | b = a; | |
18061 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
18062 | w11 = t = (w12 >>> 7 ^ w12 >>> 18 ^ w12 >>> 3 ^ w12 << 25 ^ w12 << 14) + (w9 >>> 17 ^ w9 >>> 19 ^ w9 >>> 10 ^ w9 << 15 ^ w9 << 13) + w11 + w4 | 0; | |
18063 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2361852424 | 0; | |
18064 | h = g; | |
18065 | g = f; | |
18066 | f = e; | |
18067 | e = d + t | 0; | |
18068 | d = c; | |
18069 | c = b; | |
18070 | b = a; | |
18071 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
18072 | w12 = t = (w13 >>> 7 ^ w13 >>> 18 ^ w13 >>> 3 ^ w13 << 25 ^ w13 << 14) + (w10 >>> 17 ^ w10 >>> 19 ^ w10 >>> 10 ^ w10 << 15 ^ w10 << 13) + w12 + w5 | 0; | |
18073 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2428436474 | 0; | |
18074 | h = g; | |
18075 | g = f; | |
18076 | f = e; | |
18077 | e = d + t | 0; | |
18078 | d = c; | |
18079 | c = b; | |
18080 | b = a; | |
18081 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
18082 | w13 = t = (w14 >>> 7 ^ w14 >>> 18 ^ w14 >>> 3 ^ w14 << 25 ^ w14 << 14) + (w11 >>> 17 ^ w11 >>> 19 ^ w11 >>> 10 ^ w11 << 15 ^ w11 << 13) + w13 + w6 | 0; | |
18083 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2756734187 | 0; | |
18084 | h = g; | |
18085 | g = f; | |
18086 | f = e; | |
18087 | e = d + t | 0; | |
18088 | d = c; | |
18089 | c = b; | |
18090 | b = a; | |
18091 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
18092 | w14 = t = (w15 >>> 7 ^ w15 >>> 18 ^ w15 >>> 3 ^ w15 << 25 ^ w15 << 14) + (w12 >>> 17 ^ w12 >>> 19 ^ w12 >>> 10 ^ w12 << 15 ^ w12 << 13) + w14 + w7 | 0; | |
18093 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3204031479 | 0; | |
18094 | h = g; | |
18095 | g = f; | |
18096 | f = e; | |
18097 | e = d + t | 0; | |
18098 | d = c; | |
18099 | c = b; | |
18100 | b = a; | |
18101 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
18102 | w15 = t = (w0 >>> 7 ^ w0 >>> 18 ^ w0 >>> 3 ^ w0 << 25 ^ w0 << 14) + (w13 >>> 17 ^ w13 >>> 19 ^ w13 >>> 10 ^ w13 << 15 ^ w13 << 13) + w15 + w8 | 0; | |
18103 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3329325298 | 0; | |
18104 | h = g; | |
18105 | g = f; | |
18106 | f = e; | |
18107 | e = d + t | 0; | |
18108 | d = c; | |
18109 | c = b; | |
18110 | b = a; | |
18111 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
18112 | H0 = H0 + a | 0; | |
18113 | H1 = H1 + b | 0; | |
18114 | H2 = H2 + c | 0; | |
18115 | H3 = H3 + d | 0; | |
18116 | H4 = H4 + e | 0; | |
18117 | H5 = H5 + f | 0; | |
18118 | H6 = H6 + g | 0; | |
18119 | H7 = H7 + h | 0; | |
18120 | } | |
18121 | function _core_heap(offset) { | |
18122 | offset = offset | 0; | |
18123 | _core(HEAP[offset | 0] << 24 | HEAP[offset | 1] << 16 | HEAP[offset | 2] << 8 | HEAP[offset | 3], HEAP[offset | 4] << 24 | HEAP[offset | 5] << 16 | HEAP[offset | 6] << 8 | HEAP[offset | 7], HEAP[offset | 8] << 24 | HEAP[offset | 9] << 16 | HEAP[offset | 10] << 8 | HEAP[offset | 11], HEAP[offset | 12] << 24 | HEAP[offset | 13] << 16 | HEAP[offset | 14] << 8 | HEAP[offset | 15], HEAP[offset | 16] << 24 | HEAP[offset | 17] << 16 | HEAP[offset | 18] << 8 | HEAP[offset | 19], HEAP[offset | 20] << 24 | HEAP[offset | 21] << 16 | HEAP[offset | 22] << 8 | HEAP[offset | 23], HEAP[offset | 24] << 24 | HEAP[offset | 25] << 16 | HEAP[offset | 26] << 8 | HEAP[offset | 27], HEAP[offset | 28] << 24 | HEAP[offset | 29] << 16 | HEAP[offset | 30] << 8 | HEAP[offset | 31], HEAP[offset | 32] << 24 | HEAP[offset | 33] << 16 | HEAP[offset | 34] << 8 | HEAP[offset | 35], HEAP[offset | 36] << 24 | HEAP[offset | 37] << 16 | HEAP[offset | 38] << 8 | HEAP[offset | 39], HEAP[offset | 40] << 24 | HEAP[offset | 41] << 16 | HEAP[offset | 42] << 8 | HEAP[offset | 43], HEAP[offset | 44] << 24 | HEAP[offset | 45] << 16 | HEAP[offset | 46] << 8 | HEAP[offset | 47], HEAP[offset | 48] << 24 | HEAP[offset | 49] << 16 | HEAP[offset | 50] << 8 | HEAP[offset | 51], HEAP[offset | 52] << 24 | HEAP[offset | 53] << 16 | HEAP[offset | 54] << 8 | HEAP[offset | 55], HEAP[offset | 56] << 24 | HEAP[offset | 57] << 16 | HEAP[offset | 58] << 8 | HEAP[offset | 59], HEAP[offset | 60] << 24 | HEAP[offset | 61] << 16 | HEAP[offset | 62] << 8 | HEAP[offset | 63]); | |
18124 | } | |
18125 | function _state_to_heap(output) { | |
18126 | output = output | 0; | |
18127 | HEAP[output | 0] = H0 >>> 24; | |
18128 | HEAP[output | 1] = H0 >>> 16 & 255; | |
18129 | HEAP[output | 2] = H0 >>> 8 & 255; | |
18130 | HEAP[output | 3] = H0 & 255; | |
18131 | HEAP[output | 4] = H1 >>> 24; | |
18132 | HEAP[output | 5] = H1 >>> 16 & 255; | |
18133 | HEAP[output | 6] = H1 >>> 8 & 255; | |
18134 | HEAP[output | 7] = H1 & 255; | |
18135 | HEAP[output | 8] = H2 >>> 24; | |
18136 | HEAP[output | 9] = H2 >>> 16 & 255; | |
18137 | HEAP[output | 10] = H2 >>> 8 & 255; | |
18138 | HEAP[output | 11] = H2 & 255; | |
18139 | HEAP[output | 12] = H3 >>> 24; | |
18140 | HEAP[output | 13] = H3 >>> 16 & 255; | |
18141 | HEAP[output | 14] = H3 >>> 8 & 255; | |
18142 | HEAP[output | 15] = H3 & 255; | |
18143 | HEAP[output | 16] = H4 >>> 24; | |
18144 | HEAP[output | 17] = H4 >>> 16 & 255; | |
18145 | HEAP[output | 18] = H4 >>> 8 & 255; | |
18146 | HEAP[output | 19] = H4 & 255; | |
18147 | HEAP[output | 20] = H5 >>> 24; | |
18148 | HEAP[output | 21] = H5 >>> 16 & 255; | |
18149 | HEAP[output | 22] = H5 >>> 8 & 255; | |
18150 | HEAP[output | 23] = H5 & 255; | |
18151 | HEAP[output | 24] = H6 >>> 24; | |
18152 | HEAP[output | 25] = H6 >>> 16 & 255; | |
18153 | HEAP[output | 26] = H6 >>> 8 & 255; | |
18154 | HEAP[output | 27] = H6 & 255; | |
18155 | HEAP[output | 28] = H7 >>> 24; | |
18156 | HEAP[output | 29] = H7 >>> 16 & 255; | |
18157 | HEAP[output | 30] = H7 >>> 8 & 255; | |
18158 | HEAP[output | 31] = H7 & 255; | |
18159 | } | |
18160 | function reset() { | |
18161 | H0 = 1779033703; | |
18162 | H1 = 3144134277; | |
18163 | H2 = 1013904242; | |
18164 | H3 = 2773480762; | |
18165 | H4 = 1359893119; | |
18166 | H5 = 2600822924; | |
18167 | H6 = 528734635; | |
18168 | H7 = 1541459225; | |
18169 | TOTAL = 0; | |
18170 | } | |
18171 | function init(h0, h1, h2, h3, h4, h5, h6, h7, total) { | |
18172 | h0 = h0 | 0; | |
18173 | h1 = h1 | 0; | |
18174 | h2 = h2 | 0; | |
18175 | h3 = h3 | 0; | |
18176 | h4 = h4 | 0; | |
18177 | h5 = h5 | 0; | |
18178 | h6 = h6 | 0; | |
18179 | h7 = h7 | 0; | |
18180 | total = total | 0; | |
18181 | H0 = h0; | |
18182 | H1 = h1; | |
18183 | H2 = h2; | |
18184 | H3 = h3; | |
18185 | H4 = h4; | |
18186 | H5 = h5; | |
18187 | H6 = h6; | |
18188 | H7 = h7; | |
18189 | TOTAL = total; | |
18190 | } | |
18191 | function process(offset, length) { | |
18192 | offset = offset | 0; | |
18193 | length = length | 0; | |
18194 | var hashed = 0; | |
18195 | if (offset & 63) return -1; | |
18196 | while ((length | 0) >= 64) { | |
18197 | _core_heap(offset); | |
18198 | offset = offset + 64 | 0; | |
18199 | length = length - 64 | 0; | |
18200 | hashed = hashed + 64 | 0; | |
18201 | } | |
18202 | TOTAL = TOTAL + hashed | 0; | |
18203 | return hashed | 0; | |
18204 | } | |
18205 | function finish(offset, length, output) { | |
18206 | offset = offset | 0; | |
18207 | length = length | 0; | |
18208 | output = output | 0; | |
18209 | var hashed = 0, i = 0; | |
18210 | if (offset & 63) return -1; | |
18211 | if (~output) if (output & 31) return -1; | |
18212 | if ((length | 0) >= 64) { | |
18213 | hashed = process(offset, length) | 0; | |
18214 | if ((hashed | 0) == -1) return -1; | |
18215 | offset = offset + hashed | 0; | |
18216 | length = length - hashed | 0; | |
18217 | } | |
18218 | hashed = hashed + length | 0; | |
18219 | TOTAL = TOTAL + length | 0; | |
18220 | HEAP[offset | length] = 128; | |
18221 | if ((length | 0) >= 56) { | |
18222 | for (i = length + 1 | 0; (i | 0) < 64; i = i + 1 | 0) HEAP[offset | i] = 0; | |
18223 | _core_heap(offset); | |
18224 | length = 0; | |
18225 | HEAP[offset | 0] = 0; | |
18226 | } | |
18227 | for (i = length + 1 | 0; (i | 0) < 59; i = i + 1 | 0) HEAP[offset | i] = 0; | |
18228 | HEAP[offset | 59] = TOTAL >>> 29; | |
18229 | HEAP[offset | 60] = TOTAL >>> 21 & 255; | |
18230 | HEAP[offset | 61] = TOTAL >>> 13 & 255; | |
18231 | HEAP[offset | 62] = TOTAL >>> 5 & 255; | |
18232 | HEAP[offset | 63] = TOTAL << 3 & 255; | |
18233 | _core_heap(offset); | |
18234 | if (~output) _state_to_heap(output); | |
18235 | return hashed | 0; | |
18236 | } | |
18237 | function hmac_reset() { | |
18238 | H0 = I0; | |
18239 | H1 = I1; | |
18240 | H2 = I2; | |
18241 | H3 = I3; | |
18242 | H4 = I4; | |
18243 | H5 = I5; | |
18244 | H6 = I6; | |
18245 | H7 = I7; | |
18246 | TOTAL = 64; | |
18247 | } | |
18248 | function _hmac_opad() { | |
18249 | H0 = O0; | |
18250 | H1 = O1; | |
18251 | H2 = O2; | |
18252 | H3 = O3; | |
18253 | H4 = O4; | |
18254 | H5 = O5; | |
18255 | H6 = O6; | |
18256 | H7 = O7; | |
18257 | TOTAL = 64; | |
18258 | } | |
18259 | function hmac_init(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15) { | |
18260 | p0 = p0 | 0; | |
18261 | p1 = p1 | 0; | |
18262 | p2 = p2 | 0; | |
18263 | p3 = p3 | 0; | |
18264 | p4 = p4 | 0; | |
18265 | p5 = p5 | 0; | |
18266 | p6 = p6 | 0; | |
18267 | p7 = p7 | 0; | |
18268 | p8 = p8 | 0; | |
18269 | p9 = p9 | 0; | |
18270 | p10 = p10 | 0; | |
18271 | p11 = p11 | 0; | |
18272 | p12 = p12 | 0; | |
18273 | p13 = p13 | 0; | |
18274 | p14 = p14 | 0; | |
18275 | p15 = p15 | 0; | |
18276 | reset(); | |
18277 | _core(p0 ^ 1549556828, p1 ^ 1549556828, p2 ^ 1549556828, p3 ^ 1549556828, p4 ^ 1549556828, p5 ^ 1549556828, p6 ^ 1549556828, p7 ^ 1549556828, p8 ^ 1549556828, p9 ^ 1549556828, p10 ^ 1549556828, p11 ^ 1549556828, p12 ^ 1549556828, p13 ^ 1549556828, p14 ^ 1549556828, p15 ^ 1549556828); | |
18278 | O0 = H0; | |
18279 | O1 = H1; | |
18280 | O2 = H2; | |
18281 | O3 = H3; | |
18282 | O4 = H4; | |
18283 | O5 = H5; | |
18284 | O6 = H6; | |
18285 | O7 = H7; | |
18286 | reset(); | |
18287 | _core(p0 ^ 909522486, p1 ^ 909522486, p2 ^ 909522486, p3 ^ 909522486, p4 ^ 909522486, p5 ^ 909522486, p6 ^ 909522486, p7 ^ 909522486, p8 ^ 909522486, p9 ^ 909522486, p10 ^ 909522486, p11 ^ 909522486, p12 ^ 909522486, p13 ^ 909522486, p14 ^ 909522486, p15 ^ 909522486); | |
18288 | I0 = H0; | |
18289 | I1 = H1; | |
18290 | I2 = H2; | |
18291 | I3 = H3; | |
18292 | I4 = H4; | |
18293 | I5 = H5; | |
18294 | I6 = H6; | |
18295 | I7 = H7; | |
18296 | TOTAL = 64; | |
18297 | } | |
18298 | function hmac_finish(offset, length, output) { | |
18299 | offset = offset | 0; | |
18300 | length = length | 0; | |
18301 | output = output | 0; | |
18302 | var t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, hashed = 0; | |
18303 | if (offset & 63) return -1; | |
18304 | if (~output) if (output & 31) return -1; | |
18305 | hashed = finish(offset, length, -1) | 0; | |
18306 | t0 = H0, t1 = H1, t2 = H2, t3 = H3, t4 = H4, t5 = H5, t6 = H6, t7 = H7; | |
18307 | _hmac_opad(); | |
18308 | _core(t0, t1, t2, t3, t4, t5, t6, t7, 2147483648, 0, 0, 0, 0, 0, 0, 768); | |
18309 | if (~output) _state_to_heap(output); | |
18310 | return hashed | 0; | |
18311 | } | |
18312 | function pbkdf2_generate_block(offset, length, block, count, output) { | |
18313 | offset = offset | 0; | |
18314 | length = length | 0; | |
18315 | block = block | 0; | |
18316 | count = count | 0; | |
18317 | output = output | 0; | |
18318 | var h0 = 0, h1 = 0, h2 = 0, h3 = 0, h4 = 0, h5 = 0, h6 = 0, h7 = 0, t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0; | |
18319 | if (offset & 63) return -1; | |
18320 | if (~output) if (output & 31) return -1; | |
18321 | HEAP[offset + length | 0] = block >>> 24; | |
18322 | HEAP[offset + length + 1 | 0] = block >>> 16 & 255; | |
18323 | HEAP[offset + length + 2 | 0] = block >>> 8 & 255; | |
18324 | HEAP[offset + length + 3 | 0] = block & 255; | |
18325 | // Closure compiler warning - The result of the 'bitor' operator is not being used | |
18326 | //hmac_finish(offset, length + 4 | 0, -1) | 0; | |
18327 | hmac_finish(offset, length + 4 | 0, -1); | |
18328 | h0 = t0 = H0, h1 = t1 = H1, h2 = t2 = H2, h3 = t3 = H3, h4 = t4 = H4, h5 = t5 = H5, | |
18329 | h6 = t6 = H6, h7 = t7 = H7; | |
18330 | count = count - 1 | 0; | |
18331 | while ((count | 0) > 0) { | |
18332 | hmac_reset(); | |
18333 | _core(t0, t1, t2, t3, t4, t5, t6, t7, 2147483648, 0, 0, 0, 0, 0, 0, 768); | |
18334 | t0 = H0, t1 = H1, t2 = H2, t3 = H3, t4 = H4, t5 = H5, t6 = H6, t7 = H7; | |
18335 | _hmac_opad(); | |
18336 | _core(t0, t1, t2, t3, t4, t5, t6, t7, 2147483648, 0, 0, 0, 0, 0, 0, 768); | |
18337 | t0 = H0, t1 = H1, t2 = H2, t3 = H3, t4 = H4, t5 = H5, t6 = H6, t7 = H7; | |
18338 | h0 = h0 ^ H0; | |
18339 | h1 = h1 ^ H1; | |
18340 | h2 = h2 ^ H2; | |
18341 | h3 = h3 ^ H3; | |
18342 | h4 = h4 ^ H4; | |
18343 | h5 = h5 ^ H5; | |
18344 | h6 = h6 ^ H6; | |
18345 | h7 = h7 ^ H7; | |
18346 | count = count - 1 | 0; | |
18347 | } | |
18348 | H0 = h0; | |
18349 | H1 = h1; | |
18350 | H2 = h2; | |
18351 | H3 = h3; | |
18352 | H4 = h4; | |
18353 | H5 = h5; | |
18354 | H6 = h6; | |
18355 | H7 = h7; | |
18356 | if (~output) _state_to_heap(output); | |
18357 | return 0; | |
18358 | } | |
18359 | return { | |
18360 | reset: reset, | |
18361 | init: init, | |
18362 | process: process, | |
18363 | finish: finish, | |
18364 | hmac_reset: hmac_reset, | |
18365 | hmac_init: hmac_init, | |
18366 | hmac_finish: hmac_finish, | |
18367 | pbkdf2_generate_block: pbkdf2_generate_block | |
18368 | }; | |
18369 | } | |
18370 | var _sha256_block_size = 64, _sha256_hash_size = 32; | |
18371 | function sha256_constructor(options) { | |
18372 | options = options || {}; | |
18373 | options.heapSize = options.heapSize || 4096; | |
18374 | if (options.heapSize <= 0 || options.heapSize % 4096) throw new IllegalArgumentError("heapSize must be a positive number and multiple of 4096"); | |
18375 | this.heap = options.heap || new Uint8Array(options.heapSize); | |
18376 | this.asm = options.asm || sha256_asm(global, null, this.heap.buffer); | |
18377 | this.BLOCK_SIZE = _sha256_block_size; | |
18378 | this.HASH_SIZE = _sha256_hash_size; | |
18379 | this.reset(); | |
18380 | } | |
18381 | function sha256_reset() { | |
18382 | this.result = null; | |
18383 | this.pos = 0; | |
18384 | this.len = 0; | |
18385 | this.asm.reset(); | |
18386 | return this; | |
18387 | } | |
18388 | function sha256_process(data) { | |
18389 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
18390 | var dpos = 0, dlen = 0, clen = 0; | |
18391 | if (is_buffer(data) || is_bytes(data)) { | |
18392 | dpos = data.byteOffset || 0; | |
18393 | dlen = data.byteLength; | |
18394 | } else if (is_string(data)) { | |
18395 | dlen = data.length; | |
18396 | } else { | |
18397 | throw new TypeError("data isn't of expected type"); | |
18398 | } | |
18399 | while (dlen > 0) { | |
18400 | clen = this.heap.byteLength - this.pos - this.len; | |
18401 | clen = clen < dlen ? clen : dlen; | |
18402 | if (is_buffer(data) || is_bytes(data)) { | |
18403 | this.heap.set(new Uint8Array(data.buffer || data, dpos, clen), this.pos + this.len); | |
18404 | } else { | |
18405 | for (var i = 0; i < clen; i++) this.heap[this.pos + this.len + i] = data.charCodeAt(dpos + i); | |
18406 | } | |
18407 | this.len += clen; | |
18408 | dpos += clen; | |
18409 | dlen -= clen; | |
18410 | clen = this.asm.process(this.pos, this.len); | |
18411 | if (clen < this.len) { | |
18412 | this.pos += clen; | |
18413 | this.len -= clen; | |
18414 | } else { | |
18415 | this.pos = 0; | |
18416 | this.len = 0; | |
18417 | } | |
18418 | } | |
18419 | return this; | |
18420 | } | |
18421 | function sha256_finish() { | |
18422 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
18423 | this.asm.finish(this.pos, this.len, 0); | |
18424 | this.result = new Uint8Array(_sha256_hash_size); | |
18425 | this.result.set(this.heap.subarray(0, _sha256_hash_size)); | |
18426 | this.pos = 0; | |
18427 | this.len = 0; | |
18428 | return this; | |
18429 | } | |
18430 | sha256_constructor.BLOCK_SIZE = _sha256_block_size; | |
18431 | sha256_constructor.HASH_SIZE = _sha256_hash_size; | |
18432 | var sha256_prototype = sha256_constructor.prototype; | |
18433 | sha256_prototype.reset = sha256_reset; | |
18434 | sha256_prototype.process = sha256_process; | |
18435 | sha256_prototype.finish = sha256_finish; | |
18436 | function sha512_asm(stdlib, foreign, buffer) { | |
18437 | // Closure Compiler warning - commented out | |
18438 | //"use asm"; | |
18439 | var H0h = 0, H0l = 0, H1h = 0, H1l = 0, H2h = 0, H2l = 0, H3h = 0, H3l = 0, H4h = 0, H4l = 0, H5h = 0, H5l = 0, H6h = 0, H6l = 0, H7h = 0, H7l = 0, TOTAL = 0; | |
18440 | var I0h = 0, I0l = 0, I1h = 0, I1l = 0, I2h = 0, I2l = 0, I3h = 0, I3l = 0, I4h = 0, I4l = 0, I5h = 0, I5l = 0, I6h = 0, I6l = 0, I7h = 0, I7l = 0, O0h = 0, O0l = 0, O1h = 0, O1l = 0, O2h = 0, O2l = 0, O3h = 0, O3l = 0, O4h = 0, O4l = 0, O5h = 0, O5l = 0, O6h = 0, O6l = 0, O7h = 0, O7l = 0; | |
18441 | var HEAP = new stdlib.Uint8Array(buffer); | |
18442 | function _core(w0h, w0l, w1h, w1l, w2h, w2l, w3h, w3l, w4h, w4l, w5h, w5l, w6h, w6l, w7h, w7l, w8h, w8l, w9h, w9l, w10h, w10l, w11h, w11l, w12h, w12l, w13h, w13l, w14h, w14l, w15h, w15l) { | |
18443 | w0h = w0h | 0; | |
18444 | w0l = w0l | 0; | |
18445 | w1h = w1h | 0; | |
18446 | w1l = w1l | 0; | |
18447 | w2h = w2h | 0; | |
18448 | w2l = w2l | 0; | |
18449 | w3h = w3h | 0; | |
18450 | w3l = w3l | 0; | |
18451 | w4h = w4h | 0; | |
18452 | w4l = w4l | 0; | |
18453 | w5h = w5h | 0; | |
18454 | w5l = w5l | 0; | |
18455 | w6h = w6h | 0; | |
18456 | w6l = w6l | 0; | |
18457 | w7h = w7h | 0; | |
18458 | w7l = w7l | 0; | |
18459 | w8h = w8h | 0; | |
18460 | w8l = w8l | 0; | |
18461 | w9h = w9h | 0; | |
18462 | w9l = w9l | 0; | |
18463 | w10h = w10h | 0; | |
18464 | w10l = w10l | 0; | |
18465 | w11h = w11h | 0; | |
18466 | w11l = w11l | 0; | |
18467 | w12h = w12h | 0; | |
18468 | w12l = w12l | 0; | |
18469 | w13h = w13h | 0; | |
18470 | w13l = w13l | 0; | |
18471 | w14h = w14h | 0; | |
18472 | w14l = w14l | 0; | |
18473 | w15h = w15h | 0; | |
18474 | w15l = w15l | 0; | |
18475 | var ah = 0, al = 0, bh = 0, bl = 0, ch = 0, cl = 0, dh = 0, dl = 0, eh = 0, el = 0, fh = 0, fl = 0, gh = 0, gl = 0, hh = 0, hl = 0, th = 0, tl = 0, xl = 0; | |
18476 | ah = H0h; | |
18477 | al = H0l; | |
18478 | bh = H1h; | |
18479 | bl = H1l; | |
18480 | ch = H2h; | |
18481 | cl = H2l; | |
18482 | dh = H3h; | |
18483 | dl = H3l; | |
18484 | eh = H4h; | |
18485 | el = H4l; | |
18486 | fh = H5h; | |
18487 | fl = H5l; | |
18488 | gh = H6h; | |
18489 | gl = H6l; | |
18490 | hh = H7h; | |
18491 | hl = H7l; | |
18492 | tl = 3609767458 + w0l | 0; | |
18493 | th = 1116352408 + w0h + (tl >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
18494 | tl = tl + hl | 0; | |
18495 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18496 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18497 | tl = tl + xl | 0; | |
18498 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18499 | xl = gl ^ el & (fl ^ gl) | 0; | |
18500 | tl = tl + xl | 0; | |
18501 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18502 | hl = gl; | |
18503 | hh = gh; | |
18504 | gl = fl; | |
18505 | gh = fh; | |
18506 | fl = el; | |
18507 | fh = eh; | |
18508 | el = dl + tl | 0; | |
18509 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18510 | dl = cl; | |
18511 | dh = ch; | |
18512 | cl = bl; | |
18513 | ch = bh; | |
18514 | bl = al; | |
18515 | bh = ah; | |
18516 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18517 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18518 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18519 | al = al + xl | 0; | |
18520 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18521 | tl = 602891725 + w1l | 0; | |
18522 | th = 1899447441 + w1h + (tl >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
18523 | tl = tl + hl | 0; | |
18524 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18525 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18526 | tl = tl + xl | 0; | |
18527 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18528 | xl = gl ^ el & (fl ^ gl) | 0; | |
18529 | tl = tl + xl | 0; | |
18530 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18531 | hl = gl; | |
18532 | hh = gh; | |
18533 | gl = fl; | |
18534 | gh = fh; | |
18535 | fl = el; | |
18536 | fh = eh; | |
18537 | el = dl + tl | 0; | |
18538 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18539 | dl = cl; | |
18540 | dh = ch; | |
18541 | cl = bl; | |
18542 | ch = bh; | |
18543 | bl = al; | |
18544 | bh = ah; | |
18545 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18546 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18547 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18548 | al = al + xl | 0; | |
18549 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18550 | tl = 3964484399 + w2l | 0; | |
18551 | th = 3049323471 + w2h + (tl >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
18552 | tl = tl + hl | 0; | |
18553 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18554 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18555 | tl = tl + xl | 0; | |
18556 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18557 | xl = gl ^ el & (fl ^ gl) | 0; | |
18558 | tl = tl + xl | 0; | |
18559 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18560 | hl = gl; | |
18561 | hh = gh; | |
18562 | gl = fl; | |
18563 | gh = fh; | |
18564 | fl = el; | |
18565 | fh = eh; | |
18566 | el = dl + tl | 0; | |
18567 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18568 | dl = cl; | |
18569 | dh = ch; | |
18570 | cl = bl; | |
18571 | ch = bh; | |
18572 | bl = al; | |
18573 | bh = ah; | |
18574 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18575 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18576 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18577 | al = al + xl | 0; | |
18578 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18579 | tl = 2173295548 + w3l | 0; | |
18580 | th = 3921009573 + w3h + (tl >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
18581 | tl = tl + hl | 0; | |
18582 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18583 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18584 | tl = tl + xl | 0; | |
18585 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18586 | xl = gl ^ el & (fl ^ gl) | 0; | |
18587 | tl = tl + xl | 0; | |
18588 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18589 | hl = gl; | |
18590 | hh = gh; | |
18591 | gl = fl; | |
18592 | gh = fh; | |
18593 | fl = el; | |
18594 | fh = eh; | |
18595 | el = dl + tl | 0; | |
18596 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18597 | dl = cl; | |
18598 | dh = ch; | |
18599 | cl = bl; | |
18600 | ch = bh; | |
18601 | bl = al; | |
18602 | bh = ah; | |
18603 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18604 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18605 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18606 | al = al + xl | 0; | |
18607 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18608 | tl = 4081628472 + w4l | 0; | |
18609 | th = 961987163 + w4h + (tl >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
18610 | tl = tl + hl | 0; | |
18611 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18612 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18613 | tl = tl + xl | 0; | |
18614 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18615 | xl = gl ^ el & (fl ^ gl) | 0; | |
18616 | tl = tl + xl | 0; | |
18617 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18618 | hl = gl; | |
18619 | hh = gh; | |
18620 | gl = fl; | |
18621 | gh = fh; | |
18622 | fl = el; | |
18623 | fh = eh; | |
18624 | el = dl + tl | 0; | |
18625 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18626 | dl = cl; | |
18627 | dh = ch; | |
18628 | cl = bl; | |
18629 | ch = bh; | |
18630 | bl = al; | |
18631 | bh = ah; | |
18632 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18633 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18634 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18635 | al = al + xl | 0; | |
18636 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18637 | tl = 3053834265 + w5l | 0; | |
18638 | th = 1508970993 + w5h + (tl >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
18639 | tl = tl + hl | 0; | |
18640 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18641 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18642 | tl = tl + xl | 0; | |
18643 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18644 | xl = gl ^ el & (fl ^ gl) | 0; | |
18645 | tl = tl + xl | 0; | |
18646 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18647 | hl = gl; | |
18648 | hh = gh; | |
18649 | gl = fl; | |
18650 | gh = fh; | |
18651 | fl = el; | |
18652 | fh = eh; | |
18653 | el = dl + tl | 0; | |
18654 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18655 | dl = cl; | |
18656 | dh = ch; | |
18657 | cl = bl; | |
18658 | ch = bh; | |
18659 | bl = al; | |
18660 | bh = ah; | |
18661 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18662 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18663 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18664 | al = al + xl | 0; | |
18665 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18666 | tl = 2937671579 + w6l | 0; | |
18667 | th = 2453635748 + w6h + (tl >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
18668 | tl = tl + hl | 0; | |
18669 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18670 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18671 | tl = tl + xl | 0; | |
18672 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18673 | xl = gl ^ el & (fl ^ gl) | 0; | |
18674 | tl = tl + xl | 0; | |
18675 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18676 | hl = gl; | |
18677 | hh = gh; | |
18678 | gl = fl; | |
18679 | gh = fh; | |
18680 | fl = el; | |
18681 | fh = eh; | |
18682 | el = dl + tl | 0; | |
18683 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18684 | dl = cl; | |
18685 | dh = ch; | |
18686 | cl = bl; | |
18687 | ch = bh; | |
18688 | bl = al; | |
18689 | bh = ah; | |
18690 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18691 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18692 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18693 | al = al + xl | 0; | |
18694 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18695 | tl = 3664609560 + w7l | 0; | |
18696 | th = 2870763221 + w7h + (tl >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
18697 | tl = tl + hl | 0; | |
18698 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18699 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18700 | tl = tl + xl | 0; | |
18701 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18702 | xl = gl ^ el & (fl ^ gl) | 0; | |
18703 | tl = tl + xl | 0; | |
18704 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18705 | hl = gl; | |
18706 | hh = gh; | |
18707 | gl = fl; | |
18708 | gh = fh; | |
18709 | fl = el; | |
18710 | fh = eh; | |
18711 | el = dl + tl | 0; | |
18712 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18713 | dl = cl; | |
18714 | dh = ch; | |
18715 | cl = bl; | |
18716 | ch = bh; | |
18717 | bl = al; | |
18718 | bh = ah; | |
18719 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18720 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18721 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18722 | al = al + xl | 0; | |
18723 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18724 | tl = 2734883394 + w8l | 0; | |
18725 | th = 3624381080 + w8h + (tl >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
18726 | tl = tl + hl | 0; | |
18727 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18728 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18729 | tl = tl + xl | 0; | |
18730 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18731 | xl = gl ^ el & (fl ^ gl) | 0; | |
18732 | tl = tl + xl | 0; | |
18733 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18734 | hl = gl; | |
18735 | hh = gh; | |
18736 | gl = fl; | |
18737 | gh = fh; | |
18738 | fl = el; | |
18739 | fh = eh; | |
18740 | el = dl + tl | 0; | |
18741 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18742 | dl = cl; | |
18743 | dh = ch; | |
18744 | cl = bl; | |
18745 | ch = bh; | |
18746 | bl = al; | |
18747 | bh = ah; | |
18748 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18749 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18750 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18751 | al = al + xl | 0; | |
18752 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18753 | tl = 1164996542 + w9l | 0; | |
18754 | th = 310598401 + w9h + (tl >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
18755 | tl = tl + hl | 0; | |
18756 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18757 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18758 | tl = tl + xl | 0; | |
18759 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18760 | xl = gl ^ el & (fl ^ gl) | 0; | |
18761 | tl = tl + xl | 0; | |
18762 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18763 | hl = gl; | |
18764 | hh = gh; | |
18765 | gl = fl; | |
18766 | gh = fh; | |
18767 | fl = el; | |
18768 | fh = eh; | |
18769 | el = dl + tl | 0; | |
18770 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18771 | dl = cl; | |
18772 | dh = ch; | |
18773 | cl = bl; | |
18774 | ch = bh; | |
18775 | bl = al; | |
18776 | bh = ah; | |
18777 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18778 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18779 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18780 | al = al + xl | 0; | |
18781 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18782 | tl = 1323610764 + w10l | 0; | |
18783 | th = 607225278 + w10h + (tl >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
18784 | tl = tl + hl | 0; | |
18785 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18786 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18787 | tl = tl + xl | 0; | |
18788 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18789 | xl = gl ^ el & (fl ^ gl) | 0; | |
18790 | tl = tl + xl | 0; | |
18791 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18792 | hl = gl; | |
18793 | hh = gh; | |
18794 | gl = fl; | |
18795 | gh = fh; | |
18796 | fl = el; | |
18797 | fh = eh; | |
18798 | el = dl + tl | 0; | |
18799 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18800 | dl = cl; | |
18801 | dh = ch; | |
18802 | cl = bl; | |
18803 | ch = bh; | |
18804 | bl = al; | |
18805 | bh = ah; | |
18806 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18807 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18808 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18809 | al = al + xl | 0; | |
18810 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18811 | tl = 3590304994 + w11l | 0; | |
18812 | th = 1426881987 + w11h + (tl >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
18813 | tl = tl + hl | 0; | |
18814 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18815 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18816 | tl = tl + xl | 0; | |
18817 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18818 | xl = gl ^ el & (fl ^ gl) | 0; | |
18819 | tl = tl + xl | 0; | |
18820 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18821 | hl = gl; | |
18822 | hh = gh; | |
18823 | gl = fl; | |
18824 | gh = fh; | |
18825 | fl = el; | |
18826 | fh = eh; | |
18827 | el = dl + tl | 0; | |
18828 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18829 | dl = cl; | |
18830 | dh = ch; | |
18831 | cl = bl; | |
18832 | ch = bh; | |
18833 | bl = al; | |
18834 | bh = ah; | |
18835 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18836 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18837 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18838 | al = al + xl | 0; | |
18839 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18840 | tl = 4068182383 + w12l | 0; | |
18841 | th = 1925078388 + w12h + (tl >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
18842 | tl = tl + hl | 0; | |
18843 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18844 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18845 | tl = tl + xl | 0; | |
18846 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18847 | xl = gl ^ el & (fl ^ gl) | 0; | |
18848 | tl = tl + xl | 0; | |
18849 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18850 | hl = gl; | |
18851 | hh = gh; | |
18852 | gl = fl; | |
18853 | gh = fh; | |
18854 | fl = el; | |
18855 | fh = eh; | |
18856 | el = dl + tl | 0; | |
18857 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18858 | dl = cl; | |
18859 | dh = ch; | |
18860 | cl = bl; | |
18861 | ch = bh; | |
18862 | bl = al; | |
18863 | bh = ah; | |
18864 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18865 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18866 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18867 | al = al + xl | 0; | |
18868 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18869 | tl = 991336113 + w13l | 0; | |
18870 | th = 2162078206 + w13h + (tl >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
18871 | tl = tl + hl | 0; | |
18872 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18873 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18874 | tl = tl + xl | 0; | |
18875 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18876 | xl = gl ^ el & (fl ^ gl) | 0; | |
18877 | tl = tl + xl | 0; | |
18878 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18879 | hl = gl; | |
18880 | hh = gh; | |
18881 | gl = fl; | |
18882 | gh = fh; | |
18883 | fl = el; | |
18884 | fh = eh; | |
18885 | el = dl + tl | 0; | |
18886 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18887 | dl = cl; | |
18888 | dh = ch; | |
18889 | cl = bl; | |
18890 | ch = bh; | |
18891 | bl = al; | |
18892 | bh = ah; | |
18893 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18894 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18895 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18896 | al = al + xl | 0; | |
18897 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18898 | tl = 633803317 + w14l | 0; | |
18899 | th = 2614888103 + w14h + (tl >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
18900 | tl = tl + hl | 0; | |
18901 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18902 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18903 | tl = tl + xl | 0; | |
18904 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18905 | xl = gl ^ el & (fl ^ gl) | 0; | |
18906 | tl = tl + xl | 0; | |
18907 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18908 | hl = gl; | |
18909 | hh = gh; | |
18910 | gl = fl; | |
18911 | gh = fh; | |
18912 | fl = el; | |
18913 | fh = eh; | |
18914 | el = dl + tl | 0; | |
18915 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18916 | dl = cl; | |
18917 | dh = ch; | |
18918 | cl = bl; | |
18919 | ch = bh; | |
18920 | bl = al; | |
18921 | bh = ah; | |
18922 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18923 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18924 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18925 | al = al + xl | 0; | |
18926 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18927 | tl = 3479774868 + w15l | 0; | |
18928 | th = 3248222580 + w15h + (tl >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
18929 | tl = tl + hl | 0; | |
18930 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18931 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18932 | tl = tl + xl | 0; | |
18933 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18934 | xl = gl ^ el & (fl ^ gl) | 0; | |
18935 | tl = tl + xl | 0; | |
18936 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18937 | hl = gl; | |
18938 | hh = gh; | |
18939 | gl = fl; | |
18940 | gh = fh; | |
18941 | fl = el; | |
18942 | fh = eh; | |
18943 | el = dl + tl | 0; | |
18944 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18945 | dl = cl; | |
18946 | dh = ch; | |
18947 | cl = bl; | |
18948 | ch = bh; | |
18949 | bl = al; | |
18950 | bh = ah; | |
18951 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18952 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18953 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18954 | al = al + xl | 0; | |
18955 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18956 | w0l = w0l + w9l | 0; | |
18957 | w0h = w0h + w9h + (w0l >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
18958 | xl = (w1l >>> 1 | w1h << 31) ^ (w1l >>> 8 | w1h << 24) ^ (w1l >>> 7 | w1h << 25) | 0; | |
18959 | w0l = w0l + xl | 0; | |
18960 | w0h = w0h + ((w1h >>> 1 | w1l << 31) ^ (w1h >>> 8 | w1l << 24) ^ w1h >>> 7) + (w0l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18961 | xl = (w14l >>> 19 | w14h << 13) ^ (w14l << 3 | w14h >>> 29) ^ (w14l >>> 6 | w14h << 26) | 0; | |
18962 | w0l = w0l + xl | 0; | |
18963 | w0h = w0h + ((w14h >>> 19 | w14l << 13) ^ (w14h << 3 | w14l >>> 29) ^ w14h >>> 6) + (w0l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18964 | tl = 2666613458 + w0l | 0; | |
18965 | th = 3835390401 + w0h + (tl >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
18966 | tl = tl + hl | 0; | |
18967 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18968 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18969 | tl = tl + xl | 0; | |
18970 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18971 | xl = gl ^ el & (fl ^ gl) | 0; | |
18972 | tl = tl + xl | 0; | |
18973 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18974 | hl = gl; | |
18975 | hh = gh; | |
18976 | gl = fl; | |
18977 | gh = fh; | |
18978 | fl = el; | |
18979 | fh = eh; | |
18980 | el = dl + tl | 0; | |
18981 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18982 | dl = cl; | |
18983 | dh = ch; | |
18984 | cl = bl; | |
18985 | ch = bh; | |
18986 | bl = al; | |
18987 | bh = ah; | |
18988 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18989 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18990 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18991 | al = al + xl | 0; | |
18992 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18993 | w1l = w1l + w10l | 0; | |
18994 | w1h = w1h + w10h + (w1l >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
18995 | xl = (w2l >>> 1 | w2h << 31) ^ (w2l >>> 8 | w2h << 24) ^ (w2l >>> 7 | w2h << 25) | 0; | |
18996 | w1l = w1l + xl | 0; | |
18997 | w1h = w1h + ((w2h >>> 1 | w2l << 31) ^ (w2h >>> 8 | w2l << 24) ^ w2h >>> 7) + (w1l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18998 | xl = (w15l >>> 19 | w15h << 13) ^ (w15l << 3 | w15h >>> 29) ^ (w15l >>> 6 | w15h << 26) | 0; | |
18999 | w1l = w1l + xl | 0; | |
19000 | w1h = w1h + ((w15h >>> 19 | w15l << 13) ^ (w15h << 3 | w15l >>> 29) ^ w15h >>> 6) + (w1l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19001 | tl = 944711139 + w1l | 0; | |
19002 | th = 4022224774 + w1h + (tl >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
19003 | tl = tl + hl | 0; | |
19004 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19005 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19006 | tl = tl + xl | 0; | |
19007 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19008 | xl = gl ^ el & (fl ^ gl) | 0; | |
19009 | tl = tl + xl | 0; | |
19010 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19011 | hl = gl; | |
19012 | hh = gh; | |
19013 | gl = fl; | |
19014 | gh = fh; | |
19015 | fl = el; | |
19016 | fh = eh; | |
19017 | el = dl + tl | 0; | |
19018 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19019 | dl = cl; | |
19020 | dh = ch; | |
19021 | cl = bl; | |
19022 | ch = bh; | |
19023 | bl = al; | |
19024 | bh = ah; | |
19025 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19026 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19027 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19028 | al = al + xl | 0; | |
19029 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19030 | w2l = w2l + w11l | 0; | |
19031 | w2h = w2h + w11h + (w2l >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
19032 | xl = (w3l >>> 1 | w3h << 31) ^ (w3l >>> 8 | w3h << 24) ^ (w3l >>> 7 | w3h << 25) | 0; | |
19033 | w2l = w2l + xl | 0; | |
19034 | w2h = w2h + ((w3h >>> 1 | w3l << 31) ^ (w3h >>> 8 | w3l << 24) ^ w3h >>> 7) + (w2l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19035 | xl = (w0l >>> 19 | w0h << 13) ^ (w0l << 3 | w0h >>> 29) ^ (w0l >>> 6 | w0h << 26) | 0; | |
19036 | w2l = w2l + xl | 0; | |
19037 | w2h = w2h + ((w0h >>> 19 | w0l << 13) ^ (w0h << 3 | w0l >>> 29) ^ w0h >>> 6) + (w2l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19038 | tl = 2341262773 + w2l | 0; | |
19039 | th = 264347078 + w2h + (tl >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
19040 | tl = tl + hl | 0; | |
19041 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19042 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19043 | tl = tl + xl | 0; | |
19044 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19045 | xl = gl ^ el & (fl ^ gl) | 0; | |
19046 | tl = tl + xl | 0; | |
19047 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19048 | hl = gl; | |
19049 | hh = gh; | |
19050 | gl = fl; | |
19051 | gh = fh; | |
19052 | fl = el; | |
19053 | fh = eh; | |
19054 | el = dl + tl | 0; | |
19055 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19056 | dl = cl; | |
19057 | dh = ch; | |
19058 | cl = bl; | |
19059 | ch = bh; | |
19060 | bl = al; | |
19061 | bh = ah; | |
19062 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19063 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19064 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19065 | al = al + xl | 0; | |
19066 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19067 | w3l = w3l + w12l | 0; | |
19068 | w3h = w3h + w12h + (w3l >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
19069 | xl = (w4l >>> 1 | w4h << 31) ^ (w4l >>> 8 | w4h << 24) ^ (w4l >>> 7 | w4h << 25) | 0; | |
19070 | w3l = w3l + xl | 0; | |
19071 | w3h = w3h + ((w4h >>> 1 | w4l << 31) ^ (w4h >>> 8 | w4l << 24) ^ w4h >>> 7) + (w3l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19072 | xl = (w1l >>> 19 | w1h << 13) ^ (w1l << 3 | w1h >>> 29) ^ (w1l >>> 6 | w1h << 26) | 0; | |
19073 | w3l = w3l + xl | 0; | |
19074 | w3h = w3h + ((w1h >>> 19 | w1l << 13) ^ (w1h << 3 | w1l >>> 29) ^ w1h >>> 6) + (w3l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19075 | tl = 2007800933 + w3l | 0; | |
19076 | th = 604807628 + w3h + (tl >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
19077 | tl = tl + hl | 0; | |
19078 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19079 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19080 | tl = tl + xl | 0; | |
19081 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19082 | xl = gl ^ el & (fl ^ gl) | 0; | |
19083 | tl = tl + xl | 0; | |
19084 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19085 | hl = gl; | |
19086 | hh = gh; | |
19087 | gl = fl; | |
19088 | gh = fh; | |
19089 | fl = el; | |
19090 | fh = eh; | |
19091 | el = dl + tl | 0; | |
19092 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19093 | dl = cl; | |
19094 | dh = ch; | |
19095 | cl = bl; | |
19096 | ch = bh; | |
19097 | bl = al; | |
19098 | bh = ah; | |
19099 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19100 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19101 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19102 | al = al + xl | 0; | |
19103 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19104 | w4l = w4l + w13l | 0; | |
19105 | w4h = w4h + w13h + (w4l >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
19106 | xl = (w5l >>> 1 | w5h << 31) ^ (w5l >>> 8 | w5h << 24) ^ (w5l >>> 7 | w5h << 25) | 0; | |
19107 | w4l = w4l + xl | 0; | |
19108 | w4h = w4h + ((w5h >>> 1 | w5l << 31) ^ (w5h >>> 8 | w5l << 24) ^ w5h >>> 7) + (w4l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19109 | xl = (w2l >>> 19 | w2h << 13) ^ (w2l << 3 | w2h >>> 29) ^ (w2l >>> 6 | w2h << 26) | 0; | |
19110 | w4l = w4l + xl | 0; | |
19111 | w4h = w4h + ((w2h >>> 19 | w2l << 13) ^ (w2h << 3 | w2l >>> 29) ^ w2h >>> 6) + (w4l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19112 | tl = 1495990901 + w4l | 0; | |
19113 | th = 770255983 + w4h + (tl >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
19114 | tl = tl + hl | 0; | |
19115 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19116 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19117 | tl = tl + xl | 0; | |
19118 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19119 | xl = gl ^ el & (fl ^ gl) | 0; | |
19120 | tl = tl + xl | 0; | |
19121 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19122 | hl = gl; | |
19123 | hh = gh; | |
19124 | gl = fl; | |
19125 | gh = fh; | |
19126 | fl = el; | |
19127 | fh = eh; | |
19128 | el = dl + tl | 0; | |
19129 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19130 | dl = cl; | |
19131 | dh = ch; | |
19132 | cl = bl; | |
19133 | ch = bh; | |
19134 | bl = al; | |
19135 | bh = ah; | |
19136 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19137 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19138 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19139 | al = al + xl | 0; | |
19140 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19141 | w5l = w5l + w14l | 0; | |
19142 | w5h = w5h + w14h + (w5l >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
19143 | xl = (w6l >>> 1 | w6h << 31) ^ (w6l >>> 8 | w6h << 24) ^ (w6l >>> 7 | w6h << 25) | 0; | |
19144 | w5l = w5l + xl | 0; | |
19145 | w5h = w5h + ((w6h >>> 1 | w6l << 31) ^ (w6h >>> 8 | w6l << 24) ^ w6h >>> 7) + (w5l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19146 | xl = (w3l >>> 19 | w3h << 13) ^ (w3l << 3 | w3h >>> 29) ^ (w3l >>> 6 | w3h << 26) | 0; | |
19147 | w5l = w5l + xl | 0; | |
19148 | w5h = w5h + ((w3h >>> 19 | w3l << 13) ^ (w3h << 3 | w3l >>> 29) ^ w3h >>> 6) + (w5l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19149 | tl = 1856431235 + w5l | 0; | |
19150 | th = 1249150122 + w5h + (tl >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
19151 | tl = tl + hl | 0; | |
19152 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19153 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19154 | tl = tl + xl | 0; | |
19155 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19156 | xl = gl ^ el & (fl ^ gl) | 0; | |
19157 | tl = tl + xl | 0; | |
19158 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19159 | hl = gl; | |
19160 | hh = gh; | |
19161 | gl = fl; | |
19162 | gh = fh; | |
19163 | fl = el; | |
19164 | fh = eh; | |
19165 | el = dl + tl | 0; | |
19166 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19167 | dl = cl; | |
19168 | dh = ch; | |
19169 | cl = bl; | |
19170 | ch = bh; | |
19171 | bl = al; | |
19172 | bh = ah; | |
19173 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19174 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19175 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19176 | al = al + xl | 0; | |
19177 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19178 | w6l = w6l + w15l | 0; | |
19179 | w6h = w6h + w15h + (w6l >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
19180 | xl = (w7l >>> 1 | w7h << 31) ^ (w7l >>> 8 | w7h << 24) ^ (w7l >>> 7 | w7h << 25) | 0; | |
19181 | w6l = w6l + xl | 0; | |
19182 | w6h = w6h + ((w7h >>> 1 | w7l << 31) ^ (w7h >>> 8 | w7l << 24) ^ w7h >>> 7) + (w6l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19183 | xl = (w4l >>> 19 | w4h << 13) ^ (w4l << 3 | w4h >>> 29) ^ (w4l >>> 6 | w4h << 26) | 0; | |
19184 | w6l = w6l + xl | 0; | |
19185 | w6h = w6h + ((w4h >>> 19 | w4l << 13) ^ (w4h << 3 | w4l >>> 29) ^ w4h >>> 6) + (w6l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19186 | tl = 3175218132 + w6l | 0; | |
19187 | th = 1555081692 + w6h + (tl >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
19188 | tl = tl + hl | 0; | |
19189 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19190 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19191 | tl = tl + xl | 0; | |
19192 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19193 | xl = gl ^ el & (fl ^ gl) | 0; | |
19194 | tl = tl + xl | 0; | |
19195 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19196 | hl = gl; | |
19197 | hh = gh; | |
19198 | gl = fl; | |
19199 | gh = fh; | |
19200 | fl = el; | |
19201 | fh = eh; | |
19202 | el = dl + tl | 0; | |
19203 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19204 | dl = cl; | |
19205 | dh = ch; | |
19206 | cl = bl; | |
19207 | ch = bh; | |
19208 | bl = al; | |
19209 | bh = ah; | |
19210 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19211 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19212 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19213 | al = al + xl | 0; | |
19214 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19215 | w7l = w7l + w0l | 0; | |
19216 | w7h = w7h + w0h + (w7l >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
19217 | xl = (w8l >>> 1 | w8h << 31) ^ (w8l >>> 8 | w8h << 24) ^ (w8l >>> 7 | w8h << 25) | 0; | |
19218 | w7l = w7l + xl | 0; | |
19219 | w7h = w7h + ((w8h >>> 1 | w8l << 31) ^ (w8h >>> 8 | w8l << 24) ^ w8h >>> 7) + (w7l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19220 | xl = (w5l >>> 19 | w5h << 13) ^ (w5l << 3 | w5h >>> 29) ^ (w5l >>> 6 | w5h << 26) | 0; | |
19221 | w7l = w7l + xl | 0; | |
19222 | w7h = w7h + ((w5h >>> 19 | w5l << 13) ^ (w5h << 3 | w5l >>> 29) ^ w5h >>> 6) + (w7l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19223 | tl = 2198950837 + w7l | 0; | |
19224 | th = 1996064986 + w7h + (tl >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
19225 | tl = tl + hl | 0; | |
19226 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19227 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19228 | tl = tl + xl | 0; | |
19229 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19230 | xl = gl ^ el & (fl ^ gl) | 0; | |
19231 | tl = tl + xl | 0; | |
19232 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19233 | hl = gl; | |
19234 | hh = gh; | |
19235 | gl = fl; | |
19236 | gh = fh; | |
19237 | fl = el; | |
19238 | fh = eh; | |
19239 | el = dl + tl | 0; | |
19240 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19241 | dl = cl; | |
19242 | dh = ch; | |
19243 | cl = bl; | |
19244 | ch = bh; | |
19245 | bl = al; | |
19246 | bh = ah; | |
19247 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19248 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19249 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19250 | al = al + xl | 0; | |
19251 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19252 | w8l = w8l + w1l | 0; | |
19253 | w8h = w8h + w1h + (w8l >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
19254 | xl = (w9l >>> 1 | w9h << 31) ^ (w9l >>> 8 | w9h << 24) ^ (w9l >>> 7 | w9h << 25) | 0; | |
19255 | w8l = w8l + xl | 0; | |
19256 | w8h = w8h + ((w9h >>> 1 | w9l << 31) ^ (w9h >>> 8 | w9l << 24) ^ w9h >>> 7) + (w8l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19257 | xl = (w6l >>> 19 | w6h << 13) ^ (w6l << 3 | w6h >>> 29) ^ (w6l >>> 6 | w6h << 26) | 0; | |
19258 | w8l = w8l + xl | 0; | |
19259 | w8h = w8h + ((w6h >>> 19 | w6l << 13) ^ (w6h << 3 | w6l >>> 29) ^ w6h >>> 6) + (w8l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19260 | tl = 3999719339 + w8l | 0; | |
19261 | th = 2554220882 + w8h + (tl >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
19262 | tl = tl + hl | 0; | |
19263 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19264 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19265 | tl = tl + xl | 0; | |
19266 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19267 | xl = gl ^ el & (fl ^ gl) | 0; | |
19268 | tl = tl + xl | 0; | |
19269 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19270 | hl = gl; | |
19271 | hh = gh; | |
19272 | gl = fl; | |
19273 | gh = fh; | |
19274 | fl = el; | |
19275 | fh = eh; | |
19276 | el = dl + tl | 0; | |
19277 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19278 | dl = cl; | |
19279 | dh = ch; | |
19280 | cl = bl; | |
19281 | ch = bh; | |
19282 | bl = al; | |
19283 | bh = ah; | |
19284 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19285 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19286 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19287 | al = al + xl | 0; | |
19288 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19289 | w9l = w9l + w2l | 0; | |
19290 | w9h = w9h + w2h + (w9l >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
19291 | xl = (w10l >>> 1 | w10h << 31) ^ (w10l >>> 8 | w10h << 24) ^ (w10l >>> 7 | w10h << 25) | 0; | |
19292 | w9l = w9l + xl | 0; | |
19293 | w9h = w9h + ((w10h >>> 1 | w10l << 31) ^ (w10h >>> 8 | w10l << 24) ^ w10h >>> 7) + (w9l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19294 | xl = (w7l >>> 19 | w7h << 13) ^ (w7l << 3 | w7h >>> 29) ^ (w7l >>> 6 | w7h << 26) | 0; | |
19295 | w9l = w9l + xl | 0; | |
19296 | w9h = w9h + ((w7h >>> 19 | w7l << 13) ^ (w7h << 3 | w7l >>> 29) ^ w7h >>> 6) + (w9l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19297 | tl = 766784016 + w9l | 0; | |
19298 | th = 2821834349 + w9h + (tl >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
19299 | tl = tl + hl | 0; | |
19300 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19301 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19302 | tl = tl + xl | 0; | |
19303 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19304 | xl = gl ^ el & (fl ^ gl) | 0; | |
19305 | tl = tl + xl | 0; | |
19306 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19307 | hl = gl; | |
19308 | hh = gh; | |
19309 | gl = fl; | |
19310 | gh = fh; | |
19311 | fl = el; | |
19312 | fh = eh; | |
19313 | el = dl + tl | 0; | |
19314 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19315 | dl = cl; | |
19316 | dh = ch; | |
19317 | cl = bl; | |
19318 | ch = bh; | |
19319 | bl = al; | |
19320 | bh = ah; | |
19321 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19322 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19323 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19324 | al = al + xl | 0; | |
19325 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19326 | w10l = w10l + w3l | 0; | |
19327 | w10h = w10h + w3h + (w10l >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
19328 | xl = (w11l >>> 1 | w11h << 31) ^ (w11l >>> 8 | w11h << 24) ^ (w11l >>> 7 | w11h << 25) | 0; | |
19329 | w10l = w10l + xl | 0; | |
19330 | w10h = w10h + ((w11h >>> 1 | w11l << 31) ^ (w11h >>> 8 | w11l << 24) ^ w11h >>> 7) + (w10l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19331 | xl = (w8l >>> 19 | w8h << 13) ^ (w8l << 3 | w8h >>> 29) ^ (w8l >>> 6 | w8h << 26) | 0; | |
19332 | w10l = w10l + xl | 0; | |
19333 | w10h = w10h + ((w8h >>> 19 | w8l << 13) ^ (w8h << 3 | w8l >>> 29) ^ w8h >>> 6) + (w10l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19334 | tl = 2566594879 + w10l | 0; | |
19335 | th = 2952996808 + w10h + (tl >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
19336 | tl = tl + hl | 0; | |
19337 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19338 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19339 | tl = tl + xl | 0; | |
19340 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19341 | xl = gl ^ el & (fl ^ gl) | 0; | |
19342 | tl = tl + xl | 0; | |
19343 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19344 | hl = gl; | |
19345 | hh = gh; | |
19346 | gl = fl; | |
19347 | gh = fh; | |
19348 | fl = el; | |
19349 | fh = eh; | |
19350 | el = dl + tl | 0; | |
19351 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19352 | dl = cl; | |
19353 | dh = ch; | |
19354 | cl = bl; | |
19355 | ch = bh; | |
19356 | bl = al; | |
19357 | bh = ah; | |
19358 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19359 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19360 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19361 | al = al + xl | 0; | |
19362 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19363 | w11l = w11l + w4l | 0; | |
19364 | w11h = w11h + w4h + (w11l >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
19365 | xl = (w12l >>> 1 | w12h << 31) ^ (w12l >>> 8 | w12h << 24) ^ (w12l >>> 7 | w12h << 25) | 0; | |
19366 | w11l = w11l + xl | 0; | |
19367 | w11h = w11h + ((w12h >>> 1 | w12l << 31) ^ (w12h >>> 8 | w12l << 24) ^ w12h >>> 7) + (w11l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19368 | xl = (w9l >>> 19 | w9h << 13) ^ (w9l << 3 | w9h >>> 29) ^ (w9l >>> 6 | w9h << 26) | 0; | |
19369 | w11l = w11l + xl | 0; | |
19370 | w11h = w11h + ((w9h >>> 19 | w9l << 13) ^ (w9h << 3 | w9l >>> 29) ^ w9h >>> 6) + (w11l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19371 | tl = 3203337956 + w11l | 0; | |
19372 | th = 3210313671 + w11h + (tl >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
19373 | tl = tl + hl | 0; | |
19374 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19375 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19376 | tl = tl + xl | 0; | |
19377 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19378 | xl = gl ^ el & (fl ^ gl) | 0; | |
19379 | tl = tl + xl | 0; | |
19380 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19381 | hl = gl; | |
19382 | hh = gh; | |
19383 | gl = fl; | |
19384 | gh = fh; | |
19385 | fl = el; | |
19386 | fh = eh; | |
19387 | el = dl + tl | 0; | |
19388 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19389 | dl = cl; | |
19390 | dh = ch; | |
19391 | cl = bl; | |
19392 | ch = bh; | |
19393 | bl = al; | |
19394 | bh = ah; | |
19395 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19396 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19397 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19398 | al = al + xl | 0; | |
19399 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19400 | w12l = w12l + w5l | 0; | |
19401 | w12h = w12h + w5h + (w12l >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
19402 | xl = (w13l >>> 1 | w13h << 31) ^ (w13l >>> 8 | w13h << 24) ^ (w13l >>> 7 | w13h << 25) | 0; | |
19403 | w12l = w12l + xl | 0; | |
19404 | w12h = w12h + ((w13h >>> 1 | w13l << 31) ^ (w13h >>> 8 | w13l << 24) ^ w13h >>> 7) + (w12l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19405 | xl = (w10l >>> 19 | w10h << 13) ^ (w10l << 3 | w10h >>> 29) ^ (w10l >>> 6 | w10h << 26) | 0; | |
19406 | w12l = w12l + xl | 0; | |
19407 | w12h = w12h + ((w10h >>> 19 | w10l << 13) ^ (w10h << 3 | w10l >>> 29) ^ w10h >>> 6) + (w12l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19408 | tl = 1034457026 + w12l | 0; | |
19409 | th = 3336571891 + w12h + (tl >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
19410 | tl = tl + hl | 0; | |
19411 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19412 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19413 | tl = tl + xl | 0; | |
19414 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19415 | xl = gl ^ el & (fl ^ gl) | 0; | |
19416 | tl = tl + xl | 0; | |
19417 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19418 | hl = gl; | |
19419 | hh = gh; | |
19420 | gl = fl; | |
19421 | gh = fh; | |
19422 | fl = el; | |
19423 | fh = eh; | |
19424 | el = dl + tl | 0; | |
19425 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19426 | dl = cl; | |
19427 | dh = ch; | |
19428 | cl = bl; | |
19429 | ch = bh; | |
19430 | bl = al; | |
19431 | bh = ah; | |
19432 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19433 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19434 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19435 | al = al + xl | 0; | |
19436 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19437 | w13l = w13l + w6l | 0; | |
19438 | w13h = w13h + w6h + (w13l >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
19439 | xl = (w14l >>> 1 | w14h << 31) ^ (w14l >>> 8 | w14h << 24) ^ (w14l >>> 7 | w14h << 25) | 0; | |
19440 | w13l = w13l + xl | 0; | |
19441 | w13h = w13h + ((w14h >>> 1 | w14l << 31) ^ (w14h >>> 8 | w14l << 24) ^ w14h >>> 7) + (w13l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19442 | xl = (w11l >>> 19 | w11h << 13) ^ (w11l << 3 | w11h >>> 29) ^ (w11l >>> 6 | w11h << 26) | 0; | |
19443 | w13l = w13l + xl | 0; | |
19444 | w13h = w13h + ((w11h >>> 19 | w11l << 13) ^ (w11h << 3 | w11l >>> 29) ^ w11h >>> 6) + (w13l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19445 | tl = 2466948901 + w13l | 0; | |
19446 | th = 3584528711 + w13h + (tl >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
19447 | tl = tl + hl | 0; | |
19448 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19449 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19450 | tl = tl + xl | 0; | |
19451 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19452 | xl = gl ^ el & (fl ^ gl) | 0; | |
19453 | tl = tl + xl | 0; | |
19454 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19455 | hl = gl; | |
19456 | hh = gh; | |
19457 | gl = fl; | |
19458 | gh = fh; | |
19459 | fl = el; | |
19460 | fh = eh; | |
19461 | el = dl + tl | 0; | |
19462 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19463 | dl = cl; | |
19464 | dh = ch; | |
19465 | cl = bl; | |
19466 | ch = bh; | |
19467 | bl = al; | |
19468 | bh = ah; | |
19469 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19470 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19471 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19472 | al = al + xl | 0; | |
19473 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19474 | w14l = w14l + w7l | 0; | |
19475 | w14h = w14h + w7h + (w14l >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
19476 | xl = (w15l >>> 1 | w15h << 31) ^ (w15l >>> 8 | w15h << 24) ^ (w15l >>> 7 | w15h << 25) | 0; | |
19477 | w14l = w14l + xl | 0; | |
19478 | w14h = w14h + ((w15h >>> 1 | w15l << 31) ^ (w15h >>> 8 | w15l << 24) ^ w15h >>> 7) + (w14l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19479 | xl = (w12l >>> 19 | w12h << 13) ^ (w12l << 3 | w12h >>> 29) ^ (w12l >>> 6 | w12h << 26) | 0; | |
19480 | w14l = w14l + xl | 0; | |
19481 | w14h = w14h + ((w12h >>> 19 | w12l << 13) ^ (w12h << 3 | w12l >>> 29) ^ w12h >>> 6) + (w14l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19482 | tl = 3758326383 + w14l | 0; | |
19483 | th = 113926993 + w14h + (tl >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
19484 | tl = tl + hl | 0; | |
19485 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19486 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19487 | tl = tl + xl | 0; | |
19488 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19489 | xl = gl ^ el & (fl ^ gl) | 0; | |
19490 | tl = tl + xl | 0; | |
19491 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19492 | hl = gl; | |
19493 | hh = gh; | |
19494 | gl = fl; | |
19495 | gh = fh; | |
19496 | fl = el; | |
19497 | fh = eh; | |
19498 | el = dl + tl | 0; | |
19499 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19500 | dl = cl; | |
19501 | dh = ch; | |
19502 | cl = bl; | |
19503 | ch = bh; | |
19504 | bl = al; | |
19505 | bh = ah; | |
19506 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19507 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19508 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19509 | al = al + xl | 0; | |
19510 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19511 | w15l = w15l + w8l | 0; | |
19512 | w15h = w15h + w8h + (w15l >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
19513 | xl = (w0l >>> 1 | w0h << 31) ^ (w0l >>> 8 | w0h << 24) ^ (w0l >>> 7 | w0h << 25) | 0; | |
19514 | w15l = w15l + xl | 0; | |
19515 | w15h = w15h + ((w0h >>> 1 | w0l << 31) ^ (w0h >>> 8 | w0l << 24) ^ w0h >>> 7) + (w15l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19516 | xl = (w13l >>> 19 | w13h << 13) ^ (w13l << 3 | w13h >>> 29) ^ (w13l >>> 6 | w13h << 26) | 0; | |
19517 | w15l = w15l + xl | 0; | |
19518 | w15h = w15h + ((w13h >>> 19 | w13l << 13) ^ (w13h << 3 | w13l >>> 29) ^ w13h >>> 6) + (w15l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19519 | tl = 168717936 + w15l | 0; | |
19520 | th = 338241895 + w15h + (tl >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
19521 | tl = tl + hl | 0; | |
19522 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19523 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19524 | tl = tl + xl | 0; | |
19525 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19526 | xl = gl ^ el & (fl ^ gl) | 0; | |
19527 | tl = tl + xl | 0; | |
19528 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19529 | hl = gl; | |
19530 | hh = gh; | |
19531 | gl = fl; | |
19532 | gh = fh; | |
19533 | fl = el; | |
19534 | fh = eh; | |
19535 | el = dl + tl | 0; | |
19536 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19537 | dl = cl; | |
19538 | dh = ch; | |
19539 | cl = bl; | |
19540 | ch = bh; | |
19541 | bl = al; | |
19542 | bh = ah; | |
19543 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19544 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19545 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19546 | al = al + xl | 0; | |
19547 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19548 | w0l = w0l + w9l | 0; | |
19549 | w0h = w0h + w9h + (w0l >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
19550 | xl = (w1l >>> 1 | w1h << 31) ^ (w1l >>> 8 | w1h << 24) ^ (w1l >>> 7 | w1h << 25) | 0; | |
19551 | w0l = w0l + xl | 0; | |
19552 | w0h = w0h + ((w1h >>> 1 | w1l << 31) ^ (w1h >>> 8 | w1l << 24) ^ w1h >>> 7) + (w0l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19553 | xl = (w14l >>> 19 | w14h << 13) ^ (w14l << 3 | w14h >>> 29) ^ (w14l >>> 6 | w14h << 26) | 0; | |
19554 | w0l = w0l + xl | 0; | |
19555 | w0h = w0h + ((w14h >>> 19 | w14l << 13) ^ (w14h << 3 | w14l >>> 29) ^ w14h >>> 6) + (w0l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19556 | tl = 1188179964 + w0l | 0; | |
19557 | th = 666307205 + w0h + (tl >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
19558 | tl = tl + hl | 0; | |
19559 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19560 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19561 | tl = tl + xl | 0; | |
19562 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19563 | xl = gl ^ el & (fl ^ gl) | 0; | |
19564 | tl = tl + xl | 0; | |
19565 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19566 | hl = gl; | |
19567 | hh = gh; | |
19568 | gl = fl; | |
19569 | gh = fh; | |
19570 | fl = el; | |
19571 | fh = eh; | |
19572 | el = dl + tl | 0; | |
19573 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19574 | dl = cl; | |
19575 | dh = ch; | |
19576 | cl = bl; | |
19577 | ch = bh; | |
19578 | bl = al; | |
19579 | bh = ah; | |
19580 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19581 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19582 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19583 | al = al + xl | 0; | |
19584 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19585 | w1l = w1l + w10l | 0; | |
19586 | w1h = w1h + w10h + (w1l >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
19587 | xl = (w2l >>> 1 | w2h << 31) ^ (w2l >>> 8 | w2h << 24) ^ (w2l >>> 7 | w2h << 25) | 0; | |
19588 | w1l = w1l + xl | 0; | |
19589 | w1h = w1h + ((w2h >>> 1 | w2l << 31) ^ (w2h >>> 8 | w2l << 24) ^ w2h >>> 7) + (w1l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19590 | xl = (w15l >>> 19 | w15h << 13) ^ (w15l << 3 | w15h >>> 29) ^ (w15l >>> 6 | w15h << 26) | 0; | |
19591 | w1l = w1l + xl | 0; | |
19592 | w1h = w1h + ((w15h >>> 19 | w15l << 13) ^ (w15h << 3 | w15l >>> 29) ^ w15h >>> 6) + (w1l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19593 | tl = 1546045734 + w1l | 0; | |
19594 | th = 773529912 + w1h + (tl >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
19595 | tl = tl + hl | 0; | |
19596 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19597 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19598 | tl = tl + xl | 0; | |
19599 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19600 | xl = gl ^ el & (fl ^ gl) | 0; | |
19601 | tl = tl + xl | 0; | |
19602 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19603 | hl = gl; | |
19604 | hh = gh; | |
19605 | gl = fl; | |
19606 | gh = fh; | |
19607 | fl = el; | |
19608 | fh = eh; | |
19609 | el = dl + tl | 0; | |
19610 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19611 | dl = cl; | |
19612 | dh = ch; | |
19613 | cl = bl; | |
19614 | ch = bh; | |
19615 | bl = al; | |
19616 | bh = ah; | |
19617 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19618 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19619 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19620 | al = al + xl | 0; | |
19621 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19622 | w2l = w2l + w11l | 0; | |
19623 | w2h = w2h + w11h + (w2l >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
19624 | xl = (w3l >>> 1 | w3h << 31) ^ (w3l >>> 8 | w3h << 24) ^ (w3l >>> 7 | w3h << 25) | 0; | |
19625 | w2l = w2l + xl | 0; | |
19626 | w2h = w2h + ((w3h >>> 1 | w3l << 31) ^ (w3h >>> 8 | w3l << 24) ^ w3h >>> 7) + (w2l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19627 | xl = (w0l >>> 19 | w0h << 13) ^ (w0l << 3 | w0h >>> 29) ^ (w0l >>> 6 | w0h << 26) | 0; | |
19628 | w2l = w2l + xl | 0; | |
19629 | w2h = w2h + ((w0h >>> 19 | w0l << 13) ^ (w0h << 3 | w0l >>> 29) ^ w0h >>> 6) + (w2l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19630 | tl = 1522805485 + w2l | 0; | |
19631 | th = 1294757372 + w2h + (tl >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
19632 | tl = tl + hl | 0; | |
19633 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19634 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19635 | tl = tl + xl | 0; | |
19636 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19637 | xl = gl ^ el & (fl ^ gl) | 0; | |
19638 | tl = tl + xl | 0; | |
19639 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19640 | hl = gl; | |
19641 | hh = gh; | |
19642 | gl = fl; | |
19643 | gh = fh; | |
19644 | fl = el; | |
19645 | fh = eh; | |
19646 | el = dl + tl | 0; | |
19647 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19648 | dl = cl; | |
19649 | dh = ch; | |
19650 | cl = bl; | |
19651 | ch = bh; | |
19652 | bl = al; | |
19653 | bh = ah; | |
19654 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19655 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19656 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19657 | al = al + xl | 0; | |
19658 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19659 | w3l = w3l + w12l | 0; | |
19660 | w3h = w3h + w12h + (w3l >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
19661 | xl = (w4l >>> 1 | w4h << 31) ^ (w4l >>> 8 | w4h << 24) ^ (w4l >>> 7 | w4h << 25) | 0; | |
19662 | w3l = w3l + xl | 0; | |
19663 | w3h = w3h + ((w4h >>> 1 | w4l << 31) ^ (w4h >>> 8 | w4l << 24) ^ w4h >>> 7) + (w3l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19664 | xl = (w1l >>> 19 | w1h << 13) ^ (w1l << 3 | w1h >>> 29) ^ (w1l >>> 6 | w1h << 26) | 0; | |
19665 | w3l = w3l + xl | 0; | |
19666 | w3h = w3h + ((w1h >>> 19 | w1l << 13) ^ (w1h << 3 | w1l >>> 29) ^ w1h >>> 6) + (w3l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19667 | tl = 2643833823 + w3l | 0; | |
19668 | th = 1396182291 + w3h + (tl >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
19669 | tl = tl + hl | 0; | |
19670 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19671 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19672 | tl = tl + xl | 0; | |
19673 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19674 | xl = gl ^ el & (fl ^ gl) | 0; | |
19675 | tl = tl + xl | 0; | |
19676 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19677 | hl = gl; | |
19678 | hh = gh; | |
19679 | gl = fl; | |
19680 | gh = fh; | |
19681 | fl = el; | |
19682 | fh = eh; | |
19683 | el = dl + tl | 0; | |
19684 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19685 | dl = cl; | |
19686 | dh = ch; | |
19687 | cl = bl; | |
19688 | ch = bh; | |
19689 | bl = al; | |
19690 | bh = ah; | |
19691 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19692 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19693 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19694 | al = al + xl | 0; | |
19695 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19696 | w4l = w4l + w13l | 0; | |
19697 | w4h = w4h + w13h + (w4l >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
19698 | xl = (w5l >>> 1 | w5h << 31) ^ (w5l >>> 8 | w5h << 24) ^ (w5l >>> 7 | w5h << 25) | 0; | |
19699 | w4l = w4l + xl | 0; | |
19700 | w4h = w4h + ((w5h >>> 1 | w5l << 31) ^ (w5h >>> 8 | w5l << 24) ^ w5h >>> 7) + (w4l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19701 | xl = (w2l >>> 19 | w2h << 13) ^ (w2l << 3 | w2h >>> 29) ^ (w2l >>> 6 | w2h << 26) | 0; | |
19702 | w4l = w4l + xl | 0; | |
19703 | w4h = w4h + ((w2h >>> 19 | w2l << 13) ^ (w2h << 3 | w2l >>> 29) ^ w2h >>> 6) + (w4l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19704 | tl = 2343527390 + w4l | 0; | |
19705 | th = 1695183700 + w4h + (tl >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
19706 | tl = tl + hl | 0; | |
19707 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19708 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19709 | tl = tl + xl | 0; | |
19710 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19711 | xl = gl ^ el & (fl ^ gl) | 0; | |
19712 | tl = tl + xl | 0; | |
19713 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19714 | hl = gl; | |
19715 | hh = gh; | |
19716 | gl = fl; | |
19717 | gh = fh; | |
19718 | fl = el; | |
19719 | fh = eh; | |
19720 | el = dl + tl | 0; | |
19721 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19722 | dl = cl; | |
19723 | dh = ch; | |
19724 | cl = bl; | |
19725 | ch = bh; | |
19726 | bl = al; | |
19727 | bh = ah; | |
19728 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19729 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19730 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19731 | al = al + xl | 0; | |
19732 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19733 | w5l = w5l + w14l | 0; | |
19734 | w5h = w5h + w14h + (w5l >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
19735 | xl = (w6l >>> 1 | w6h << 31) ^ (w6l >>> 8 | w6h << 24) ^ (w6l >>> 7 | w6h << 25) | 0; | |
19736 | w5l = w5l + xl | 0; | |
19737 | w5h = w5h + ((w6h >>> 1 | w6l << 31) ^ (w6h >>> 8 | w6l << 24) ^ w6h >>> 7) + (w5l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19738 | xl = (w3l >>> 19 | w3h << 13) ^ (w3l << 3 | w3h >>> 29) ^ (w3l >>> 6 | w3h << 26) | 0; | |
19739 | w5l = w5l + xl | 0; | |
19740 | w5h = w5h + ((w3h >>> 19 | w3l << 13) ^ (w3h << 3 | w3l >>> 29) ^ w3h >>> 6) + (w5l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19741 | tl = 1014477480 + w5l | 0; | |
19742 | th = 1986661051 + w5h + (tl >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
19743 | tl = tl + hl | 0; | |
19744 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19745 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19746 | tl = tl + xl | 0; | |
19747 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19748 | xl = gl ^ el & (fl ^ gl) | 0; | |
19749 | tl = tl + xl | 0; | |
19750 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19751 | hl = gl; | |
19752 | hh = gh; | |
19753 | gl = fl; | |
19754 | gh = fh; | |
19755 | fl = el; | |
19756 | fh = eh; | |
19757 | el = dl + tl | 0; | |
19758 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19759 | dl = cl; | |
19760 | dh = ch; | |
19761 | cl = bl; | |
19762 | ch = bh; | |
19763 | bl = al; | |
19764 | bh = ah; | |
19765 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19766 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19767 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19768 | al = al + xl | 0; | |
19769 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19770 | w6l = w6l + w15l | 0; | |
19771 | w6h = w6h + w15h + (w6l >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
19772 | xl = (w7l >>> 1 | w7h << 31) ^ (w7l >>> 8 | w7h << 24) ^ (w7l >>> 7 | w7h << 25) | 0; | |
19773 | w6l = w6l + xl | 0; | |
19774 | w6h = w6h + ((w7h >>> 1 | w7l << 31) ^ (w7h >>> 8 | w7l << 24) ^ w7h >>> 7) + (w6l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19775 | xl = (w4l >>> 19 | w4h << 13) ^ (w4l << 3 | w4h >>> 29) ^ (w4l >>> 6 | w4h << 26) | 0; | |
19776 | w6l = w6l + xl | 0; | |
19777 | w6h = w6h + ((w4h >>> 19 | w4l << 13) ^ (w4h << 3 | w4l >>> 29) ^ w4h >>> 6) + (w6l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19778 | tl = 1206759142 + w6l | 0; | |
19779 | th = 2177026350 + w6h + (tl >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
19780 | tl = tl + hl | 0; | |
19781 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19782 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19783 | tl = tl + xl | 0; | |
19784 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19785 | xl = gl ^ el & (fl ^ gl) | 0; | |
19786 | tl = tl + xl | 0; | |
19787 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19788 | hl = gl; | |
19789 | hh = gh; | |
19790 | gl = fl; | |
19791 | gh = fh; | |
19792 | fl = el; | |
19793 | fh = eh; | |
19794 | el = dl + tl | 0; | |
19795 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19796 | dl = cl; | |
19797 | dh = ch; | |
19798 | cl = bl; | |
19799 | ch = bh; | |
19800 | bl = al; | |
19801 | bh = ah; | |
19802 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19803 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19804 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19805 | al = al + xl | 0; | |
19806 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19807 | w7l = w7l + w0l | 0; | |
19808 | w7h = w7h + w0h + (w7l >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
19809 | xl = (w8l >>> 1 | w8h << 31) ^ (w8l >>> 8 | w8h << 24) ^ (w8l >>> 7 | w8h << 25) | 0; | |
19810 | w7l = w7l + xl | 0; | |
19811 | w7h = w7h + ((w8h >>> 1 | w8l << 31) ^ (w8h >>> 8 | w8l << 24) ^ w8h >>> 7) + (w7l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19812 | xl = (w5l >>> 19 | w5h << 13) ^ (w5l << 3 | w5h >>> 29) ^ (w5l >>> 6 | w5h << 26) | 0; | |
19813 | w7l = w7l + xl | 0; | |
19814 | w7h = w7h + ((w5h >>> 19 | w5l << 13) ^ (w5h << 3 | w5l >>> 29) ^ w5h >>> 6) + (w7l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19815 | tl = 344077627 + w7l | 0; | |
19816 | th = 2456956037 + w7h + (tl >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
19817 | tl = tl + hl | 0; | |
19818 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19819 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19820 | tl = tl + xl | 0; | |
19821 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19822 | xl = gl ^ el & (fl ^ gl) | 0; | |
19823 | tl = tl + xl | 0; | |
19824 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19825 | hl = gl; | |
19826 | hh = gh; | |
19827 | gl = fl; | |
19828 | gh = fh; | |
19829 | fl = el; | |
19830 | fh = eh; | |
19831 | el = dl + tl | 0; | |
19832 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19833 | dl = cl; | |
19834 | dh = ch; | |
19835 | cl = bl; | |
19836 | ch = bh; | |
19837 | bl = al; | |
19838 | bh = ah; | |
19839 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19840 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19841 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19842 | al = al + xl | 0; | |
19843 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19844 | w8l = w8l + w1l | 0; | |
19845 | w8h = w8h + w1h + (w8l >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
19846 | xl = (w9l >>> 1 | w9h << 31) ^ (w9l >>> 8 | w9h << 24) ^ (w9l >>> 7 | w9h << 25) | 0; | |
19847 | w8l = w8l + xl | 0; | |
19848 | w8h = w8h + ((w9h >>> 1 | w9l << 31) ^ (w9h >>> 8 | w9l << 24) ^ w9h >>> 7) + (w8l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19849 | xl = (w6l >>> 19 | w6h << 13) ^ (w6l << 3 | w6h >>> 29) ^ (w6l >>> 6 | w6h << 26) | 0; | |
19850 | w8l = w8l + xl | 0; | |
19851 | w8h = w8h + ((w6h >>> 19 | w6l << 13) ^ (w6h << 3 | w6l >>> 29) ^ w6h >>> 6) + (w8l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19852 | tl = 1290863460 + w8l | 0; | |
19853 | th = 2730485921 + w8h + (tl >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
19854 | tl = tl + hl | 0; | |
19855 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19856 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19857 | tl = tl + xl | 0; | |
19858 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19859 | xl = gl ^ el & (fl ^ gl) | 0; | |
19860 | tl = tl + xl | 0; | |
19861 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19862 | hl = gl; | |
19863 | hh = gh; | |
19864 | gl = fl; | |
19865 | gh = fh; | |
19866 | fl = el; | |
19867 | fh = eh; | |
19868 | el = dl + tl | 0; | |
19869 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19870 | dl = cl; | |
19871 | dh = ch; | |
19872 | cl = bl; | |
19873 | ch = bh; | |
19874 | bl = al; | |
19875 | bh = ah; | |
19876 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19877 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19878 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19879 | al = al + xl | 0; | |
19880 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19881 | w9l = w9l + w2l | 0; | |
19882 | w9h = w9h + w2h + (w9l >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
19883 | xl = (w10l >>> 1 | w10h << 31) ^ (w10l >>> 8 | w10h << 24) ^ (w10l >>> 7 | w10h << 25) | 0; | |
19884 | w9l = w9l + xl | 0; | |
19885 | w9h = w9h + ((w10h >>> 1 | w10l << 31) ^ (w10h >>> 8 | w10l << 24) ^ w10h >>> 7) + (w9l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19886 | xl = (w7l >>> 19 | w7h << 13) ^ (w7l << 3 | w7h >>> 29) ^ (w7l >>> 6 | w7h << 26) | 0; | |
19887 | w9l = w9l + xl | 0; | |
19888 | w9h = w9h + ((w7h >>> 19 | w7l << 13) ^ (w7h << 3 | w7l >>> 29) ^ w7h >>> 6) + (w9l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19889 | tl = 3158454273 + w9l | 0; | |
19890 | th = 2820302411 + w9h + (tl >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
19891 | tl = tl + hl | 0; | |
19892 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19893 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19894 | tl = tl + xl | 0; | |
19895 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19896 | xl = gl ^ el & (fl ^ gl) | 0; | |
19897 | tl = tl + xl | 0; | |
19898 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19899 | hl = gl; | |
19900 | hh = gh; | |
19901 | gl = fl; | |
19902 | gh = fh; | |
19903 | fl = el; | |
19904 | fh = eh; | |
19905 | el = dl + tl | 0; | |
19906 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19907 | dl = cl; | |
19908 | dh = ch; | |
19909 | cl = bl; | |
19910 | ch = bh; | |
19911 | bl = al; | |
19912 | bh = ah; | |
19913 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19914 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19915 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19916 | al = al + xl | 0; | |
19917 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19918 | w10l = w10l + w3l | 0; | |
19919 | w10h = w10h + w3h + (w10l >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
19920 | xl = (w11l >>> 1 | w11h << 31) ^ (w11l >>> 8 | w11h << 24) ^ (w11l >>> 7 | w11h << 25) | 0; | |
19921 | w10l = w10l + xl | 0; | |
19922 | w10h = w10h + ((w11h >>> 1 | w11l << 31) ^ (w11h >>> 8 | w11l << 24) ^ w11h >>> 7) + (w10l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19923 | xl = (w8l >>> 19 | w8h << 13) ^ (w8l << 3 | w8h >>> 29) ^ (w8l >>> 6 | w8h << 26) | 0; | |
19924 | w10l = w10l + xl | 0; | |
19925 | w10h = w10h + ((w8h >>> 19 | w8l << 13) ^ (w8h << 3 | w8l >>> 29) ^ w8h >>> 6) + (w10l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19926 | tl = 3505952657 + w10l | 0; | |
19927 | th = 3259730800 + w10h + (tl >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
19928 | tl = tl + hl | 0; | |
19929 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19930 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19931 | tl = tl + xl | 0; | |
19932 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19933 | xl = gl ^ el & (fl ^ gl) | 0; | |
19934 | tl = tl + xl | 0; | |
19935 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19936 | hl = gl; | |
19937 | hh = gh; | |
19938 | gl = fl; | |
19939 | gh = fh; | |
19940 | fl = el; | |
19941 | fh = eh; | |
19942 | el = dl + tl | 0; | |
19943 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19944 | dl = cl; | |
19945 | dh = ch; | |
19946 | cl = bl; | |
19947 | ch = bh; | |
19948 | bl = al; | |
19949 | bh = ah; | |
19950 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19951 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19952 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19953 | al = al + xl | 0; | |
19954 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19955 | w11l = w11l + w4l | 0; | |
19956 | w11h = w11h + w4h + (w11l >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
19957 | xl = (w12l >>> 1 | w12h << 31) ^ (w12l >>> 8 | w12h << 24) ^ (w12l >>> 7 | w12h << 25) | 0; | |
19958 | w11l = w11l + xl | 0; | |
19959 | w11h = w11h + ((w12h >>> 1 | w12l << 31) ^ (w12h >>> 8 | w12l << 24) ^ w12h >>> 7) + (w11l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19960 | xl = (w9l >>> 19 | w9h << 13) ^ (w9l << 3 | w9h >>> 29) ^ (w9l >>> 6 | w9h << 26) | 0; | |
19961 | w11l = w11l + xl | 0; | |
19962 | w11h = w11h + ((w9h >>> 19 | w9l << 13) ^ (w9h << 3 | w9l >>> 29) ^ w9h >>> 6) + (w11l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19963 | tl = 106217008 + w11l | 0; | |
19964 | th = 3345764771 + w11h + (tl >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
19965 | tl = tl + hl | 0; | |
19966 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19967 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19968 | tl = tl + xl | 0; | |
19969 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19970 | xl = gl ^ el & (fl ^ gl) | 0; | |
19971 | tl = tl + xl | 0; | |
19972 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19973 | hl = gl; | |
19974 | hh = gh; | |
19975 | gl = fl; | |
19976 | gh = fh; | |
19977 | fl = el; | |
19978 | fh = eh; | |
19979 | el = dl + tl | 0; | |
19980 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19981 | dl = cl; | |
19982 | dh = ch; | |
19983 | cl = bl; | |
19984 | ch = bh; | |
19985 | bl = al; | |
19986 | bh = ah; | |
19987 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19988 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19989 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19990 | al = al + xl | 0; | |
19991 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19992 | w12l = w12l + w5l | 0; | |
19993 | w12h = w12h + w5h + (w12l >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
19994 | xl = (w13l >>> 1 | w13h << 31) ^ (w13l >>> 8 | w13h << 24) ^ (w13l >>> 7 | w13h << 25) | 0; | |
19995 | w12l = w12l + xl | 0; | |
19996 | w12h = w12h + ((w13h >>> 1 | w13l << 31) ^ (w13h >>> 8 | w13l << 24) ^ w13h >>> 7) + (w12l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19997 | xl = (w10l >>> 19 | w10h << 13) ^ (w10l << 3 | w10h >>> 29) ^ (w10l >>> 6 | w10h << 26) | 0; | |
19998 | w12l = w12l + xl | 0; | |
19999 | w12h = w12h + ((w10h >>> 19 | w10l << 13) ^ (w10h << 3 | w10l >>> 29) ^ w10h >>> 6) + (w12l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20000 | tl = 3606008344 + w12l | 0; | |
20001 | th = 3516065817 + w12h + (tl >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
20002 | tl = tl + hl | 0; | |
20003 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20004 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20005 | tl = tl + xl | 0; | |
20006 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20007 | xl = gl ^ el & (fl ^ gl) | 0; | |
20008 | tl = tl + xl | 0; | |
20009 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20010 | hl = gl; | |
20011 | hh = gh; | |
20012 | gl = fl; | |
20013 | gh = fh; | |
20014 | fl = el; | |
20015 | fh = eh; | |
20016 | el = dl + tl | 0; | |
20017 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20018 | dl = cl; | |
20019 | dh = ch; | |
20020 | cl = bl; | |
20021 | ch = bh; | |
20022 | bl = al; | |
20023 | bh = ah; | |
20024 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20025 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20026 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20027 | al = al + xl | 0; | |
20028 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20029 | w13l = w13l + w6l | 0; | |
20030 | w13h = w13h + w6h + (w13l >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
20031 | xl = (w14l >>> 1 | w14h << 31) ^ (w14l >>> 8 | w14h << 24) ^ (w14l >>> 7 | w14h << 25) | 0; | |
20032 | w13l = w13l + xl | 0; | |
20033 | w13h = w13h + ((w14h >>> 1 | w14l << 31) ^ (w14h >>> 8 | w14l << 24) ^ w14h >>> 7) + (w13l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20034 | xl = (w11l >>> 19 | w11h << 13) ^ (w11l << 3 | w11h >>> 29) ^ (w11l >>> 6 | w11h << 26) | 0; | |
20035 | w13l = w13l + xl | 0; | |
20036 | w13h = w13h + ((w11h >>> 19 | w11l << 13) ^ (w11h << 3 | w11l >>> 29) ^ w11h >>> 6) + (w13l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20037 | tl = 1432725776 + w13l | 0; | |
20038 | th = 3600352804 + w13h + (tl >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
20039 | tl = tl + hl | 0; | |
20040 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20041 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20042 | tl = tl + xl | 0; | |
20043 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20044 | xl = gl ^ el & (fl ^ gl) | 0; | |
20045 | tl = tl + xl | 0; | |
20046 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20047 | hl = gl; | |
20048 | hh = gh; | |
20049 | gl = fl; | |
20050 | gh = fh; | |
20051 | fl = el; | |
20052 | fh = eh; | |
20053 | el = dl + tl | 0; | |
20054 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20055 | dl = cl; | |
20056 | dh = ch; | |
20057 | cl = bl; | |
20058 | ch = bh; | |
20059 | bl = al; | |
20060 | bh = ah; | |
20061 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20062 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20063 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20064 | al = al + xl | 0; | |
20065 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20066 | w14l = w14l + w7l | 0; | |
20067 | w14h = w14h + w7h + (w14l >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
20068 | xl = (w15l >>> 1 | w15h << 31) ^ (w15l >>> 8 | w15h << 24) ^ (w15l >>> 7 | w15h << 25) | 0; | |
20069 | w14l = w14l + xl | 0; | |
20070 | w14h = w14h + ((w15h >>> 1 | w15l << 31) ^ (w15h >>> 8 | w15l << 24) ^ w15h >>> 7) + (w14l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20071 | xl = (w12l >>> 19 | w12h << 13) ^ (w12l << 3 | w12h >>> 29) ^ (w12l >>> 6 | w12h << 26) | 0; | |
20072 | w14l = w14l + xl | 0; | |
20073 | w14h = w14h + ((w12h >>> 19 | w12l << 13) ^ (w12h << 3 | w12l >>> 29) ^ w12h >>> 6) + (w14l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20074 | tl = 1467031594 + w14l | 0; | |
20075 | th = 4094571909 + w14h + (tl >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
20076 | tl = tl + hl | 0; | |
20077 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20078 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20079 | tl = tl + xl | 0; | |
20080 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20081 | xl = gl ^ el & (fl ^ gl) | 0; | |
20082 | tl = tl + xl | 0; | |
20083 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20084 | hl = gl; | |
20085 | hh = gh; | |
20086 | gl = fl; | |
20087 | gh = fh; | |
20088 | fl = el; | |
20089 | fh = eh; | |
20090 | el = dl + tl | 0; | |
20091 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20092 | dl = cl; | |
20093 | dh = ch; | |
20094 | cl = bl; | |
20095 | ch = bh; | |
20096 | bl = al; | |
20097 | bh = ah; | |
20098 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20099 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20100 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20101 | al = al + xl | 0; | |
20102 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20103 | w15l = w15l + w8l | 0; | |
20104 | w15h = w15h + w8h + (w15l >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
20105 | xl = (w0l >>> 1 | w0h << 31) ^ (w0l >>> 8 | w0h << 24) ^ (w0l >>> 7 | w0h << 25) | 0; | |
20106 | w15l = w15l + xl | 0; | |
20107 | w15h = w15h + ((w0h >>> 1 | w0l << 31) ^ (w0h >>> 8 | w0l << 24) ^ w0h >>> 7) + (w15l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20108 | xl = (w13l >>> 19 | w13h << 13) ^ (w13l << 3 | w13h >>> 29) ^ (w13l >>> 6 | w13h << 26) | 0; | |
20109 | w15l = w15l + xl | 0; | |
20110 | w15h = w15h + ((w13h >>> 19 | w13l << 13) ^ (w13h << 3 | w13l >>> 29) ^ w13h >>> 6) + (w15l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20111 | tl = 851169720 + w15l | 0; | |
20112 | th = 275423344 + w15h + (tl >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
20113 | tl = tl + hl | 0; | |
20114 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20115 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20116 | tl = tl + xl | 0; | |
20117 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20118 | xl = gl ^ el & (fl ^ gl) | 0; | |
20119 | tl = tl + xl | 0; | |
20120 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20121 | hl = gl; | |
20122 | hh = gh; | |
20123 | gl = fl; | |
20124 | gh = fh; | |
20125 | fl = el; | |
20126 | fh = eh; | |
20127 | el = dl + tl | 0; | |
20128 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20129 | dl = cl; | |
20130 | dh = ch; | |
20131 | cl = bl; | |
20132 | ch = bh; | |
20133 | bl = al; | |
20134 | bh = ah; | |
20135 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20136 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20137 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20138 | al = al + xl | 0; | |
20139 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20140 | w0l = w0l + w9l | 0; | |
20141 | w0h = w0h + w9h + (w0l >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
20142 | xl = (w1l >>> 1 | w1h << 31) ^ (w1l >>> 8 | w1h << 24) ^ (w1l >>> 7 | w1h << 25) | 0; | |
20143 | w0l = w0l + xl | 0; | |
20144 | w0h = w0h + ((w1h >>> 1 | w1l << 31) ^ (w1h >>> 8 | w1l << 24) ^ w1h >>> 7) + (w0l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20145 | xl = (w14l >>> 19 | w14h << 13) ^ (w14l << 3 | w14h >>> 29) ^ (w14l >>> 6 | w14h << 26) | 0; | |
20146 | w0l = w0l + xl | 0; | |
20147 | w0h = w0h + ((w14h >>> 19 | w14l << 13) ^ (w14h << 3 | w14l >>> 29) ^ w14h >>> 6) + (w0l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20148 | tl = 3100823752 + w0l | 0; | |
20149 | th = 430227734 + w0h + (tl >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
20150 | tl = tl + hl | 0; | |
20151 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20152 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20153 | tl = tl + xl | 0; | |
20154 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20155 | xl = gl ^ el & (fl ^ gl) | 0; | |
20156 | tl = tl + xl | 0; | |
20157 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20158 | hl = gl; | |
20159 | hh = gh; | |
20160 | gl = fl; | |
20161 | gh = fh; | |
20162 | fl = el; | |
20163 | fh = eh; | |
20164 | el = dl + tl | 0; | |
20165 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20166 | dl = cl; | |
20167 | dh = ch; | |
20168 | cl = bl; | |
20169 | ch = bh; | |
20170 | bl = al; | |
20171 | bh = ah; | |
20172 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20173 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20174 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20175 | al = al + xl | 0; | |
20176 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20177 | w1l = w1l + w10l | 0; | |
20178 | w1h = w1h + w10h + (w1l >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
20179 | xl = (w2l >>> 1 | w2h << 31) ^ (w2l >>> 8 | w2h << 24) ^ (w2l >>> 7 | w2h << 25) | 0; | |
20180 | w1l = w1l + xl | 0; | |
20181 | w1h = w1h + ((w2h >>> 1 | w2l << 31) ^ (w2h >>> 8 | w2l << 24) ^ w2h >>> 7) + (w1l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20182 | xl = (w15l >>> 19 | w15h << 13) ^ (w15l << 3 | w15h >>> 29) ^ (w15l >>> 6 | w15h << 26) | 0; | |
20183 | w1l = w1l + xl | 0; | |
20184 | w1h = w1h + ((w15h >>> 19 | w15l << 13) ^ (w15h << 3 | w15l >>> 29) ^ w15h >>> 6) + (w1l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20185 | tl = 1363258195 + w1l | 0; | |
20186 | th = 506948616 + w1h + (tl >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
20187 | tl = tl + hl | 0; | |
20188 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20189 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20190 | tl = tl + xl | 0; | |
20191 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20192 | xl = gl ^ el & (fl ^ gl) | 0; | |
20193 | tl = tl + xl | 0; | |
20194 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20195 | hl = gl; | |
20196 | hh = gh; | |
20197 | gl = fl; | |
20198 | gh = fh; | |
20199 | fl = el; | |
20200 | fh = eh; | |
20201 | el = dl + tl | 0; | |
20202 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20203 | dl = cl; | |
20204 | dh = ch; | |
20205 | cl = bl; | |
20206 | ch = bh; | |
20207 | bl = al; | |
20208 | bh = ah; | |
20209 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20210 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20211 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20212 | al = al + xl | 0; | |
20213 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20214 | w2l = w2l + w11l | 0; | |
20215 | w2h = w2h + w11h + (w2l >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
20216 | xl = (w3l >>> 1 | w3h << 31) ^ (w3l >>> 8 | w3h << 24) ^ (w3l >>> 7 | w3h << 25) | 0; | |
20217 | w2l = w2l + xl | 0; | |
20218 | w2h = w2h + ((w3h >>> 1 | w3l << 31) ^ (w3h >>> 8 | w3l << 24) ^ w3h >>> 7) + (w2l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20219 | xl = (w0l >>> 19 | w0h << 13) ^ (w0l << 3 | w0h >>> 29) ^ (w0l >>> 6 | w0h << 26) | 0; | |
20220 | w2l = w2l + xl | 0; | |
20221 | w2h = w2h + ((w0h >>> 19 | w0l << 13) ^ (w0h << 3 | w0l >>> 29) ^ w0h >>> 6) + (w2l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20222 | tl = 3750685593 + w2l | 0; | |
20223 | th = 659060556 + w2h + (tl >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
20224 | tl = tl + hl | 0; | |
20225 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20226 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20227 | tl = tl + xl | 0; | |
20228 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20229 | xl = gl ^ el & (fl ^ gl) | 0; | |
20230 | tl = tl + xl | 0; | |
20231 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20232 | hl = gl; | |
20233 | hh = gh; | |
20234 | gl = fl; | |
20235 | gh = fh; | |
20236 | fl = el; | |
20237 | fh = eh; | |
20238 | el = dl + tl | 0; | |
20239 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20240 | dl = cl; | |
20241 | dh = ch; | |
20242 | cl = bl; | |
20243 | ch = bh; | |
20244 | bl = al; | |
20245 | bh = ah; | |
20246 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20247 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20248 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20249 | al = al + xl | 0; | |
20250 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20251 | w3l = w3l + w12l | 0; | |
20252 | w3h = w3h + w12h + (w3l >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
20253 | xl = (w4l >>> 1 | w4h << 31) ^ (w4l >>> 8 | w4h << 24) ^ (w4l >>> 7 | w4h << 25) | 0; | |
20254 | w3l = w3l + xl | 0; | |
20255 | w3h = w3h + ((w4h >>> 1 | w4l << 31) ^ (w4h >>> 8 | w4l << 24) ^ w4h >>> 7) + (w3l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20256 | xl = (w1l >>> 19 | w1h << 13) ^ (w1l << 3 | w1h >>> 29) ^ (w1l >>> 6 | w1h << 26) | 0; | |
20257 | w3l = w3l + xl | 0; | |
20258 | w3h = w3h + ((w1h >>> 19 | w1l << 13) ^ (w1h << 3 | w1l >>> 29) ^ w1h >>> 6) + (w3l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20259 | tl = 3785050280 + w3l | 0; | |
20260 | th = 883997877 + w3h + (tl >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
20261 | tl = tl + hl | 0; | |
20262 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20263 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20264 | tl = tl + xl | 0; | |
20265 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20266 | xl = gl ^ el & (fl ^ gl) | 0; | |
20267 | tl = tl + xl | 0; | |
20268 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20269 | hl = gl; | |
20270 | hh = gh; | |
20271 | gl = fl; | |
20272 | gh = fh; | |
20273 | fl = el; | |
20274 | fh = eh; | |
20275 | el = dl + tl | 0; | |
20276 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20277 | dl = cl; | |
20278 | dh = ch; | |
20279 | cl = bl; | |
20280 | ch = bh; | |
20281 | bl = al; | |
20282 | bh = ah; | |
20283 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20284 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20285 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20286 | al = al + xl | 0; | |
20287 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20288 | w4l = w4l + w13l | 0; | |
20289 | w4h = w4h + w13h + (w4l >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
20290 | xl = (w5l >>> 1 | w5h << 31) ^ (w5l >>> 8 | w5h << 24) ^ (w5l >>> 7 | w5h << 25) | 0; | |
20291 | w4l = w4l + xl | 0; | |
20292 | w4h = w4h + ((w5h >>> 1 | w5l << 31) ^ (w5h >>> 8 | w5l << 24) ^ w5h >>> 7) + (w4l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20293 | xl = (w2l >>> 19 | w2h << 13) ^ (w2l << 3 | w2h >>> 29) ^ (w2l >>> 6 | w2h << 26) | 0; | |
20294 | w4l = w4l + xl | 0; | |
20295 | w4h = w4h + ((w2h >>> 19 | w2l << 13) ^ (w2h << 3 | w2l >>> 29) ^ w2h >>> 6) + (w4l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20296 | tl = 3318307427 + w4l | 0; | |
20297 | th = 958139571 + w4h + (tl >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
20298 | tl = tl + hl | 0; | |
20299 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20300 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20301 | tl = tl + xl | 0; | |
20302 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20303 | xl = gl ^ el & (fl ^ gl) | 0; | |
20304 | tl = tl + xl | 0; | |
20305 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20306 | hl = gl; | |
20307 | hh = gh; | |
20308 | gl = fl; | |
20309 | gh = fh; | |
20310 | fl = el; | |
20311 | fh = eh; | |
20312 | el = dl + tl | 0; | |
20313 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20314 | dl = cl; | |
20315 | dh = ch; | |
20316 | cl = bl; | |
20317 | ch = bh; | |
20318 | bl = al; | |
20319 | bh = ah; | |
20320 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20321 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20322 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20323 | al = al + xl | 0; | |
20324 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20325 | w5l = w5l + w14l | 0; | |
20326 | w5h = w5h + w14h + (w5l >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
20327 | xl = (w6l >>> 1 | w6h << 31) ^ (w6l >>> 8 | w6h << 24) ^ (w6l >>> 7 | w6h << 25) | 0; | |
20328 | w5l = w5l + xl | 0; | |
20329 | w5h = w5h + ((w6h >>> 1 | w6l << 31) ^ (w6h >>> 8 | w6l << 24) ^ w6h >>> 7) + (w5l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20330 | xl = (w3l >>> 19 | w3h << 13) ^ (w3l << 3 | w3h >>> 29) ^ (w3l >>> 6 | w3h << 26) | 0; | |
20331 | w5l = w5l + xl | 0; | |
20332 | w5h = w5h + ((w3h >>> 19 | w3l << 13) ^ (w3h << 3 | w3l >>> 29) ^ w3h >>> 6) + (w5l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20333 | tl = 3812723403 + w5l | 0; | |
20334 | th = 1322822218 + w5h + (tl >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
20335 | tl = tl + hl | 0; | |
20336 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20337 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20338 | tl = tl + xl | 0; | |
20339 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20340 | xl = gl ^ el & (fl ^ gl) | 0; | |
20341 | tl = tl + xl | 0; | |
20342 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20343 | hl = gl; | |
20344 | hh = gh; | |
20345 | gl = fl; | |
20346 | gh = fh; | |
20347 | fl = el; | |
20348 | fh = eh; | |
20349 | el = dl + tl | 0; | |
20350 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20351 | dl = cl; | |
20352 | dh = ch; | |
20353 | cl = bl; | |
20354 | ch = bh; | |
20355 | bl = al; | |
20356 | bh = ah; | |
20357 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20358 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20359 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20360 | al = al + xl | 0; | |
20361 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20362 | w6l = w6l + w15l | 0; | |
20363 | w6h = w6h + w15h + (w6l >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
20364 | xl = (w7l >>> 1 | w7h << 31) ^ (w7l >>> 8 | w7h << 24) ^ (w7l >>> 7 | w7h << 25) | 0; | |
20365 | w6l = w6l + xl | 0; | |
20366 | w6h = w6h + ((w7h >>> 1 | w7l << 31) ^ (w7h >>> 8 | w7l << 24) ^ w7h >>> 7) + (w6l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20367 | xl = (w4l >>> 19 | w4h << 13) ^ (w4l << 3 | w4h >>> 29) ^ (w4l >>> 6 | w4h << 26) | 0; | |
20368 | w6l = w6l + xl | 0; | |
20369 | w6h = w6h + ((w4h >>> 19 | w4l << 13) ^ (w4h << 3 | w4l >>> 29) ^ w4h >>> 6) + (w6l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20370 | tl = 2003034995 + w6l | 0; | |
20371 | th = 1537002063 + w6h + (tl >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
20372 | tl = tl + hl | 0; | |
20373 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20374 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20375 | tl = tl + xl | 0; | |
20376 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20377 | xl = gl ^ el & (fl ^ gl) | 0; | |
20378 | tl = tl + xl | 0; | |
20379 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20380 | hl = gl; | |
20381 | hh = gh; | |
20382 | gl = fl; | |
20383 | gh = fh; | |
20384 | fl = el; | |
20385 | fh = eh; | |
20386 | el = dl + tl | 0; | |
20387 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20388 | dl = cl; | |
20389 | dh = ch; | |
20390 | cl = bl; | |
20391 | ch = bh; | |
20392 | bl = al; | |
20393 | bh = ah; | |
20394 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20395 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20396 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20397 | al = al + xl | 0; | |
20398 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20399 | w7l = w7l + w0l | 0; | |
20400 | w7h = w7h + w0h + (w7l >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
20401 | xl = (w8l >>> 1 | w8h << 31) ^ (w8l >>> 8 | w8h << 24) ^ (w8l >>> 7 | w8h << 25) | 0; | |
20402 | w7l = w7l + xl | 0; | |
20403 | w7h = w7h + ((w8h >>> 1 | w8l << 31) ^ (w8h >>> 8 | w8l << 24) ^ w8h >>> 7) + (w7l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20404 | xl = (w5l >>> 19 | w5h << 13) ^ (w5l << 3 | w5h >>> 29) ^ (w5l >>> 6 | w5h << 26) | 0; | |
20405 | w7l = w7l + xl | 0; | |
20406 | w7h = w7h + ((w5h >>> 19 | w5l << 13) ^ (w5h << 3 | w5l >>> 29) ^ w5h >>> 6) + (w7l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20407 | tl = 3602036899 + w7l | 0; | |
20408 | th = 1747873779 + w7h + (tl >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
20409 | tl = tl + hl | 0; | |
20410 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20411 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20412 | tl = tl + xl | 0; | |
20413 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20414 | xl = gl ^ el & (fl ^ gl) | 0; | |
20415 | tl = tl + xl | 0; | |
20416 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20417 | hl = gl; | |
20418 | hh = gh; | |
20419 | gl = fl; | |
20420 | gh = fh; | |
20421 | fl = el; | |
20422 | fh = eh; | |
20423 | el = dl + tl | 0; | |
20424 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20425 | dl = cl; | |
20426 | dh = ch; | |
20427 | cl = bl; | |
20428 | ch = bh; | |
20429 | bl = al; | |
20430 | bh = ah; | |
20431 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20432 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20433 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20434 | al = al + xl | 0; | |
20435 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20436 | w8l = w8l + w1l | 0; | |
20437 | w8h = w8h + w1h + (w8l >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
20438 | xl = (w9l >>> 1 | w9h << 31) ^ (w9l >>> 8 | w9h << 24) ^ (w9l >>> 7 | w9h << 25) | 0; | |
20439 | w8l = w8l + xl | 0; | |
20440 | w8h = w8h + ((w9h >>> 1 | w9l << 31) ^ (w9h >>> 8 | w9l << 24) ^ w9h >>> 7) + (w8l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20441 | xl = (w6l >>> 19 | w6h << 13) ^ (w6l << 3 | w6h >>> 29) ^ (w6l >>> 6 | w6h << 26) | 0; | |
20442 | w8l = w8l + xl | 0; | |
20443 | w8h = w8h + ((w6h >>> 19 | w6l << 13) ^ (w6h << 3 | w6l >>> 29) ^ w6h >>> 6) + (w8l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20444 | tl = 1575990012 + w8l | 0; | |
20445 | th = 1955562222 + w8h + (tl >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
20446 | tl = tl + hl | 0; | |
20447 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20448 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20449 | tl = tl + xl | 0; | |
20450 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20451 | xl = gl ^ el & (fl ^ gl) | 0; | |
20452 | tl = tl + xl | 0; | |
20453 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20454 | hl = gl; | |
20455 | hh = gh; | |
20456 | gl = fl; | |
20457 | gh = fh; | |
20458 | fl = el; | |
20459 | fh = eh; | |
20460 | el = dl + tl | 0; | |
20461 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20462 | dl = cl; | |
20463 | dh = ch; | |
20464 | cl = bl; | |
20465 | ch = bh; | |
20466 | bl = al; | |
20467 | bh = ah; | |
20468 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20469 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20470 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20471 | al = al + xl | 0; | |
20472 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20473 | w9l = w9l + w2l | 0; | |
20474 | w9h = w9h + w2h + (w9l >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
20475 | xl = (w10l >>> 1 | w10h << 31) ^ (w10l >>> 8 | w10h << 24) ^ (w10l >>> 7 | w10h << 25) | 0; | |
20476 | w9l = w9l + xl | 0; | |
20477 | w9h = w9h + ((w10h >>> 1 | w10l << 31) ^ (w10h >>> 8 | w10l << 24) ^ w10h >>> 7) + (w9l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20478 | xl = (w7l >>> 19 | w7h << 13) ^ (w7l << 3 | w7h >>> 29) ^ (w7l >>> 6 | w7h << 26) | 0; | |
20479 | w9l = w9l + xl | 0; | |
20480 | w9h = w9h + ((w7h >>> 19 | w7l << 13) ^ (w7h << 3 | w7l >>> 29) ^ w7h >>> 6) + (w9l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20481 | tl = 1125592928 + w9l | 0; | |
20482 | th = 2024104815 + w9h + (tl >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
20483 | tl = tl + hl | 0; | |
20484 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20485 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20486 | tl = tl + xl | 0; | |
20487 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20488 | xl = gl ^ el & (fl ^ gl) | 0; | |
20489 | tl = tl + xl | 0; | |
20490 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20491 | hl = gl; | |
20492 | hh = gh; | |
20493 | gl = fl; | |
20494 | gh = fh; | |
20495 | fl = el; | |
20496 | fh = eh; | |
20497 | el = dl + tl | 0; | |
20498 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20499 | dl = cl; | |
20500 | dh = ch; | |
20501 | cl = bl; | |
20502 | ch = bh; | |
20503 | bl = al; | |
20504 | bh = ah; | |
20505 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20506 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20507 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20508 | al = al + xl | 0; | |
20509 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20510 | w10l = w10l + w3l | 0; | |
20511 | w10h = w10h + w3h + (w10l >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
20512 | xl = (w11l >>> 1 | w11h << 31) ^ (w11l >>> 8 | w11h << 24) ^ (w11l >>> 7 | w11h << 25) | 0; | |
20513 | w10l = w10l + xl | 0; | |
20514 | w10h = w10h + ((w11h >>> 1 | w11l << 31) ^ (w11h >>> 8 | w11l << 24) ^ w11h >>> 7) + (w10l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20515 | xl = (w8l >>> 19 | w8h << 13) ^ (w8l << 3 | w8h >>> 29) ^ (w8l >>> 6 | w8h << 26) | 0; | |
20516 | w10l = w10l + xl | 0; | |
20517 | w10h = w10h + ((w8h >>> 19 | w8l << 13) ^ (w8h << 3 | w8l >>> 29) ^ w8h >>> 6) + (w10l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20518 | tl = 2716904306 + w10l | 0; | |
20519 | th = 2227730452 + w10h + (tl >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
20520 | tl = tl + hl | 0; | |
20521 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20522 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20523 | tl = tl + xl | 0; | |
20524 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20525 | xl = gl ^ el & (fl ^ gl) | 0; | |
20526 | tl = tl + xl | 0; | |
20527 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20528 | hl = gl; | |
20529 | hh = gh; | |
20530 | gl = fl; | |
20531 | gh = fh; | |
20532 | fl = el; | |
20533 | fh = eh; | |
20534 | el = dl + tl | 0; | |
20535 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20536 | dl = cl; | |
20537 | dh = ch; | |
20538 | cl = bl; | |
20539 | ch = bh; | |
20540 | bl = al; | |
20541 | bh = ah; | |
20542 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20543 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20544 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20545 | al = al + xl | 0; | |
20546 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20547 | w11l = w11l + w4l | 0; | |
20548 | w11h = w11h + w4h + (w11l >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
20549 | xl = (w12l >>> 1 | w12h << 31) ^ (w12l >>> 8 | w12h << 24) ^ (w12l >>> 7 | w12h << 25) | 0; | |
20550 | w11l = w11l + xl | 0; | |
20551 | w11h = w11h + ((w12h >>> 1 | w12l << 31) ^ (w12h >>> 8 | w12l << 24) ^ w12h >>> 7) + (w11l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20552 | xl = (w9l >>> 19 | w9h << 13) ^ (w9l << 3 | w9h >>> 29) ^ (w9l >>> 6 | w9h << 26) | 0; | |
20553 | w11l = w11l + xl | 0; | |
20554 | w11h = w11h + ((w9h >>> 19 | w9l << 13) ^ (w9h << 3 | w9l >>> 29) ^ w9h >>> 6) + (w11l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20555 | tl = 442776044 + w11l | 0; | |
20556 | th = 2361852424 + w11h + (tl >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
20557 | tl = tl + hl | 0; | |
20558 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20559 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20560 | tl = tl + xl | 0; | |
20561 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20562 | xl = gl ^ el & (fl ^ gl) | 0; | |
20563 | tl = tl + xl | 0; | |
20564 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20565 | hl = gl; | |
20566 | hh = gh; | |
20567 | gl = fl; | |
20568 | gh = fh; | |
20569 | fl = el; | |
20570 | fh = eh; | |
20571 | el = dl + tl | 0; | |
20572 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20573 | dl = cl; | |
20574 | dh = ch; | |
20575 | cl = bl; | |
20576 | ch = bh; | |
20577 | bl = al; | |
20578 | bh = ah; | |
20579 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20580 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20581 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20582 | al = al + xl | 0; | |
20583 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20584 | w12l = w12l + w5l | 0; | |
20585 | w12h = w12h + w5h + (w12l >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
20586 | xl = (w13l >>> 1 | w13h << 31) ^ (w13l >>> 8 | w13h << 24) ^ (w13l >>> 7 | w13h << 25) | 0; | |
20587 | w12l = w12l + xl | 0; | |
20588 | w12h = w12h + ((w13h >>> 1 | w13l << 31) ^ (w13h >>> 8 | w13l << 24) ^ w13h >>> 7) + (w12l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20589 | xl = (w10l >>> 19 | w10h << 13) ^ (w10l << 3 | w10h >>> 29) ^ (w10l >>> 6 | w10h << 26) | 0; | |
20590 | w12l = w12l + xl | 0; | |
20591 | w12h = w12h + ((w10h >>> 19 | w10l << 13) ^ (w10h << 3 | w10l >>> 29) ^ w10h >>> 6) + (w12l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20592 | tl = 593698344 + w12l | 0; | |
20593 | th = 2428436474 + w12h + (tl >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
20594 | tl = tl + hl | 0; | |
20595 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20596 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20597 | tl = tl + xl | 0; | |
20598 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20599 | xl = gl ^ el & (fl ^ gl) | 0; | |
20600 | tl = tl + xl | 0; | |
20601 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20602 | hl = gl; | |
20603 | hh = gh; | |
20604 | gl = fl; | |
20605 | gh = fh; | |
20606 | fl = el; | |
20607 | fh = eh; | |
20608 | el = dl + tl | 0; | |
20609 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20610 | dl = cl; | |
20611 | dh = ch; | |
20612 | cl = bl; | |
20613 | ch = bh; | |
20614 | bl = al; | |
20615 | bh = ah; | |
20616 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20617 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20618 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20619 | al = al + xl | 0; | |
20620 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20621 | w13l = w13l + w6l | 0; | |
20622 | w13h = w13h + w6h + (w13l >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
20623 | xl = (w14l >>> 1 | w14h << 31) ^ (w14l >>> 8 | w14h << 24) ^ (w14l >>> 7 | w14h << 25) | 0; | |
20624 | w13l = w13l + xl | 0; | |
20625 | w13h = w13h + ((w14h >>> 1 | w14l << 31) ^ (w14h >>> 8 | w14l << 24) ^ w14h >>> 7) + (w13l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20626 | xl = (w11l >>> 19 | w11h << 13) ^ (w11l << 3 | w11h >>> 29) ^ (w11l >>> 6 | w11h << 26) | 0; | |
20627 | w13l = w13l + xl | 0; | |
20628 | w13h = w13h + ((w11h >>> 19 | w11l << 13) ^ (w11h << 3 | w11l >>> 29) ^ w11h >>> 6) + (w13l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20629 | tl = 3733110249 + w13l | 0; | |
20630 | th = 2756734187 + w13h + (tl >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
20631 | tl = tl + hl | 0; | |
20632 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20633 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20634 | tl = tl + xl | 0; | |
20635 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20636 | xl = gl ^ el & (fl ^ gl) | 0; | |
20637 | tl = tl + xl | 0; | |
20638 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20639 | hl = gl; | |
20640 | hh = gh; | |
20641 | gl = fl; | |
20642 | gh = fh; | |
20643 | fl = el; | |
20644 | fh = eh; | |
20645 | el = dl + tl | 0; | |
20646 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20647 | dl = cl; | |
20648 | dh = ch; | |
20649 | cl = bl; | |
20650 | ch = bh; | |
20651 | bl = al; | |
20652 | bh = ah; | |
20653 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20654 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20655 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20656 | al = al + xl | 0; | |
20657 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20658 | w14l = w14l + w7l | 0; | |
20659 | w14h = w14h + w7h + (w14l >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
20660 | xl = (w15l >>> 1 | w15h << 31) ^ (w15l >>> 8 | w15h << 24) ^ (w15l >>> 7 | w15h << 25) | 0; | |
20661 | w14l = w14l + xl | 0; | |
20662 | w14h = w14h + ((w15h >>> 1 | w15l << 31) ^ (w15h >>> 8 | w15l << 24) ^ w15h >>> 7) + (w14l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20663 | xl = (w12l >>> 19 | w12h << 13) ^ (w12l << 3 | w12h >>> 29) ^ (w12l >>> 6 | w12h << 26) | 0; | |
20664 | w14l = w14l + xl | 0; | |
20665 | w14h = w14h + ((w12h >>> 19 | w12l << 13) ^ (w12h << 3 | w12l >>> 29) ^ w12h >>> 6) + (w14l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20666 | tl = 2999351573 + w14l | 0; | |
20667 | th = 3204031479 + w14h + (tl >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
20668 | tl = tl + hl | 0; | |
20669 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20670 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20671 | tl = tl + xl | 0; | |
20672 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20673 | xl = gl ^ el & (fl ^ gl) | 0; | |
20674 | tl = tl + xl | 0; | |
20675 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20676 | hl = gl; | |
20677 | hh = gh; | |
20678 | gl = fl; | |
20679 | gh = fh; | |
20680 | fl = el; | |
20681 | fh = eh; | |
20682 | el = dl + tl | 0; | |
20683 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20684 | dl = cl; | |
20685 | dh = ch; | |
20686 | cl = bl; | |
20687 | ch = bh; | |
20688 | bl = al; | |
20689 | bh = ah; | |
20690 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20691 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20692 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20693 | al = al + xl | 0; | |
20694 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20695 | w15l = w15l + w8l | 0; | |
20696 | w15h = w15h + w8h + (w15l >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
20697 | xl = (w0l >>> 1 | w0h << 31) ^ (w0l >>> 8 | w0h << 24) ^ (w0l >>> 7 | w0h << 25) | 0; | |
20698 | w15l = w15l + xl | 0; | |
20699 | w15h = w15h + ((w0h >>> 1 | w0l << 31) ^ (w0h >>> 8 | w0l << 24) ^ w0h >>> 7) + (w15l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20700 | xl = (w13l >>> 19 | w13h << 13) ^ (w13l << 3 | w13h >>> 29) ^ (w13l >>> 6 | w13h << 26) | 0; | |
20701 | w15l = w15l + xl | 0; | |
20702 | w15h = w15h + ((w13h >>> 19 | w13l << 13) ^ (w13h << 3 | w13l >>> 29) ^ w13h >>> 6) + (w15l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20703 | tl = 3815920427 + w15l | 0; | |
20704 | th = 3329325298 + w15h + (tl >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
20705 | tl = tl + hl | 0; | |
20706 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20707 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20708 | tl = tl + xl | 0; | |
20709 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20710 | xl = gl ^ el & (fl ^ gl) | 0; | |
20711 | tl = tl + xl | 0; | |
20712 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20713 | hl = gl; | |
20714 | hh = gh; | |
20715 | gl = fl; | |
20716 | gh = fh; | |
20717 | fl = el; | |
20718 | fh = eh; | |
20719 | el = dl + tl | 0; | |
20720 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20721 | dl = cl; | |
20722 | dh = ch; | |
20723 | cl = bl; | |
20724 | ch = bh; | |
20725 | bl = al; | |
20726 | bh = ah; | |
20727 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20728 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20729 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20730 | al = al + xl | 0; | |
20731 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20732 | w0l = w0l + w9l | 0; | |
20733 | w0h = w0h + w9h + (w0l >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
20734 | xl = (w1l >>> 1 | w1h << 31) ^ (w1l >>> 8 | w1h << 24) ^ (w1l >>> 7 | w1h << 25) | 0; | |
20735 | w0l = w0l + xl | 0; | |
20736 | w0h = w0h + ((w1h >>> 1 | w1l << 31) ^ (w1h >>> 8 | w1l << 24) ^ w1h >>> 7) + (w0l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20737 | xl = (w14l >>> 19 | w14h << 13) ^ (w14l << 3 | w14h >>> 29) ^ (w14l >>> 6 | w14h << 26) | 0; | |
20738 | w0l = w0l + xl | 0; | |
20739 | w0h = w0h + ((w14h >>> 19 | w14l << 13) ^ (w14h << 3 | w14l >>> 29) ^ w14h >>> 6) + (w0l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20740 | tl = 3928383900 + w0l | 0; | |
20741 | th = 3391569614 + w0h + (tl >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
20742 | tl = tl + hl | 0; | |
20743 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20744 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20745 | tl = tl + xl | 0; | |
20746 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20747 | xl = gl ^ el & (fl ^ gl) | 0; | |
20748 | tl = tl + xl | 0; | |
20749 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20750 | hl = gl; | |
20751 | hh = gh; | |
20752 | gl = fl; | |
20753 | gh = fh; | |
20754 | fl = el; | |
20755 | fh = eh; | |
20756 | el = dl + tl | 0; | |
20757 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20758 | dl = cl; | |
20759 | dh = ch; | |
20760 | cl = bl; | |
20761 | ch = bh; | |
20762 | bl = al; | |
20763 | bh = ah; | |
20764 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20765 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20766 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20767 | al = al + xl | 0; | |
20768 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20769 | w1l = w1l + w10l | 0; | |
20770 | w1h = w1h + w10h + (w1l >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
20771 | xl = (w2l >>> 1 | w2h << 31) ^ (w2l >>> 8 | w2h << 24) ^ (w2l >>> 7 | w2h << 25) | 0; | |
20772 | w1l = w1l + xl | 0; | |
20773 | w1h = w1h + ((w2h >>> 1 | w2l << 31) ^ (w2h >>> 8 | w2l << 24) ^ w2h >>> 7) + (w1l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20774 | xl = (w15l >>> 19 | w15h << 13) ^ (w15l << 3 | w15h >>> 29) ^ (w15l >>> 6 | w15h << 26) | 0; | |
20775 | w1l = w1l + xl | 0; | |
20776 | w1h = w1h + ((w15h >>> 19 | w15l << 13) ^ (w15h << 3 | w15l >>> 29) ^ w15h >>> 6) + (w1l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20777 | tl = 566280711 + w1l | 0; | |
20778 | th = 3515267271 + w1h + (tl >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
20779 | tl = tl + hl | 0; | |
20780 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20781 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20782 | tl = tl + xl | 0; | |
20783 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20784 | xl = gl ^ el & (fl ^ gl) | 0; | |
20785 | tl = tl + xl | 0; | |
20786 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20787 | hl = gl; | |
20788 | hh = gh; | |
20789 | gl = fl; | |
20790 | gh = fh; | |
20791 | fl = el; | |
20792 | fh = eh; | |
20793 | el = dl + tl | 0; | |
20794 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20795 | dl = cl; | |
20796 | dh = ch; | |
20797 | cl = bl; | |
20798 | ch = bh; | |
20799 | bl = al; | |
20800 | bh = ah; | |
20801 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20802 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20803 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20804 | al = al + xl | 0; | |
20805 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20806 | w2l = w2l + w11l | 0; | |
20807 | w2h = w2h + w11h + (w2l >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
20808 | xl = (w3l >>> 1 | w3h << 31) ^ (w3l >>> 8 | w3h << 24) ^ (w3l >>> 7 | w3h << 25) | 0; | |
20809 | w2l = w2l + xl | 0; | |
20810 | w2h = w2h + ((w3h >>> 1 | w3l << 31) ^ (w3h >>> 8 | w3l << 24) ^ w3h >>> 7) + (w2l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20811 | xl = (w0l >>> 19 | w0h << 13) ^ (w0l << 3 | w0h >>> 29) ^ (w0l >>> 6 | w0h << 26) | 0; | |
20812 | w2l = w2l + xl | 0; | |
20813 | w2h = w2h + ((w0h >>> 19 | w0l << 13) ^ (w0h << 3 | w0l >>> 29) ^ w0h >>> 6) + (w2l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20814 | tl = 3454069534 + w2l | 0; | |
20815 | th = 3940187606 + w2h + (tl >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
20816 | tl = tl + hl | 0; | |
20817 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20818 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20819 | tl = tl + xl | 0; | |
20820 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20821 | xl = gl ^ el & (fl ^ gl) | 0; | |
20822 | tl = tl + xl | 0; | |
20823 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20824 | hl = gl; | |
20825 | hh = gh; | |
20826 | gl = fl; | |
20827 | gh = fh; | |
20828 | fl = el; | |
20829 | fh = eh; | |
20830 | el = dl + tl | 0; | |
20831 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20832 | dl = cl; | |
20833 | dh = ch; | |
20834 | cl = bl; | |
20835 | ch = bh; | |
20836 | bl = al; | |
20837 | bh = ah; | |
20838 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20839 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20840 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20841 | al = al + xl | 0; | |
20842 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20843 | w3l = w3l + w12l | 0; | |
20844 | w3h = w3h + w12h + (w3l >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
20845 | xl = (w4l >>> 1 | w4h << 31) ^ (w4l >>> 8 | w4h << 24) ^ (w4l >>> 7 | w4h << 25) | 0; | |
20846 | w3l = w3l + xl | 0; | |
20847 | w3h = w3h + ((w4h >>> 1 | w4l << 31) ^ (w4h >>> 8 | w4l << 24) ^ w4h >>> 7) + (w3l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20848 | xl = (w1l >>> 19 | w1h << 13) ^ (w1l << 3 | w1h >>> 29) ^ (w1l >>> 6 | w1h << 26) | 0; | |
20849 | w3l = w3l + xl | 0; | |
20850 | w3h = w3h + ((w1h >>> 19 | w1l << 13) ^ (w1h << 3 | w1l >>> 29) ^ w1h >>> 6) + (w3l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20851 | tl = 4000239992 + w3l | 0; | |
20852 | th = 4118630271 + w3h + (tl >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
20853 | tl = tl + hl | 0; | |
20854 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20855 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20856 | tl = tl + xl | 0; | |
20857 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20858 | xl = gl ^ el & (fl ^ gl) | 0; | |
20859 | tl = tl + xl | 0; | |
20860 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20861 | hl = gl; | |
20862 | hh = gh; | |
20863 | gl = fl; | |
20864 | gh = fh; | |
20865 | fl = el; | |
20866 | fh = eh; | |
20867 | el = dl + tl | 0; | |
20868 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20869 | dl = cl; | |
20870 | dh = ch; | |
20871 | cl = bl; | |
20872 | ch = bh; | |
20873 | bl = al; | |
20874 | bh = ah; | |
20875 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20876 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20877 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20878 | al = al + xl | 0; | |
20879 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20880 | w4l = w4l + w13l | 0; | |
20881 | w4h = w4h + w13h + (w4l >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
20882 | xl = (w5l >>> 1 | w5h << 31) ^ (w5l >>> 8 | w5h << 24) ^ (w5l >>> 7 | w5h << 25) | 0; | |
20883 | w4l = w4l + xl | 0; | |
20884 | w4h = w4h + ((w5h >>> 1 | w5l << 31) ^ (w5h >>> 8 | w5l << 24) ^ w5h >>> 7) + (w4l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20885 | xl = (w2l >>> 19 | w2h << 13) ^ (w2l << 3 | w2h >>> 29) ^ (w2l >>> 6 | w2h << 26) | 0; | |
20886 | w4l = w4l + xl | 0; | |
20887 | w4h = w4h + ((w2h >>> 19 | w2l << 13) ^ (w2h << 3 | w2l >>> 29) ^ w2h >>> 6) + (w4l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20888 | tl = 1914138554 + w4l | 0; | |
20889 | th = 116418474 + w4h + (tl >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
20890 | tl = tl + hl | 0; | |
20891 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20892 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20893 | tl = tl + xl | 0; | |
20894 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20895 | xl = gl ^ el & (fl ^ gl) | 0; | |
20896 | tl = tl + xl | 0; | |
20897 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20898 | hl = gl; | |
20899 | hh = gh; | |
20900 | gl = fl; | |
20901 | gh = fh; | |
20902 | fl = el; | |
20903 | fh = eh; | |
20904 | el = dl + tl | 0; | |
20905 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20906 | dl = cl; | |
20907 | dh = ch; | |
20908 | cl = bl; | |
20909 | ch = bh; | |
20910 | bl = al; | |
20911 | bh = ah; | |
20912 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20913 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20914 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20915 | al = al + xl | 0; | |
20916 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20917 | w5l = w5l + w14l | 0; | |
20918 | w5h = w5h + w14h + (w5l >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
20919 | xl = (w6l >>> 1 | w6h << 31) ^ (w6l >>> 8 | w6h << 24) ^ (w6l >>> 7 | w6h << 25) | 0; | |
20920 | w5l = w5l + xl | 0; | |
20921 | w5h = w5h + ((w6h >>> 1 | w6l << 31) ^ (w6h >>> 8 | w6l << 24) ^ w6h >>> 7) + (w5l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20922 | xl = (w3l >>> 19 | w3h << 13) ^ (w3l << 3 | w3h >>> 29) ^ (w3l >>> 6 | w3h << 26) | 0; | |
20923 | w5l = w5l + xl | 0; | |
20924 | w5h = w5h + ((w3h >>> 19 | w3l << 13) ^ (w3h << 3 | w3l >>> 29) ^ w3h >>> 6) + (w5l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20925 | tl = 2731055270 + w5l | 0; | |
20926 | th = 174292421 + w5h + (tl >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
20927 | tl = tl + hl | 0; | |
20928 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20929 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20930 | tl = tl + xl | 0; | |
20931 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20932 | xl = gl ^ el & (fl ^ gl) | 0; | |
20933 | tl = tl + xl | 0; | |
20934 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20935 | hl = gl; | |
20936 | hh = gh; | |
20937 | gl = fl; | |
20938 | gh = fh; | |
20939 | fl = el; | |
20940 | fh = eh; | |
20941 | el = dl + tl | 0; | |
20942 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20943 | dl = cl; | |
20944 | dh = ch; | |
20945 | cl = bl; | |
20946 | ch = bh; | |
20947 | bl = al; | |
20948 | bh = ah; | |
20949 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20950 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20951 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20952 | al = al + xl | 0; | |
20953 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20954 | w6l = w6l + w15l | 0; | |
20955 | w6h = w6h + w15h + (w6l >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
20956 | xl = (w7l >>> 1 | w7h << 31) ^ (w7l >>> 8 | w7h << 24) ^ (w7l >>> 7 | w7h << 25) | 0; | |
20957 | w6l = w6l + xl | 0; | |
20958 | w6h = w6h + ((w7h >>> 1 | w7l << 31) ^ (w7h >>> 8 | w7l << 24) ^ w7h >>> 7) + (w6l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20959 | xl = (w4l >>> 19 | w4h << 13) ^ (w4l << 3 | w4h >>> 29) ^ (w4l >>> 6 | w4h << 26) | 0; | |
20960 | w6l = w6l + xl | 0; | |
20961 | w6h = w6h + ((w4h >>> 19 | w4l << 13) ^ (w4h << 3 | w4l >>> 29) ^ w4h >>> 6) + (w6l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20962 | tl = 3203993006 + w6l | 0; | |
20963 | th = 289380356 + w6h + (tl >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
20964 | tl = tl + hl | 0; | |
20965 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20966 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20967 | tl = tl + xl | 0; | |
20968 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20969 | xl = gl ^ el & (fl ^ gl) | 0; | |
20970 | tl = tl + xl | 0; | |
20971 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20972 | hl = gl; | |
20973 | hh = gh; | |
20974 | gl = fl; | |
20975 | gh = fh; | |
20976 | fl = el; | |
20977 | fh = eh; | |
20978 | el = dl + tl | 0; | |
20979 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20980 | dl = cl; | |
20981 | dh = ch; | |
20982 | cl = bl; | |
20983 | ch = bh; | |
20984 | bl = al; | |
20985 | bh = ah; | |
20986 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20987 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20988 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20989 | al = al + xl | 0; | |
20990 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20991 | w7l = w7l + w0l | 0; | |
20992 | w7h = w7h + w0h + (w7l >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
20993 | xl = (w8l >>> 1 | w8h << 31) ^ (w8l >>> 8 | w8h << 24) ^ (w8l >>> 7 | w8h << 25) | 0; | |
20994 | w7l = w7l + xl | 0; | |
20995 | w7h = w7h + ((w8h >>> 1 | w8l << 31) ^ (w8h >>> 8 | w8l << 24) ^ w8h >>> 7) + (w7l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20996 | xl = (w5l >>> 19 | w5h << 13) ^ (w5l << 3 | w5h >>> 29) ^ (w5l >>> 6 | w5h << 26) | 0; | |
20997 | w7l = w7l + xl | 0; | |
20998 | w7h = w7h + ((w5h >>> 19 | w5l << 13) ^ (w5h << 3 | w5l >>> 29) ^ w5h >>> 6) + (w7l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20999 | tl = 320620315 + w7l | 0; | |
21000 | th = 460393269 + w7h + (tl >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
21001 | tl = tl + hl | 0; | |
21002 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21003 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
21004 | tl = tl + xl | 0; | |
21005 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21006 | xl = gl ^ el & (fl ^ gl) | 0; | |
21007 | tl = tl + xl | 0; | |
21008 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21009 | hl = gl; | |
21010 | hh = gh; | |
21011 | gl = fl; | |
21012 | gh = fh; | |
21013 | fl = el; | |
21014 | fh = eh; | |
21015 | el = dl + tl | 0; | |
21016 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21017 | dl = cl; | |
21018 | dh = ch; | |
21019 | cl = bl; | |
21020 | ch = bh; | |
21021 | bl = al; | |
21022 | bh = ah; | |
21023 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
21024 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
21025 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
21026 | al = al + xl | 0; | |
21027 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21028 | w8l = w8l + w1l | 0; | |
21029 | w8h = w8h + w1h + (w8l >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
21030 | xl = (w9l >>> 1 | w9h << 31) ^ (w9l >>> 8 | w9h << 24) ^ (w9l >>> 7 | w9h << 25) | 0; | |
21031 | w8l = w8l + xl | 0; | |
21032 | w8h = w8h + ((w9h >>> 1 | w9l << 31) ^ (w9h >>> 8 | w9l << 24) ^ w9h >>> 7) + (w8l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21033 | xl = (w6l >>> 19 | w6h << 13) ^ (w6l << 3 | w6h >>> 29) ^ (w6l >>> 6 | w6h << 26) | 0; | |
21034 | w8l = w8l + xl | 0; | |
21035 | w8h = w8h + ((w6h >>> 19 | w6l << 13) ^ (w6h << 3 | w6l >>> 29) ^ w6h >>> 6) + (w8l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21036 | tl = 587496836 + w8l | 0; | |
21037 | th = 685471733 + w8h + (tl >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
21038 | tl = tl + hl | 0; | |
21039 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21040 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
21041 | tl = tl + xl | 0; | |
21042 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21043 | xl = gl ^ el & (fl ^ gl) | 0; | |
21044 | tl = tl + xl | 0; | |
21045 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21046 | hl = gl; | |
21047 | hh = gh; | |
21048 | gl = fl; | |
21049 | gh = fh; | |
21050 | fl = el; | |
21051 | fh = eh; | |
21052 | el = dl + tl | 0; | |
21053 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21054 | dl = cl; | |
21055 | dh = ch; | |
21056 | cl = bl; | |
21057 | ch = bh; | |
21058 | bl = al; | |
21059 | bh = ah; | |
21060 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
21061 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
21062 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
21063 | al = al + xl | 0; | |
21064 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21065 | w9l = w9l + w2l | 0; | |
21066 | w9h = w9h + w2h + (w9l >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
21067 | xl = (w10l >>> 1 | w10h << 31) ^ (w10l >>> 8 | w10h << 24) ^ (w10l >>> 7 | w10h << 25) | 0; | |
21068 | w9l = w9l + xl | 0; | |
21069 | w9h = w9h + ((w10h >>> 1 | w10l << 31) ^ (w10h >>> 8 | w10l << 24) ^ w10h >>> 7) + (w9l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21070 | xl = (w7l >>> 19 | w7h << 13) ^ (w7l << 3 | w7h >>> 29) ^ (w7l >>> 6 | w7h << 26) | 0; | |
21071 | w9l = w9l + xl | 0; | |
21072 | w9h = w9h + ((w7h >>> 19 | w7l << 13) ^ (w7h << 3 | w7l >>> 29) ^ w7h >>> 6) + (w9l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21073 | tl = 1086792851 + w9l | 0; | |
21074 | th = 852142971 + w9h + (tl >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
21075 | tl = tl + hl | 0; | |
21076 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21077 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
21078 | tl = tl + xl | 0; | |
21079 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21080 | xl = gl ^ el & (fl ^ gl) | 0; | |
21081 | tl = tl + xl | 0; | |
21082 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21083 | hl = gl; | |
21084 | hh = gh; | |
21085 | gl = fl; | |
21086 | gh = fh; | |
21087 | fl = el; | |
21088 | fh = eh; | |
21089 | el = dl + tl | 0; | |
21090 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21091 | dl = cl; | |
21092 | dh = ch; | |
21093 | cl = bl; | |
21094 | ch = bh; | |
21095 | bl = al; | |
21096 | bh = ah; | |
21097 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
21098 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
21099 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
21100 | al = al + xl | 0; | |
21101 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21102 | w10l = w10l + w3l | 0; | |
21103 | w10h = w10h + w3h + (w10l >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
21104 | xl = (w11l >>> 1 | w11h << 31) ^ (w11l >>> 8 | w11h << 24) ^ (w11l >>> 7 | w11h << 25) | 0; | |
21105 | w10l = w10l + xl | 0; | |
21106 | w10h = w10h + ((w11h >>> 1 | w11l << 31) ^ (w11h >>> 8 | w11l << 24) ^ w11h >>> 7) + (w10l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21107 | xl = (w8l >>> 19 | w8h << 13) ^ (w8l << 3 | w8h >>> 29) ^ (w8l >>> 6 | w8h << 26) | 0; | |
21108 | w10l = w10l + xl | 0; | |
21109 | w10h = w10h + ((w8h >>> 19 | w8l << 13) ^ (w8h << 3 | w8l >>> 29) ^ w8h >>> 6) + (w10l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21110 | tl = 365543100 + w10l | 0; | |
21111 | th = 1017036298 + w10h + (tl >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
21112 | tl = tl + hl | 0; | |
21113 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21114 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
21115 | tl = tl + xl | 0; | |
21116 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21117 | xl = gl ^ el & (fl ^ gl) | 0; | |
21118 | tl = tl + xl | 0; | |
21119 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21120 | hl = gl; | |
21121 | hh = gh; | |
21122 | gl = fl; | |
21123 | gh = fh; | |
21124 | fl = el; | |
21125 | fh = eh; | |
21126 | el = dl + tl | 0; | |
21127 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21128 | dl = cl; | |
21129 | dh = ch; | |
21130 | cl = bl; | |
21131 | ch = bh; | |
21132 | bl = al; | |
21133 | bh = ah; | |
21134 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
21135 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
21136 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
21137 | al = al + xl | 0; | |
21138 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21139 | w11l = w11l + w4l | 0; | |
21140 | w11h = w11h + w4h + (w11l >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
21141 | xl = (w12l >>> 1 | w12h << 31) ^ (w12l >>> 8 | w12h << 24) ^ (w12l >>> 7 | w12h << 25) | 0; | |
21142 | w11l = w11l + xl | 0; | |
21143 | w11h = w11h + ((w12h >>> 1 | w12l << 31) ^ (w12h >>> 8 | w12l << 24) ^ w12h >>> 7) + (w11l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21144 | xl = (w9l >>> 19 | w9h << 13) ^ (w9l << 3 | w9h >>> 29) ^ (w9l >>> 6 | w9h << 26) | 0; | |
21145 | w11l = w11l + xl | 0; | |
21146 | w11h = w11h + ((w9h >>> 19 | w9l << 13) ^ (w9h << 3 | w9l >>> 29) ^ w9h >>> 6) + (w11l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21147 | tl = 2618297676 + w11l | 0; | |
21148 | th = 1126000580 + w11h + (tl >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
21149 | tl = tl + hl | 0; | |
21150 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21151 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
21152 | tl = tl + xl | 0; | |
21153 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21154 | xl = gl ^ el & (fl ^ gl) | 0; | |
21155 | tl = tl + xl | 0; | |
21156 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21157 | hl = gl; | |
21158 | hh = gh; | |
21159 | gl = fl; | |
21160 | gh = fh; | |
21161 | fl = el; | |
21162 | fh = eh; | |
21163 | el = dl + tl | 0; | |
21164 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21165 | dl = cl; | |
21166 | dh = ch; | |
21167 | cl = bl; | |
21168 | ch = bh; | |
21169 | bl = al; | |
21170 | bh = ah; | |
21171 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
21172 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
21173 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
21174 | al = al + xl | 0; | |
21175 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21176 | w12l = w12l + w5l | 0; | |
21177 | w12h = w12h + w5h + (w12l >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
21178 | xl = (w13l >>> 1 | w13h << 31) ^ (w13l >>> 8 | w13h << 24) ^ (w13l >>> 7 | w13h << 25) | 0; | |
21179 | w12l = w12l + xl | 0; | |
21180 | w12h = w12h + ((w13h >>> 1 | w13l << 31) ^ (w13h >>> 8 | w13l << 24) ^ w13h >>> 7) + (w12l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21181 | xl = (w10l >>> 19 | w10h << 13) ^ (w10l << 3 | w10h >>> 29) ^ (w10l >>> 6 | w10h << 26) | 0; | |
21182 | w12l = w12l + xl | 0; | |
21183 | w12h = w12h + ((w10h >>> 19 | w10l << 13) ^ (w10h << 3 | w10l >>> 29) ^ w10h >>> 6) + (w12l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21184 | tl = 3409855158 + w12l | 0; | |
21185 | th = 1288033470 + w12h + (tl >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
21186 | tl = tl + hl | 0; | |
21187 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21188 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
21189 | tl = tl + xl | 0; | |
21190 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21191 | xl = gl ^ el & (fl ^ gl) | 0; | |
21192 | tl = tl + xl | 0; | |
21193 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21194 | hl = gl; | |
21195 | hh = gh; | |
21196 | gl = fl; | |
21197 | gh = fh; | |
21198 | fl = el; | |
21199 | fh = eh; | |
21200 | el = dl + tl | 0; | |
21201 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21202 | dl = cl; | |
21203 | dh = ch; | |
21204 | cl = bl; | |
21205 | ch = bh; | |
21206 | bl = al; | |
21207 | bh = ah; | |
21208 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
21209 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
21210 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
21211 | al = al + xl | 0; | |
21212 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21213 | w13l = w13l + w6l | 0; | |
21214 | w13h = w13h + w6h + (w13l >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
21215 | xl = (w14l >>> 1 | w14h << 31) ^ (w14l >>> 8 | w14h << 24) ^ (w14l >>> 7 | w14h << 25) | 0; | |
21216 | w13l = w13l + xl | 0; | |
21217 | w13h = w13h + ((w14h >>> 1 | w14l << 31) ^ (w14h >>> 8 | w14l << 24) ^ w14h >>> 7) + (w13l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21218 | xl = (w11l >>> 19 | w11h << 13) ^ (w11l << 3 | w11h >>> 29) ^ (w11l >>> 6 | w11h << 26) | 0; | |
21219 | w13l = w13l + xl | 0; | |
21220 | w13h = w13h + ((w11h >>> 19 | w11l << 13) ^ (w11h << 3 | w11l >>> 29) ^ w11h >>> 6) + (w13l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21221 | tl = 4234509866 + w13l | 0; | |
21222 | th = 1501505948 + w13h + (tl >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
21223 | tl = tl + hl | 0; | |
21224 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21225 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
21226 | tl = tl + xl | 0; | |
21227 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21228 | xl = gl ^ el & (fl ^ gl) | 0; | |
21229 | tl = tl + xl | 0; | |
21230 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21231 | hl = gl; | |
21232 | hh = gh; | |
21233 | gl = fl; | |
21234 | gh = fh; | |
21235 | fl = el; | |
21236 | fh = eh; | |
21237 | el = dl + tl | 0; | |
21238 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21239 | dl = cl; | |
21240 | dh = ch; | |
21241 | cl = bl; | |
21242 | ch = bh; | |
21243 | bl = al; | |
21244 | bh = ah; | |
21245 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
21246 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
21247 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
21248 | al = al + xl | 0; | |
21249 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21250 | w14l = w14l + w7l | 0; | |
21251 | w14h = w14h + w7h + (w14l >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
21252 | xl = (w15l >>> 1 | w15h << 31) ^ (w15l >>> 8 | w15h << 24) ^ (w15l >>> 7 | w15h << 25) | 0; | |
21253 | w14l = w14l + xl | 0; | |
21254 | w14h = w14h + ((w15h >>> 1 | w15l << 31) ^ (w15h >>> 8 | w15l << 24) ^ w15h >>> 7) + (w14l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21255 | xl = (w12l >>> 19 | w12h << 13) ^ (w12l << 3 | w12h >>> 29) ^ (w12l >>> 6 | w12h << 26) | 0; | |
21256 | w14l = w14l + xl | 0; | |
21257 | w14h = w14h + ((w12h >>> 19 | w12l << 13) ^ (w12h << 3 | w12l >>> 29) ^ w12h >>> 6) + (w14l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21258 | tl = 987167468 + w14l | 0; | |
21259 | th = 1607167915 + w14h + (tl >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
21260 | tl = tl + hl | 0; | |
21261 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21262 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
21263 | tl = tl + xl | 0; | |
21264 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21265 | xl = gl ^ el & (fl ^ gl) | 0; | |
21266 | tl = tl + xl | 0; | |
21267 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21268 | hl = gl; | |
21269 | hh = gh; | |
21270 | gl = fl; | |
21271 | gh = fh; | |
21272 | fl = el; | |
21273 | fh = eh; | |
21274 | el = dl + tl | 0; | |
21275 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21276 | dl = cl; | |
21277 | dh = ch; | |
21278 | cl = bl; | |
21279 | ch = bh; | |
21280 | bl = al; | |
21281 | bh = ah; | |
21282 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
21283 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
21284 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
21285 | al = al + xl | 0; | |
21286 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21287 | w15l = w15l + w8l | 0; | |
21288 | w15h = w15h + w8h + (w15l >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
21289 | xl = (w0l >>> 1 | w0h << 31) ^ (w0l >>> 8 | w0h << 24) ^ (w0l >>> 7 | w0h << 25) | 0; | |
21290 | w15l = w15l + xl | 0; | |
21291 | w15h = w15h + ((w0h >>> 1 | w0l << 31) ^ (w0h >>> 8 | w0l << 24) ^ w0h >>> 7) + (w15l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21292 | xl = (w13l >>> 19 | w13h << 13) ^ (w13l << 3 | w13h >>> 29) ^ (w13l >>> 6 | w13h << 26) | 0; | |
21293 | w15l = w15l + xl | 0; | |
21294 | w15h = w15h + ((w13h >>> 19 | w13l << 13) ^ (w13h << 3 | w13l >>> 29) ^ w13h >>> 6) + (w15l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21295 | tl = 1246189591 + w15l | 0; | |
21296 | th = 1816402316 + w15h + (tl >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
21297 | tl = tl + hl | 0; | |
21298 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21299 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
21300 | tl = tl + xl | 0; | |
21301 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21302 | xl = gl ^ el & (fl ^ gl) | 0; | |
21303 | tl = tl + xl | 0; | |
21304 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21305 | hl = gl; | |
21306 | hh = gh; | |
21307 | gl = fl; | |
21308 | gh = fh; | |
21309 | fl = el; | |
21310 | fh = eh; | |
21311 | el = dl + tl | 0; | |
21312 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21313 | dl = cl; | |
21314 | dh = ch; | |
21315 | cl = bl; | |
21316 | ch = bh; | |
21317 | bl = al; | |
21318 | bh = ah; | |
21319 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
21320 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
21321 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
21322 | al = al + xl | 0; | |
21323 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21324 | H0l = H0l + al | 0; | |
21325 | H0h = H0h + ah + (H0l >>> 0 < al >>> 0 ? 1 : 0) | 0; | |
21326 | H1l = H1l + bl | 0; | |
21327 | H1h = H1h + bh + (H1l >>> 0 < bl >>> 0 ? 1 : 0) | 0; | |
21328 | H2l = H2l + cl | 0; | |
21329 | H2h = H2h + ch + (H2l >>> 0 < cl >>> 0 ? 1 : 0) | 0; | |
21330 | H3l = H3l + dl | 0; | |
21331 | H3h = H3h + dh + (H3l >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21332 | H4l = H4l + el | 0; | |
21333 | H4h = H4h + eh + (H4l >>> 0 < el >>> 0 ? 1 : 0) | 0; | |
21334 | H5l = H5l + fl | 0; | |
21335 | H5h = H5h + fh + (H5l >>> 0 < fl >>> 0 ? 1 : 0) | 0; | |
21336 | H6l = H6l + gl | 0; | |
21337 | H6h = H6h + gh + (H6l >>> 0 < gl >>> 0 ? 1 : 0) | 0; | |
21338 | H7l = H7l + hl | 0; | |
21339 | H7h = H7h + hh + (H7l >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21340 | } | |
21341 | function _core_heap(offset) { | |
21342 | offset = offset | 0; | |
21343 | _core(HEAP[offset | 0] << 24 | HEAP[offset | 1] << 16 | HEAP[offset | 2] << 8 | HEAP[offset | 3], HEAP[offset | 4] << 24 | HEAP[offset | 5] << 16 | HEAP[offset | 6] << 8 | HEAP[offset | 7], HEAP[offset | 8] << 24 | HEAP[offset | 9] << 16 | HEAP[offset | 10] << 8 | HEAP[offset | 11], HEAP[offset | 12] << 24 | HEAP[offset | 13] << 16 | HEAP[offset | 14] << 8 | HEAP[offset | 15], HEAP[offset | 16] << 24 | HEAP[offset | 17] << 16 | HEAP[offset | 18] << 8 | HEAP[offset | 19], HEAP[offset | 20] << 24 | HEAP[offset | 21] << 16 | HEAP[offset | 22] << 8 | HEAP[offset | 23], HEAP[offset | 24] << 24 | HEAP[offset | 25] << 16 | HEAP[offset | 26] << 8 | HEAP[offset | 27], HEAP[offset | 28] << 24 | HEAP[offset | 29] << 16 | HEAP[offset | 30] << 8 | HEAP[offset | 31], HEAP[offset | 32] << 24 | HEAP[offset | 33] << 16 | HEAP[offset | 34] << 8 | HEAP[offset | 35], HEAP[offset | 36] << 24 | HEAP[offset | 37] << 16 | HEAP[offset | 38] << 8 | HEAP[offset | 39], HEAP[offset | 40] << 24 | HEAP[offset | 41] << 16 | HEAP[offset | 42] << 8 | HEAP[offset | 43], HEAP[offset | 44] << 24 | HEAP[offset | 45] << 16 | HEAP[offset | 46] << 8 | HEAP[offset | 47], HEAP[offset | 48] << 24 | HEAP[offset | 49] << 16 | HEAP[offset | 50] << 8 | HEAP[offset | 51], HEAP[offset | 52] << 24 | HEAP[offset | 53] << 16 | HEAP[offset | 54] << 8 | HEAP[offset | 55], HEAP[offset | 56] << 24 | HEAP[offset | 57] << 16 | HEAP[offset | 58] << 8 | HEAP[offset | 59], HEAP[offset | 60] << 24 | HEAP[offset | 61] << 16 | HEAP[offset | 62] << 8 | HEAP[offset | 63], HEAP[offset | 64] << 24 | HEAP[offset | 65] << 16 | HEAP[offset | 66] << 8 | HEAP[offset | 67], HEAP[offset | 68] << 24 | HEAP[offset | 69] << 16 | HEAP[offset | 70] << 8 | HEAP[offset | 71], HEAP[offset | 72] << 24 | HEAP[offset | 73] << 16 | HEAP[offset | 74] << 8 | HEAP[offset | 75], HEAP[offset | 76] << 24 | HEAP[offset | 77] << 16 | HEAP[offset | 78] << 8 | HEAP[offset | 79], HEAP[offset | 80] << 24 | HEAP[offset | 81] << 16 | HEAP[offset | 82] << 8 | HEAP[offset | 83], HEAP[offset | 84] << 24 | HEAP[offset | 85] << 16 | HEAP[offset | 86] << 8 | HEAP[offset | 87], HEAP[offset | 88] << 24 | HEAP[offset | 89] << 16 | HEAP[offset | 90] << 8 | HEAP[offset | 91], HEAP[offset | 92] << 24 | HEAP[offset | 93] << 16 | HEAP[offset | 94] << 8 | HEAP[offset | 95], HEAP[offset | 96] << 24 | HEAP[offset | 97] << 16 | HEAP[offset | 98] << 8 | HEAP[offset | 99], HEAP[offset | 100] << 24 | HEAP[offset | 101] << 16 | HEAP[offset | 102] << 8 | HEAP[offset | 103], HEAP[offset | 104] << 24 | HEAP[offset | 105] << 16 | HEAP[offset | 106] << 8 | HEAP[offset | 107], HEAP[offset | 108] << 24 | HEAP[offset | 109] << 16 | HEAP[offset | 110] << 8 | HEAP[offset | 111], HEAP[offset | 112] << 24 | HEAP[offset | 113] << 16 | HEAP[offset | 114] << 8 | HEAP[offset | 115], HEAP[offset | 116] << 24 | HEAP[offset | 117] << 16 | HEAP[offset | 118] << 8 | HEAP[offset | 119], HEAP[offset | 120] << 24 | HEAP[offset | 121] << 16 | HEAP[offset | 122] << 8 | HEAP[offset | 123], HEAP[offset | 124] << 24 | HEAP[offset | 125] << 16 | HEAP[offset | 126] << 8 | HEAP[offset | 127]); | |
21344 | } | |
21345 | function _state_to_heap(output) { | |
21346 | output = output | 0; | |
21347 | HEAP[output | 0] = H0h >>> 24; | |
21348 | HEAP[output | 1] = H0h >>> 16 & 255; | |
21349 | HEAP[output | 2] = H0h >>> 8 & 255; | |
21350 | HEAP[output | 3] = H0h & 255; | |
21351 | HEAP[output | 4] = H0l >>> 24; | |
21352 | HEAP[output | 5] = H0l >>> 16 & 255; | |
21353 | HEAP[output | 6] = H0l >>> 8 & 255; | |
21354 | HEAP[output | 7] = H0l & 255; | |
21355 | HEAP[output | 8] = H1h >>> 24; | |
21356 | HEAP[output | 9] = H1h >>> 16 & 255; | |
21357 | HEAP[output | 10] = H1h >>> 8 & 255; | |
21358 | HEAP[output | 11] = H1h & 255; | |
21359 | HEAP[output | 12] = H1l >>> 24; | |
21360 | HEAP[output | 13] = H1l >>> 16 & 255; | |
21361 | HEAP[output | 14] = H1l >>> 8 & 255; | |
21362 | HEAP[output | 15] = H1l & 255; | |
21363 | HEAP[output | 16] = H2h >>> 24; | |
21364 | HEAP[output | 17] = H2h >>> 16 & 255; | |
21365 | HEAP[output | 18] = H2h >>> 8 & 255; | |
21366 | HEAP[output | 19] = H2h & 255; | |
21367 | HEAP[output | 20] = H2l >>> 24; | |
21368 | HEAP[output | 21] = H2l >>> 16 & 255; | |
21369 | HEAP[output | 22] = H2l >>> 8 & 255; | |
21370 | HEAP[output | 23] = H2l & 255; | |
21371 | HEAP[output | 24] = H3h >>> 24; | |
21372 | HEAP[output | 25] = H3h >>> 16 & 255; | |
21373 | HEAP[output | 26] = H3h >>> 8 & 255; | |
21374 | HEAP[output | 27] = H3h & 255; | |
21375 | HEAP[output | 28] = H3l >>> 24; | |
21376 | HEAP[output | 29] = H3l >>> 16 & 255; | |
21377 | HEAP[output | 30] = H3l >>> 8 & 255; | |
21378 | HEAP[output | 31] = H3l & 255; | |
21379 | HEAP[output | 32] = H4h >>> 24; | |
21380 | HEAP[output | 33] = H4h >>> 16 & 255; | |
21381 | HEAP[output | 34] = H4h >>> 8 & 255; | |
21382 | HEAP[output | 35] = H4h & 255; | |
21383 | HEAP[output | 36] = H4l >>> 24; | |
21384 | HEAP[output | 37] = H4l >>> 16 & 255; | |
21385 | HEAP[output | 38] = H4l >>> 8 & 255; | |
21386 | HEAP[output | 39] = H4l & 255; | |
21387 | HEAP[output | 40] = H5h >>> 24; | |
21388 | HEAP[output | 41] = H5h >>> 16 & 255; | |
21389 | HEAP[output | 42] = H5h >>> 8 & 255; | |
21390 | HEAP[output | 43] = H5h & 255; | |
21391 | HEAP[output | 44] = H5l >>> 24; | |
21392 | HEAP[output | 45] = H5l >>> 16 & 255; | |
21393 | HEAP[output | 46] = H5l >>> 8 & 255; | |
21394 | HEAP[output | 47] = H5l & 255; | |
21395 | HEAP[output | 48] = H6h >>> 24; | |
21396 | HEAP[output | 49] = H6h >>> 16 & 255; | |
21397 | HEAP[output | 50] = H6h >>> 8 & 255; | |
21398 | HEAP[output | 51] = H6h & 255; | |
21399 | HEAP[output | 52] = H6l >>> 24; | |
21400 | HEAP[output | 53] = H6l >>> 16 & 255; | |
21401 | HEAP[output | 54] = H6l >>> 8 & 255; | |
21402 | HEAP[output | 55] = H6l & 255; | |
21403 | HEAP[output | 56] = H7h >>> 24; | |
21404 | HEAP[output | 57] = H7h >>> 16 & 255; | |
21405 | HEAP[output | 58] = H7h >>> 8 & 255; | |
21406 | HEAP[output | 59] = H7h & 255; | |
21407 | HEAP[output | 60] = H7l >>> 24; | |
21408 | HEAP[output | 61] = H7l >>> 16 & 255; | |
21409 | HEAP[output | 62] = H7l >>> 8 & 255; | |
21410 | HEAP[output | 63] = H7l & 255; | |
21411 | } | |
21412 | function reset() { | |
21413 | H0h = 1779033703; | |
21414 | H0l = 4089235720; | |
21415 | H1h = 3144134277; | |
21416 | H1l = 2227873595; | |
21417 | H2h = 1013904242; | |
21418 | H2l = 4271175723; | |
21419 | H3h = 2773480762; | |
21420 | H3l = 1595750129; | |
21421 | H4h = 1359893119; | |
21422 | H4l = 2917565137; | |
21423 | H5h = 2600822924; | |
21424 | H5l = 725511199; | |
21425 | H6h = 528734635; | |
21426 | H6l = 4215389547; | |
21427 | H7h = 1541459225; | |
21428 | H7l = 327033209; | |
21429 | TOTAL = 0; | |
21430 | } | |
21431 | function init(h0h, h0l, h1h, h1l, h2h, h2l, h3h, h3l, h4h, h4l, h5h, h5l, h6h, h6l, h7h, h7l, total) { | |
21432 | h0h = h0h | 0; | |
21433 | h0l = h0l | 0; | |
21434 | h1h = h1h | 0; | |
21435 | h1l = h1l | 0; | |
21436 | h2h = h2h | 0; | |
21437 | h2l = h2l | 0; | |
21438 | h3h = h3h | 0; | |
21439 | h3l = h3l | 0; | |
21440 | h4h = h4h | 0; | |
21441 | h4l = h4l | 0; | |
21442 | h5h = h5h | 0; | |
21443 | h5l = h5l | 0; | |
21444 | h6h = h6h | 0; | |
21445 | h6l = h6l | 0; | |
21446 | h7h = h7h | 0; | |
21447 | h7l = h7l | 0; | |
21448 | total = total | 0; | |
21449 | H0h = h0h; | |
21450 | H0l = h0l; | |
21451 | H1h = h1h; | |
21452 | H1l = h1l; | |
21453 | H2h = h2h; | |
21454 | H2l = h2l; | |
21455 | H3h = h3h; | |
21456 | H3l = h3l; | |
21457 | H4h = h4h; | |
21458 | H4l = h4l; | |
21459 | H5h = h5h; | |
21460 | H5l = h5l; | |
21461 | H6h = h6h; | |
21462 | H6l = h6l; | |
21463 | H7h = h7h; | |
21464 | H7l = h7l; | |
21465 | TOTAL = total; | |
21466 | } | |
21467 | function process(offset, length) { | |
21468 | offset = offset | 0; | |
21469 | length = length | 0; | |
21470 | var hashed = 0; | |
21471 | if (offset & 127) return -1; | |
21472 | while ((length | 0) >= 128) { | |
21473 | _core_heap(offset); | |
21474 | offset = offset + 128 | 0; | |
21475 | length = length - 128 | 0; | |
21476 | hashed = hashed + 128 | 0; | |
21477 | } | |
21478 | TOTAL = TOTAL + hashed | 0; | |
21479 | return hashed | 0; | |
21480 | } | |
21481 | function finish(offset, length, output) { | |
21482 | offset = offset | 0; | |
21483 | length = length | 0; | |
21484 | output = output | 0; | |
21485 | var hashed = 0, i = 0; | |
21486 | if (offset & 127) return -1; | |
21487 | if (~output) if (output & 63) return -1; | |
21488 | if ((length | 0) >= 128) { | |
21489 | hashed = process(offset, length) | 0; | |
21490 | if ((hashed | 0) == -1) return -1; | |
21491 | offset = offset + hashed | 0; | |
21492 | length = length - hashed | 0; | |
21493 | } | |
21494 | hashed = hashed + length | 0; | |
21495 | TOTAL = TOTAL + length | 0; | |
21496 | HEAP[offset | length] = 128; | |
21497 | if ((length | 0) >= 112) { | |
21498 | for (i = length + 1 | 0; (i | 0) < 128; i = i + 1 | 0) HEAP[offset | i] = 0; | |
21499 | _core_heap(offset); | |
21500 | length = 0; | |
21501 | HEAP[offset | 0] = 0; | |
21502 | } | |
21503 | for (i = length + 1 | 0; (i | 0) < 123; i = i + 1 | 0) HEAP[offset | i] = 0; | |
21504 | HEAP[offset | 123] = TOTAL >>> 29; | |
21505 | HEAP[offset | 124] = TOTAL >>> 21 & 255; | |
21506 | HEAP[offset | 125] = TOTAL >>> 13 & 255; | |
21507 | HEAP[offset | 126] = TOTAL >>> 5 & 255; | |
21508 | HEAP[offset | 127] = TOTAL << 3 & 255; | |
21509 | _core_heap(offset); | |
21510 | if (~output) _state_to_heap(output); | |
21511 | return hashed | 0; | |
21512 | } | |
21513 | function hmac_reset() { | |
21514 | H0h = I0h; | |
21515 | H0l = I0l; | |
21516 | H1h = I1h; | |
21517 | H1l = I1l; | |
21518 | H2h = I2h; | |
21519 | H2l = I2l; | |
21520 | H3h = I3h; | |
21521 | H3l = I3l; | |
21522 | H4h = I4h; | |
21523 | H4l = I4l; | |
21524 | H5h = I5h; | |
21525 | H5l = I5l; | |
21526 | H6h = I6h; | |
21527 | H6l = I6l; | |
21528 | H7h = I7h; | |
21529 | H7l = I7l; | |
21530 | TOTAL = 128; | |
21531 | } | |
21532 | function _hmac_opad() { | |
21533 | H0h = O0h; | |
21534 | H0l = O0l; | |
21535 | H1h = O1h; | |
21536 | H1l = O1l; | |
21537 | H2h = O2h; | |
21538 | H2l = O2l; | |
21539 | H3h = O3h; | |
21540 | H3l = O3l; | |
21541 | H4h = O4h; | |
21542 | H4l = O4l; | |
21543 | H5h = O5h; | |
21544 | H5l = O5l; | |
21545 | H6h = O6h; | |
21546 | H6l = O6l; | |
21547 | H7h = O7h; | |
21548 | H7l = O7l; | |
21549 | TOTAL = 128; | |
21550 | } | |
21551 | function hmac_init(p0h, p0l, p1h, p1l, p2h, p2l, p3h, p3l, p4h, p4l, p5h, p5l, p6h, p6l, p7h, p7l, p8h, p8l, p9h, p9l, p10h, p10l, p11h, p11l, p12h, p12l, p13h, p13l, p14h, p14l, p15h, p15l) { | |
21552 | p0h = p0h | 0; | |
21553 | p0l = p0l | 0; | |
21554 | p1h = p1h | 0; | |
21555 | p1l = p1l | 0; | |
21556 | p2h = p2h | 0; | |
21557 | p2l = p2l | 0; | |
21558 | p3h = p3h | 0; | |
21559 | p3l = p3l | 0; | |
21560 | p4h = p4h | 0; | |
21561 | p4l = p4l | 0; | |
21562 | p5h = p5h | 0; | |
21563 | p5l = p5l | 0; | |
21564 | p6h = p6h | 0; | |
21565 | p6l = p6l | 0; | |
21566 | p7h = p7h | 0; | |
21567 | p7l = p7l | 0; | |
21568 | p8h = p8h | 0; | |
21569 | p8l = p8l | 0; | |
21570 | p9h = p9h | 0; | |
21571 | p9l = p9l | 0; | |
21572 | p10h = p10h | 0; | |
21573 | p10l = p10l | 0; | |
21574 | p11h = p11h | 0; | |
21575 | p11l = p11l | 0; | |
21576 | p12h = p12h | 0; | |
21577 | p12l = p12l | 0; | |
21578 | p13h = p13h | 0; | |
21579 | p13l = p13l | 0; | |
21580 | p14h = p14h | 0; | |
21581 | p14l = p14l | 0; | |
21582 | p15h = p15h | 0; | |
21583 | p15l = p15l | 0; | |
21584 | reset(); | |
21585 | _core(p0h ^ 1549556828, p0l ^ 1549556828, p1h ^ 1549556828, p1l ^ 1549556828, p2h ^ 1549556828, p2l ^ 1549556828, p3h ^ 1549556828, p3l ^ 1549556828, p4h ^ 1549556828, p4l ^ 1549556828, p5h ^ 1549556828, p5l ^ 1549556828, p6h ^ 1549556828, p6l ^ 1549556828, p7h ^ 1549556828, p7l ^ 1549556828, p8h ^ 1549556828, p8l ^ 1549556828, p9h ^ 1549556828, p9l ^ 1549556828, p10h ^ 1549556828, p10l ^ 1549556828, p11h ^ 1549556828, p11l ^ 1549556828, p12h ^ 1549556828, p12l ^ 1549556828, p13h ^ 1549556828, p13l ^ 1549556828, p14h ^ 1549556828, p14l ^ 1549556828, p15h ^ 1549556828, p15l ^ 1549556828); | |
21586 | O0h = H0h; | |
21587 | O0l = H0l; | |
21588 | O1h = H1h; | |
21589 | O1l = H1l; | |
21590 | O2h = H2h; | |
21591 | O2l = H2l; | |
21592 | O3h = H3h; | |
21593 | O3l = H3l; | |
21594 | O4h = H4h; | |
21595 | O4l = H4l; | |
21596 | O5h = H5h; | |
21597 | O5l = H5l; | |
21598 | O6h = H6h; | |
21599 | O6l = H6l; | |
21600 | O7h = H7h; | |
21601 | O7l = H7l; | |
21602 | reset(); | |
21603 | _core(p0h ^ 909522486, p0l ^ 909522486, p1h ^ 909522486, p1l ^ 909522486, p2h ^ 909522486, p2l ^ 909522486, p3h ^ 909522486, p3l ^ 909522486, p4h ^ 909522486, p4l ^ 909522486, p5h ^ 909522486, p5l ^ 909522486, p6h ^ 909522486, p6l ^ 909522486, p7h ^ 909522486, p7l ^ 909522486, p8h ^ 909522486, p8l ^ 909522486, p9h ^ 909522486, p9l ^ 909522486, p10h ^ 909522486, p10l ^ 909522486, p11h ^ 909522486, p11l ^ 909522486, p12h ^ 909522486, p12l ^ 909522486, p13h ^ 909522486, p13l ^ 909522486, p14h ^ 909522486, p14l ^ 909522486, p15h ^ 909522486, p15l ^ 909522486); | |
21604 | I0h = H0h; | |
21605 | I0l = H0l; | |
21606 | I1h = H1h; | |
21607 | I1l = H1l; | |
21608 | I2h = H2h; | |
21609 | I2l = H2l; | |
21610 | I3h = H3h; | |
21611 | I3l = H3l; | |
21612 | I4h = H4h; | |
21613 | I4l = H4l; | |
21614 | I5h = H5h; | |
21615 | I5l = H5l; | |
21616 | I6h = H6h; | |
21617 | I6l = H6l; | |
21618 | I7h = H7h; | |
21619 | I7l = H7l; | |
21620 | TOTAL = 128; | |
21621 | } | |
21622 | function hmac_finish(offset, length, output) { | |
21623 | offset = offset | 0; | |
21624 | length = length | 0; | |
21625 | output = output | 0; | |
21626 | var t0h = 0, t0l = 0, t1h = 0, t1l = 0, t2h = 0, t2l = 0, t3h = 0, t3l = 0, t4h = 0, t4l = 0, t5h = 0, t5l = 0, t6h = 0, t6l = 0, t7h = 0, t7l = 0, hashed = 0; | |
21627 | if (offset & 127) return -1; | |
21628 | if (~output) if (output & 63) return -1; | |
21629 | hashed = finish(offset, length, -1) | 0; | |
21630 | t0h = H0h; | |
21631 | t0l = H0l; | |
21632 | t1h = H1h; | |
21633 | t1l = H1l; | |
21634 | t2h = H2h; | |
21635 | t2l = H2l; | |
21636 | t3h = H3h; | |
21637 | t3l = H3l; | |
21638 | t4h = H4h; | |
21639 | t4l = H4l; | |
21640 | t5h = H5h; | |
21641 | t5l = H5l; | |
21642 | t6h = H6h; | |
21643 | t6l = H6l; | |
21644 | t7h = H7h; | |
21645 | t7l = H7l; | |
21646 | _hmac_opad(); | |
21647 | _core(t0h, t0l, t1h, t1l, t2h, t2l, t3h, t3l, t4h, t4l, t5h, t5l, t6h, t6l, t7h, t7l, 2147483648, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1536); | |
21648 | if (~output) _state_to_heap(output); | |
21649 | return hashed | 0; | |
21650 | } | |
21651 | function pbkdf2_generate_block(offset, length, block, count, output) { | |
21652 | offset = offset | 0; | |
21653 | length = length | 0; | |
21654 | block = block | 0; | |
21655 | count = count | 0; | |
21656 | output = output | 0; | |
21657 | var h0h = 0, h0l = 0, h1h = 0, h1l = 0, h2h = 0, h2l = 0, h3h = 0, h3l = 0, h4h = 0, h4l = 0, h5h = 0, h5l = 0, h6h = 0, h6l = 0, h7h = 0, h7l = 0, t0h = 0, t0l = 0, t1h = 0, t1l = 0, t2h = 0, t2l = 0, t3h = 0, t3l = 0, t4h = 0, t4l = 0, t5h = 0, t5l = 0, t6h = 0, t6l = 0, t7h = 0, t7l = 0; | |
21658 | if (offset & 127) return -1; | |
21659 | if (~output) if (output & 63) return -1; | |
21660 | HEAP[offset + length | 0] = block >>> 24; | |
21661 | HEAP[offset + length + 1 | 0] = block >>> 16 & 255; | |
21662 | HEAP[offset + length + 2 | 0] = block >>> 8 & 255; | |
21663 | HEAP[offset + length + 3 | 0] = block & 255; | |
21664 | // Closure compiler warning - The result of the 'bitor' operator is not being used | |
21665 | //hmac_finish(offset, length + 4 | 0, -1) | 0; | |
21666 | hmac_finish(offset, length + 4 | 0, -1); | |
21667 | h0h = t0h = H0h; | |
21668 | h0l = t0l = H0l; | |
21669 | h1h = t1h = H1h; | |
21670 | h1l = t1l = H1l; | |
21671 | h2h = t2h = H2h; | |
21672 | h2l = t2l = H2l; | |
21673 | h3h = t3h = H3h; | |
21674 | h3l = t3l = H3l; | |
21675 | h4h = t4h = H4h; | |
21676 | h4l = t4l = H4l; | |
21677 | h5h = t5h = H5h; | |
21678 | h5l = t5l = H5l; | |
21679 | h6h = t6h = H6h; | |
21680 | h6l = t6l = H6l; | |
21681 | h7h = t7h = H7h; | |
21682 | h7l = t7l = H7l; | |
21683 | count = count - 1 | 0; | |
21684 | while ((count | 0) > 0) { | |
21685 | hmac_reset(); | |
21686 | _core(t0h, t0l, t1h, t1l, t2h, t2l, t3h, t3l, t4h, t4l, t5h, t5l, t6h, t6l, t7h, t7l, 2147483648, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1536); | |
21687 | t0h = H0h; | |
21688 | t0l = H0l; | |
21689 | t1h = H1h; | |
21690 | t1l = H1l; | |
21691 | t2h = H2h; | |
21692 | t2l = H2l; | |
21693 | t3h = H3h; | |
21694 | t3l = H3l; | |
21695 | t4h = H4h; | |
21696 | t4l = H4l; | |
21697 | t5h = H5h; | |
21698 | t5l = H5l; | |
21699 | t6h = H6h; | |
21700 | t6l = H6l; | |
21701 | t7h = H7h; | |
21702 | t7l = H7l; | |
21703 | _hmac_opad(); | |
21704 | _core(t0h, t0l, t1h, t1l, t2h, t2l, t3h, t3l, t4h, t4l, t5h, t5l, t6h, t6l, t7h, t7l, 2147483648, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1536); | |
21705 | t0h = H0h; | |
21706 | t0l = H0l; | |
21707 | t1h = H1h; | |
21708 | t1l = H1l; | |
21709 | t2h = H2h; | |
21710 | t2l = H2l; | |
21711 | t3h = H3h; | |
21712 | t3l = H3l; | |
21713 | t4h = H4h; | |
21714 | t4l = H4l; | |
21715 | t5h = H5h; | |
21716 | t5l = H5l; | |
21717 | t6h = H6h; | |
21718 | t6l = H6l; | |
21719 | t7h = H7h; | |
21720 | t7l = H7l; | |
21721 | h0h = h0h ^ H0h; | |
21722 | h0l = h0l ^ H0l; | |
21723 | h1h = h1h ^ H1h; | |
21724 | h1l = h1l ^ H1l; | |
21725 | h2h = h2h ^ H2h; | |
21726 | h2l = h2l ^ H2l; | |
21727 | h3h = h3h ^ H3h; | |
21728 | h3l = h3l ^ H3l; | |
21729 | h4h = h4h ^ H4h; | |
21730 | h4l = h4l ^ H4l; | |
21731 | h5h = h5h ^ H5h; | |
21732 | h5l = h5l ^ H5l; | |
21733 | h6h = h6h ^ H6h; | |
21734 | h6l = h6l ^ H6l; | |
21735 | h7h = h7h ^ H7h; | |
21736 | h7l = h7l ^ H7l; | |
21737 | count = count - 1 | 0; | |
21738 | } | |
21739 | H0h = h0h; | |
21740 | H0l = h0l; | |
21741 | H1h = h1h; | |
21742 | H1l = h1l; | |
21743 | H2h = h2h; | |
21744 | H2l = h2l; | |
21745 | H3h = h3h; | |
21746 | H3l = h3l; | |
21747 | H4h = h4h; | |
21748 | H4l = h4l; | |
21749 | H5h = h5h; | |
21750 | H5l = h5l; | |
21751 | H6h = h6h; | |
21752 | H6l = h6l; | |
21753 | H7h = h7h; | |
21754 | H7l = h7l; | |
21755 | if (~output) _state_to_heap(output); | |
21756 | return 0; | |
21757 | } | |
21758 | return { | |
21759 | reset: reset, | |
21760 | init: init, | |
21761 | process: process, | |
21762 | finish: finish, | |
21763 | hmac_reset: hmac_reset, | |
21764 | hmac_init: hmac_init, | |
21765 | hmac_finish: hmac_finish, | |
21766 | pbkdf2_generate_block: pbkdf2_generate_block | |
21767 | }; | |
21768 | } | |
21769 | var _sha512_block_size = 128, _sha512_hash_size = 64; | |
21770 | function sha512_constructor(options) { | |
21771 | options = options || {}; | |
21772 | options.heapSize = options.heapSize || 4096; | |
21773 | if (options.heapSize <= 0 || options.heapSize % 4096) throw new IllegalArgumentError("heapSize must be a positive number and multiple of 4096"); | |
21774 | this.heap = options.heap || new Uint8Array(options.heapSize); | |
21775 | this.asm = options.asm || sha512_asm(global, null, this.heap.buffer); | |
21776 | this.BLOCK_SIZE = _sha512_block_size; | |
21777 | this.HASH_SIZE = _sha512_hash_size; | |
21778 | this.reset(); | |
21779 | } | |
21780 | function sha512_reset() { | |
21781 | this.result = null; | |
21782 | this.pos = 0; | |
21783 | this.len = 0; | |
21784 | this.asm.reset(); | |
21785 | return this; | |
21786 | } | |
21787 | function sha512_process(data) { | |
21788 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
21789 | var dpos = 0, dlen = 0, clen = 0; | |
21790 | if (is_buffer(data) || is_bytes(data)) { | |
21791 | dpos = data.byteOffset || 0; | |
21792 | dlen = data.byteLength; | |
21793 | } else if (is_string(data)) { | |
21794 | dlen = data.length; | |
21795 | } else { | |
21796 | throw new TypeError("data isn't of expected type"); | |
21797 | } | |
21798 | while (dlen > 0) { | |
21799 | clen = this.heap.byteLength - this.pos - this.len; | |
21800 | clen = clen < dlen ? clen : dlen; | |
21801 | if (is_buffer(data) || is_bytes(data)) { | |
21802 | this.heap.set(new Uint8Array(data.buffer || data, dpos, clen), this.pos + this.len); | |
21803 | } else { | |
21804 | for (var i = 0; i < clen; i++) this.heap[this.pos + this.len + i] = data.charCodeAt(dpos + i); | |
21805 | } | |
21806 | this.len += clen; | |
21807 | dpos += clen; | |
21808 | dlen -= clen; | |
21809 | clen = this.asm.process(this.pos, this.len); | |
21810 | if (clen < this.len) { | |
21811 | this.pos += clen; | |
21812 | this.len -= clen; | |
21813 | } else { | |
21814 | this.pos = 0; | |
21815 | this.len = 0; | |
21816 | } | |
21817 | } | |
21818 | return this; | |
21819 | } | |
21820 | function sha512_finish() { | |
21821 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
21822 | this.asm.finish(this.pos, this.len, 0); | |
21823 | this.result = new Uint8Array(_sha512_hash_size); | |
21824 | this.result.set(this.heap.subarray(0, _sha512_hash_size)); | |
21825 | this.pos = 0; | |
21826 | this.len = 0; | |
21827 | return this; | |
21828 | } | |
21829 | sha512_constructor.BLOCK_SIZE = _sha512_block_size; | |
21830 | sha512_constructor.HASH_SIZE = _sha512_hash_size; | |
21831 | var sha512_prototype = sha512_constructor.prototype; | |
21832 | sha512_prototype.reset = sha512_reset; | |
21833 | sha512_prototype.process = sha512_process; | |
21834 | sha512_prototype.finish = sha512_finish; | |
21835 | function hmac_constructor(options) { | |
21836 | options = options || {}; | |
21837 | if (!options.hash) throw new SyntaxError("option 'hash' is required"); | |
21838 | if (!options.hash.HASH_SIZE) throw new SyntaxError("option 'hash' supplied doesn't seem to be a valid hash function"); | |
21839 | this.hash = options.hash; | |
21840 | this.BLOCK_SIZE = this.hash.BLOCK_SIZE; | |
21841 | this.HMAC_SIZE = this.hash.HASH_SIZE; | |
21842 | this.key = null; | |
21843 | this.verify = null; | |
21844 | this.result = null; | |
21845 | if (options.password !== undefined || options.verify !== undefined) this.reset(options); | |
21846 | return this; | |
21847 | } | |
21848 | function hmac_sha256_constructor(options) { | |
21849 | options = options || {}; | |
21850 | if (!(options.hash instanceof sha256_constructor)) options.hash = new sha256_constructor(options); | |
21851 | hmac_constructor.call(this, options); | |
21852 | return this; | |
21853 | } | |
21854 | function hmac_sha512_constructor(options) { | |
21855 | options = options || {}; | |
21856 | if (!(options.hash instanceof sha512_constructor)) options.hash = new sha512_constructor(options); | |
21857 | hmac_constructor.call(this, options); | |
21858 | return this; | |
21859 | } | |
21860 | function _hmac_key(hash, password) { | |
21861 | var key; | |
21862 | if (is_buffer(password) || is_bytes(password)) { | |
21863 | key = new Uint8Array(hash.BLOCK_SIZE); | |
21864 | if (password.byteLength > hash.BLOCK_SIZE) { | |
21865 | key.set(new Uint8Array(hash.reset().process(password).finish().result)); | |
21866 | } else if (is_buffer(password)) { | |
21867 | key.set(new Uint8Array(password)); | |
21868 | } else { | |
21869 | key.set(password); | |
21870 | } | |
21871 | } else if (is_string(password)) { | |
21872 | key = new Uint8Array(hash.BLOCK_SIZE); | |
21873 | if (password.length > hash.BLOCK_SIZE) { | |
21874 | key.set(new Uint8Array(hash.reset().process(password).finish().result)); | |
21875 | } else { | |
21876 | for (var i = 0; i < password.length; ++i) key[i] = password.charCodeAt(i); | |
21877 | } | |
21878 | } else { | |
21879 | throw new TypeError("password isn't of expected type"); | |
21880 | } | |
21881 | return key; | |
21882 | } | |
21883 | function _hmac_init_verify(verify) { | |
21884 | if (is_buffer(verify) || is_bytes(verify)) { | |
21885 | verify = new Uint8Array(verify); | |
21886 | } else if (is_string(verify)) { | |
21887 | verify = string_to_bytes(verify); | |
21888 | } else { | |
21889 | throw new TypeError("verify tag isn't of expected type"); | |
21890 | } | |
21891 | if (verify.length !== this.HMAC_SIZE) throw new IllegalArgumentError("illegal verification tag size"); | |
21892 | this.verify = verify; | |
21893 | } | |
21894 | function hmac_reset(options) { | |
21895 | options = options || {}; | |
21896 | var password = options.password; | |
21897 | if (this.key === null && !is_string(password) && !password) throw new IllegalStateError("no key is associated with the instance"); | |
21898 | this.result = null; | |
21899 | this.hash.reset(); | |
21900 | if (password || is_string(password)) this.key = _hmac_key(this.hash, password); | |
21901 | var ipad = new Uint8Array(this.key); | |
21902 | for (var i = 0; i < ipad.length; ++i) ipad[i] ^= 54; | |
21903 | this.hash.process(ipad); | |
21904 | var verify = options.verify; | |
21905 | if (verify !== undefined) { | |
21906 | _hmac_init_verify.call(this, verify); | |
21907 | } else { | |
21908 | this.verify = null; | |
21909 | } | |
21910 | return this; | |
21911 | } | |
21912 | function hmac_sha256_reset(options) { | |
21913 | options = options || {}; | |
21914 | var password = options.password; | |
21915 | if (this.key === null && !is_string(password) && !password) throw new IllegalStateError("no key is associated with the instance"); | |
21916 | this.result = null; | |
21917 | this.hash.reset(); | |
21918 | if (password || is_string(password)) { | |
21919 | this.key = _hmac_key(this.hash, password); | |
21920 | this.hash.reset().asm.hmac_init(this.key[0] << 24 | this.key[1] << 16 | this.key[2] << 8 | this.key[3], this.key[4] << 24 | this.key[5] << 16 | this.key[6] << 8 | this.key[7], this.key[8] << 24 | this.key[9] << 16 | this.key[10] << 8 | this.key[11], this.key[12] << 24 | this.key[13] << 16 | this.key[14] << 8 | this.key[15], this.key[16] << 24 | this.key[17] << 16 | this.key[18] << 8 | this.key[19], this.key[20] << 24 | this.key[21] << 16 | this.key[22] << 8 | this.key[23], this.key[24] << 24 | this.key[25] << 16 | this.key[26] << 8 | this.key[27], this.key[28] << 24 | this.key[29] << 16 | this.key[30] << 8 | this.key[31], this.key[32] << 24 | this.key[33] << 16 | this.key[34] << 8 | this.key[35], this.key[36] << 24 | this.key[37] << 16 | this.key[38] << 8 | this.key[39], this.key[40] << 24 | this.key[41] << 16 | this.key[42] << 8 | this.key[43], this.key[44] << 24 | this.key[45] << 16 | this.key[46] << 8 | this.key[47], this.key[48] << 24 | this.key[49] << 16 | this.key[50] << 8 | this.key[51], this.key[52] << 24 | this.key[53] << 16 | this.key[54] << 8 | this.key[55], this.key[56] << 24 | this.key[57] << 16 | this.key[58] << 8 | this.key[59], this.key[60] << 24 | this.key[61] << 16 | this.key[62] << 8 | this.key[63]); | |
21921 | } else { | |
21922 | this.hash.asm.hmac_reset(); | |
21923 | } | |
21924 | var verify = options.verify; | |
21925 | if (verify !== undefined) { | |
21926 | _hmac_init_verify.call(this, verify); | |
21927 | } else { | |
21928 | this.verify = null; | |
21929 | } | |
21930 | return this; | |
21931 | } | |
21932 | function hmac_sha512_reset(options) { | |
21933 | options = options || {}; | |
21934 | var password = options.password; | |
21935 | if (this.key === null && !is_string(password) && !password) throw new IllegalStateError("no key is associated with the instance"); | |
21936 | this.result = null; | |
21937 | this.hash.reset(); | |
21938 | if (password || is_string(password)) { | |
21939 | this.key = _hmac_key(this.hash, password); | |
21940 | this.hash.reset().asm.hmac_init(this.key[0] << 24 | this.key[1] << 16 | this.key[2] << 8 | this.key[3], this.key[4] << 24 | this.key[5] << 16 | this.key[6] << 8 | this.key[7], this.key[8] << 24 | this.key[9] << 16 | this.key[10] << 8 | this.key[11], this.key[12] << 24 | this.key[13] << 16 | this.key[14] << 8 | this.key[15], this.key[16] << 24 | this.key[17] << 16 | this.key[18] << 8 | this.key[19], this.key[20] << 24 | this.key[21] << 16 | this.key[22] << 8 | this.key[23], this.key[24] << 24 | this.key[25] << 16 | this.key[26] << 8 | this.key[27], this.key[28] << 24 | this.key[29] << 16 | this.key[30] << 8 | this.key[31], this.key[32] << 24 | this.key[33] << 16 | this.key[34] << 8 | this.key[35], this.key[36] << 24 | this.key[37] << 16 | this.key[38] << 8 | this.key[39], this.key[40] << 24 | this.key[41] << 16 | this.key[42] << 8 | this.key[43], this.key[44] << 24 | this.key[45] << 16 | this.key[46] << 8 | this.key[47], this.key[48] << 24 | this.key[49] << 16 | this.key[50] << 8 | this.key[51], this.key[52] << 24 | this.key[53] << 16 | this.key[54] << 8 | this.key[55], this.key[56] << 24 | this.key[57] << 16 | this.key[58] << 8 | this.key[59], this.key[60] << 24 | this.key[61] << 16 | this.key[62] << 8 | this.key[63], this.key[64] << 24 | this.key[65] << 16 | this.key[66] << 8 | this.key[67], this.key[68] << 24 | this.key[69] << 16 | this.key[70] << 8 | this.key[71], this.key[72] << 24 | this.key[73] << 16 | this.key[74] << 8 | this.key[75], this.key[76] << 24 | this.key[77] << 16 | this.key[78] << 8 | this.key[79], this.key[80] << 24 | this.key[81] << 16 | this.key[82] << 8 | this.key[83], this.key[84] << 24 | this.key[85] << 16 | this.key[86] << 8 | this.key[87], this.key[88] << 24 | this.key[89] << 16 | this.key[90] << 8 | this.key[91], this.key[92] << 24 | this.key[93] << 16 | this.key[94] << 8 | this.key[95], this.key[96] << 24 | this.key[97] << 16 | this.key[98] << 8 | this.key[99], this.key[100] << 24 | this.key[101] << 16 | this.key[102] << 8 | this.key[103], this.key[104] << 24 | this.key[105] << 16 | this.key[106] << 8 | this.key[107], this.key[108] << 24 | this.key[109] << 16 | this.key[110] << 8 | this.key[111], this.key[112] << 24 | this.key[113] << 16 | this.key[114] << 8 | this.key[115], this.key[116] << 24 | this.key[117] << 16 | this.key[118] << 8 | this.key[119], this.key[120] << 24 | this.key[121] << 16 | this.key[122] << 8 | this.key[123], this.key[124] << 24 | this.key[125] << 16 | this.key[126] << 8 | this.key[127]); | |
21941 | } else { | |
21942 | this.hash.asm.hmac_reset(); | |
21943 | } | |
21944 | var verify = options.verify; | |
21945 | if (verify !== undefined) { | |
21946 | _hmac_init_verify.call(this, verify); | |
21947 | } else { | |
21948 | this.verify = null; | |
21949 | } | |
21950 | return this; | |
21951 | } | |
21952 | function hmac_process(data) { | |
21953 | if (this.key === null) throw new IllegalStateError("no key is associated with the instance"); | |
21954 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
21955 | this.hash.process(data); | |
21956 | return this; | |
21957 | } | |
21958 | function hmac_finish() { | |
21959 | if (this.key === null) throw new IllegalStateError("no key is associated with the instance"); | |
21960 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
21961 | var inner_result = this.hash.finish().result; | |
21962 | var opad = new Uint8Array(this.key); | |
21963 | for (var i = 0; i < opad.length; ++i) opad[i] ^= 92; | |
21964 | var verify = this.verify; | |
21965 | var result = this.hash.reset().process(opad).process(inner_result).finish().result; | |
21966 | if (verify) { | |
21967 | if (verify.length === result.length) { | |
21968 | var diff = 0; | |
21969 | for (var i = 0; i < verify.length; i++) { | |
21970 | diff |= verify[i] ^ result[i]; | |
21971 | } | |
21972 | this.result = !diff; | |
21973 | } else { | |
21974 | this.result = false; | |
21975 | } | |
21976 | } else { | |
21977 | this.result = result; | |
21978 | } | |
21979 | return this; | |
21980 | } | |
21981 | function hmac_sha256_finish() { | |
21982 | if (this.key === null) throw new IllegalStateError("no key is associated with the instance"); | |
21983 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
21984 | var hash = this.hash, asm = this.hash.asm, heap = this.hash.heap; | |
21985 | asm.hmac_finish(hash.pos, hash.len, 0); | |
21986 | var verify = this.verify; | |
21987 | var result = new Uint8Array(_sha256_hash_size); | |
21988 | result.set(heap.subarray(0, _sha256_hash_size)); | |
21989 | if (verify) { | |
21990 | if (verify.length === result.length) { | |
21991 | var diff = 0; | |
21992 | for (var i = 0; i < verify.length; i++) { | |
21993 | diff |= verify[i] ^ result[i]; | |
21994 | } | |
21995 | this.result = !diff; | |
21996 | } else { | |
21997 | this.result = false; | |
21998 | } | |
21999 | } else { | |
22000 | this.result = result; | |
22001 | } | |
22002 | return this; | |
22003 | } | |
22004 | function hmac_sha512_finish() { | |
22005 | if (this.key === null) throw new IllegalStateError("no key is associated with the instance"); | |
22006 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
22007 | var hash = this.hash, asm = this.hash.asm, heap = this.hash.heap; | |
22008 | asm.hmac_finish(hash.pos, hash.len, 0); | |
22009 | var verify = this.verify; | |
22010 | var result = new Uint8Array(_sha512_hash_size); | |
22011 | result.set(heap.subarray(0, _sha512_hash_size)); | |
22012 | if (verify) { | |
22013 | if (verify.length === result.length) { | |
22014 | var diff = 0; | |
22015 | for (var i = 0; i < verify.length; i++) { | |
22016 | diff |= verify[i] ^ result[i]; | |
22017 | } | |
22018 | this.result = !diff; | |
22019 | } else { | |
22020 | this.result = false; | |
22021 | } | |
22022 | } else { | |
22023 | this.result = result; | |
22024 | } | |
22025 | return this; | |
22026 | } | |
22027 | var hmac_prototype = hmac_constructor.prototype; | |
22028 | hmac_prototype.reset = hmac_reset; | |
22029 | hmac_prototype.process = hmac_process; | |
22030 | hmac_prototype.finish = hmac_finish; | |
22031 | hmac_sha256_constructor.BLOCK_SIZE = sha256_constructor.BLOCK_SIZE; | |
22032 | hmac_sha256_constructor.HMAC_SIZE = sha256_constructor.HASH_SIZE; | |
22033 | var hmac_sha256_prototype = hmac_sha256_constructor.prototype; | |
22034 | hmac_sha256_prototype.reset = hmac_sha256_reset; | |
22035 | hmac_sha256_prototype.process = hmac_process; | |
22036 | hmac_sha256_prototype.finish = hmac_sha256_finish; | |
22037 | hmac_sha512_constructor.BLOCK_SIZE = sha512_constructor.BLOCK_SIZE; | |
22038 | hmac_sha512_constructor.HMAC_SIZE = sha512_constructor.HASH_SIZE; | |
22039 | var hmac_sha512_prototype = hmac_sha512_constructor.prototype; | |
22040 | hmac_sha512_prototype.reset = hmac_sha512_reset; | |
22041 | hmac_sha512_prototype.process = hmac_process; | |
22042 | hmac_sha512_prototype.finish = hmac_sha512_finish; | |
22043 | function pbkdf2_constructor(options) { | |
22044 | options = options || {}; | |
22045 | if (!options.hmac) throw new SyntaxError("option 'hmac' is required"); | |
22046 | if (!options.hmac.HMAC_SIZE) throw new SyntaxError("option 'hmac' supplied doesn't seem to be a valid HMAC function"); | |
22047 | this.hmac = options.hmac; | |
22048 | this.count = options.count || 4096; | |
22049 | this.length = options.length || this.hmac.HMAC_SIZE; | |
22050 | this.result = null; | |
22051 | var password = options.password; | |
22052 | if (password || is_string(password)) this.reset(options); | |
22053 | return this; | |
22054 | } | |
22055 | function pbkdf2_hmac_sha256_constructor(options) { | |
22056 | options = options || {}; | |
22057 | if (!(options.hmac instanceof hmac_sha256_constructor)) options.hmac = new hmac_sha256_constructor(options); | |
22058 | pbkdf2_constructor.call(this, options); | |
22059 | return this; | |
22060 | } | |
22061 | function pbkdf2_hmac_sha512_constructor(options) { | |
22062 | options = options || {}; | |
22063 | if (!(options.hmac instanceof hmac_sha512_constructor)) options.hmac = new hmac_sha512_constructor(options); | |
22064 | pbkdf2_constructor.call(this, options); | |
22065 | return this; | |
22066 | } | |
22067 | function pbkdf2_reset(options) { | |
22068 | this.result = null; | |
22069 | this.hmac.reset(options); | |
22070 | return this; | |
22071 | } | |
22072 | function pbkdf2_generate(salt, count, length) { | |
22073 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
22074 | if (!salt && !is_string(salt)) throw new IllegalArgumentError("bad 'salt' value"); | |
22075 | count = count || this.count; | |
22076 | length = length || this.length; | |
22077 | this.result = new Uint8Array(length); | |
22078 | var blocks = Math.ceil(length / this.hmac.HMAC_SIZE); | |
22079 | for (var i = 1; i <= blocks; ++i) { | |
22080 | var j = (i - 1) * this.hmac.HMAC_SIZE; | |
22081 | var l = (i < blocks ? 0 : length % this.hmac.HMAC_SIZE) || this.hmac.HMAC_SIZE; | |
22082 | var tmp = new Uint8Array(this.hmac.reset().process(salt).process(new Uint8Array([ i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, i & 255 ])).finish().result); | |
22083 | this.result.set(tmp.subarray(0, l), j); | |
22084 | for (var k = 1; k < count; ++k) { | |
22085 | tmp = new Uint8Array(this.hmac.reset().process(tmp).finish().result); | |
22086 | for (var r = 0; r < l; ++r) this.result[j + r] ^= tmp[r]; | |
22087 | } | |
22088 | } | |
22089 | return this; | |
22090 | } | |
22091 | function pbkdf2_hmac_sha256_generate(salt, count, length) { | |
22092 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
22093 | if (!salt && !is_string(salt)) throw new IllegalArgumentError("bad 'salt' value"); | |
22094 | count = count || this.count; | |
22095 | length = length || this.length; | |
22096 | this.result = new Uint8Array(length); | |
22097 | var blocks = Math.ceil(length / this.hmac.HMAC_SIZE); | |
22098 | for (var i = 1; i <= blocks; ++i) { | |
22099 | var j = (i - 1) * this.hmac.HMAC_SIZE; | |
22100 | var l = (i < blocks ? 0 : length % this.hmac.HMAC_SIZE) || this.hmac.HMAC_SIZE; | |
22101 | this.hmac.reset().process(salt); | |
22102 | this.hmac.hash.asm.pbkdf2_generate_block(this.hmac.hash.pos, this.hmac.hash.len, i, count, 0); | |
22103 | this.result.set(this.hmac.hash.heap.subarray(0, l), j); | |
22104 | } | |
22105 | return this; | |
22106 | } | |
22107 | function pbkdf2_hmac_sha512_generate(salt, count, length) { | |
22108 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
22109 | if (!salt && !is_string(salt)) throw new IllegalArgumentError("bad 'salt' value"); | |
22110 | count = count || this.count; | |
22111 | length = length || this.length; | |
22112 | this.result = new Uint8Array(length); | |
22113 | var blocks = Math.ceil(length / this.hmac.HMAC_SIZE); | |
22114 | for (var i = 1; i <= blocks; ++i) { | |
22115 | var j = (i - 1) * this.hmac.HMAC_SIZE; | |
22116 | var l = (i < blocks ? 0 : length % this.hmac.HMAC_SIZE) || this.hmac.HMAC_SIZE; | |
22117 | this.hmac.reset().process(salt); | |
22118 | this.hmac.hash.asm.pbkdf2_generate_block(this.hmac.hash.pos, this.hmac.hash.len, i, count, 0); | |
22119 | this.result.set(this.hmac.hash.heap.subarray(0, l), j); | |
22120 | } | |
22121 | return this; | |
22122 | } | |
22123 | var pbkdf2_prototype = pbkdf2_constructor.prototype; | |
22124 | pbkdf2_prototype.reset = pbkdf2_reset; | |
22125 | pbkdf2_prototype.generate = pbkdf2_generate; | |
22126 | var pbkdf2_hmac_sha256_prototype = pbkdf2_hmac_sha256_constructor.prototype; | |
22127 | pbkdf2_hmac_sha256_prototype.reset = pbkdf2_reset; | |
22128 | pbkdf2_hmac_sha256_prototype.generate = pbkdf2_hmac_sha256_generate; | |
22129 | var pbkdf2_hmac_sha512_prototype = pbkdf2_hmac_sha512_constructor.prototype; | |
22130 | pbkdf2_hmac_sha512_prototype.reset = pbkdf2_reset; | |
22131 | pbkdf2_hmac_sha512_prototype.generate = pbkdf2_hmac_sha512_generate; | |
22132 | global.IllegalStateError = IllegalStateError; | |
22133 | global.IllegalArgumentError = IllegalArgumentError; | |
22134 | global.SecurityError = SecurityError; | |
22135 | exports.string_to_bytes = string_to_bytes; | |
22136 | exports.hex_to_bytes = hex_to_bytes; | |
22137 | exports.base64_to_bytes = base64_to_bytes; | |
22138 | exports.bytes_to_string = bytes_to_string; | |
22139 | exports.bytes_to_hex = bytes_to_hex; | |
22140 | exports.bytes_to_base64 = bytes_to_base64; | |
22141 | var SHA256_instance = new sha256_constructor({ | |
22142 | heapSize: 1048576 | |
22143 | }); | |
22144 | function sha256_bytes(data) { | |
22145 | if (data === undefined) throw new SyntaxError("data required"); | |
22146 | return SHA256_instance.reset().process(data).finish().result; | |
22147 | } | |
22148 | function sha256_hex(data) { | |
22149 | var result = sha256_bytes(data); | |
22150 | return bytes_to_hex(result); | |
22151 | } | |
22152 | function sha256_base64(data) { | |
22153 | var result = sha256_bytes(data); | |
22154 | return bytes_to_base64(result); | |
22155 | } | |
22156 | exports.SHA256 = { | |
22157 | bytes: sha256_bytes, | |
22158 | hex: sha256_hex, | |
22159 | base64: sha256_base64 | |
22160 | }; | |
22161 | var SHA512_instance = new sha512_constructor({ | |
22162 | heapSize: 1048576 | |
22163 | }); | |
22164 | function sha512_bytes(data) { | |
22165 | if (data === undefined) throw new SyntaxError("data required"); | |
22166 | return SHA512_instance.reset().process(data).finish().result; | |
22167 | } | |
22168 | function sha512_hex(data) { | |
22169 | var result = sha512_bytes(data); | |
22170 | return bytes_to_hex(result); | |
22171 | } | |
22172 | function sha512_base64(data) { | |
22173 | var result = sha512_bytes(data); | |
22174 | return bytes_to_base64(result); | |
22175 | } | |
22176 | exports.SHA512 = { | |
22177 | bytes: sha512_bytes, | |
22178 | hex: sha512_hex, | |
22179 | base64: sha512_base64 | |
22180 | }; | |
22181 | var hmac_sha256_instance = new hmac_sha256_constructor({ | |
22182 | hash: SHA256_instance | |
22183 | }); | |
22184 | function hmac_sha256_bytes(data, password) { | |
22185 | if (data === undefined) throw new SyntaxError("data required"); | |
22186 | if (password === undefined) throw new SyntaxError("password required"); | |
22187 | return hmac_sha256_instance.reset({ | |
22188 | password: password | |
22189 | }).process(data).finish().result; | |
22190 | } | |
22191 | function hmac_sha256_hex(data, password) { | |
22192 | var result = hmac_sha256_bytes(data, password); | |
22193 | return bytes_to_hex(result); | |
22194 | } | |
22195 | function hmac_sha256_base64(data, password) { | |
22196 | var result = hmac_sha256_bytes(data, password); | |
22197 | return bytes_to_base64(result); | |
22198 | } | |
22199 | exports.HMAC = exports.HMAC_SHA256 = { | |
22200 | bytes: hmac_sha256_bytes, | |
22201 | hex: hmac_sha256_hex, | |
22202 | base64: hmac_sha256_base64 | |
22203 | }; | |
22204 | var hmac_sha512_instance = new hmac_sha512_constructor({ | |
22205 | hash: SHA512_instance | |
22206 | }); | |
22207 | function hmac_sha512_bytes(data, password) { | |
22208 | if (data === undefined) throw new SyntaxError("data required"); | |
22209 | if (password === undefined) throw new SyntaxError("password required"); | |
22210 | return hmac_sha512_instance.reset({ | |
22211 | password: password | |
22212 | }).process(data).finish().result; | |
22213 | } | |
22214 | function hmac_sha512_hex(data, password) { | |
22215 | var result = hmac_sha512_bytes(data, password); | |
22216 | return bytes_to_hex(result); | |
22217 | } | |
22218 | function hmac_sha512_base64(data, password) { | |
22219 | var result = hmac_sha512_bytes(data, password); | |
22220 | return bytes_to_base64(result); | |
22221 | } | |
22222 | exports.HMAC_SHA512 = { | |
22223 | bytes: hmac_sha512_bytes, | |
22224 | hex: hmac_sha512_hex, | |
22225 | base64: hmac_sha512_base64 | |
22226 | }; | |
22227 | var pbkdf2_hmac_sha256_instance = new pbkdf2_hmac_sha256_constructor({ | |
22228 | hmac: hmac_sha256_instance | |
22229 | }); | |
22230 | function pbkdf2_hmac_sha256_bytes(password, salt, iterations, dklen) { | |
22231 | if (password === undefined) throw new SyntaxError("password required"); | |
22232 | if (salt === undefined) throw new SyntaxError("salt required"); | |
22233 | return pbkdf2_hmac_sha256_instance.reset({ | |
22234 | password: password | |
22235 | }).generate(salt, iterations, dklen).result; | |
22236 | } | |
22237 | function pbkdf2_hmac_sha256_hex(password, salt, iterations, dklen) { | |
22238 | var result = pbkdf2_hmac_sha256_bytes(password, salt, iterations, dklen); | |
22239 | return bytes_to_hex(result); | |
22240 | } | |
22241 | function pbkdf2_hmac_sha256_base64(password, salt, iterations, dklen) { | |
22242 | var result = pbkdf2_hmac_sha256_bytes(password, salt, iterations, dklen); | |
22243 | return bytes_to_base64(result); | |
22244 | } | |
22245 | exports.PBKDF2 = exports.PBKDF2_HMAC_SHA256 = { | |
22246 | bytes: pbkdf2_hmac_sha256_bytes, | |
22247 | hex: pbkdf2_hmac_sha256_hex, | |
22248 | base64: pbkdf2_hmac_sha256_base64 | |
22249 | }; | |
22250 | var pbkdf2_hmac_sha512_instance = new pbkdf2_hmac_sha512_constructor({ | |
22251 | hmac: hmac_sha512_instance | |
22252 | }); | |
22253 | function pbkdf2_hmac_sha512_bytes(password, salt, iterations, dklen) { | |
22254 | if (password === undefined) throw new SyntaxError("password required"); | |
22255 | if (salt === undefined) throw new SyntaxError("salt required"); | |
22256 | return pbkdf2_hmac_sha512_instance.reset({ | |
22257 | password: password | |
22258 | }).generate(salt, iterations, dklen).result; | |
22259 | } | |
22260 | function pbkdf2_hmac_sha512_hex(password, salt, iterations, dklen) { | |
22261 | var result = pbkdf2_hmac_sha512_bytes(password, salt, iterations, dklen); | |
22262 | return bytes_to_hex(result); | |
22263 | } | |
22264 | function pbkdf2_hmac_sha512_base64(password, salt, iterations, dklen) { | |
22265 | var result = pbkdf2_hmac_sha512_bytes(password, salt, iterations, dklen); | |
22266 | return bytes_to_base64(result); | |
22267 | } | |
22268 | exports.PBKDF2_HMAC_SHA512 = { | |
22269 | bytes: pbkdf2_hmac_sha512_bytes, | |
22270 | hex: pbkdf2_hmac_sha512_hex, | |
22271 | base64: pbkdf2_hmac_sha512_base64 | |
22272 | }; | |
22273 | var cbc_aes_instance = new cbc_aes_constructor({ | |
22274 | heapSize: 1048576 | |
22275 | }); | |
22276 | function cbc_aes_encrypt_bytes(data, key, padding, iv) { | |
22277 | if (data === undefined) throw new SyntaxError("data required"); | |
22278 | if (key === undefined) throw new SyntaxError("key required"); | |
22279 | return cbc_aes_instance.reset({ | |
22280 | key: key, | |
22281 | padding: padding, | |
22282 | iv: iv | |
22283 | }).encrypt(data).result; | |
22284 | } | |
22285 | function cbc_aes_decrypt_bytes(data, key, padding, iv) { | |
22286 | if (data === undefined) throw new SyntaxError("data required"); | |
22287 | if (key === undefined) throw new SyntaxError("key required"); | |
22288 | return cbc_aes_instance.reset({ | |
22289 | key: key, | |
22290 | padding: padding, | |
22291 | iv: iv | |
22292 | }).decrypt(data).result; | |
22293 | } | |
22294 | exports.AES = exports.AES_CBC = { | |
22295 | encrypt: cbc_aes_encrypt_bytes, | |
22296 | decrypt: cbc_aes_decrypt_bytes | |
22297 | }; | |
22298 | var ccm_aes_instance = new ccm_aes_constructor({ | |
22299 | heap: cbc_aes_instance.heap, | |
22300 | asm: cbc_aes_instance.asm | |
22301 | }); | |
22302 | function ccm_aes_encrypt_bytes(data, key, nonce, adata, tagSize) { | |
22303 | if (data === undefined) throw new SyntaxError("data required"); | |
22304 | if (key === undefined) throw new SyntaxError("key required"); | |
22305 | if (nonce === undefined) throw new SyntaxError("nonce required"); | |
22306 | var dataLength = data.byteLength || data.length || 0; | |
22307 | return ccm_aes_instance.reset({ | |
22308 | key: key, | |
22309 | nonce: nonce, | |
22310 | adata: adata, | |
22311 | tagSize: tagSize, | |
22312 | dataLength: dataLength | |
22313 | }).encrypt(data).result; | |
22314 | } | |
22315 | function ccm_aes_decrypt_bytes(data, key, nonce, adata, tagSize) { | |
22316 | if (data === undefined) throw new SyntaxError("data required"); | |
22317 | if (key === undefined) throw new SyntaxError("key required"); | |
22318 | if (nonce === undefined) throw new SyntaxError("nonce required"); | |
22319 | var dataLength = data.byteLength || data.length || 0; | |
22320 | tagSize = tagSize || _aes_block_size; | |
22321 | return ccm_aes_instance.reset({ | |
22322 | key: key, | |
22323 | nonce: nonce, | |
22324 | adata: adata, | |
22325 | tagSize: tagSize, | |
22326 | dataLength: dataLength - tagSize | |
22327 | }).decrypt(data).result; | |
22328 | } | |
22329 | exports.AES_CCM = { | |
22330 | encrypt: ccm_aes_encrypt_bytes, | |
22331 | decrypt: ccm_aes_decrypt_bytes | |
22332 | }; | |
22333 | var cfb_aes_instance = new cfb_aes_constructor({ | |
22334 | heap: cbc_aes_instance.heap, | |
22335 | asm: cbc_aes_instance.asm | |
22336 | }); | |
22337 | function cfb_aes_encrypt_bytes(data, key, padding, iv) { | |
22338 | if (data === undefined) throw new SyntaxError("data required"); | |
22339 | if (key === undefined) throw new SyntaxError("key required"); | |
22340 | return cfb_aes_instance.reset({ | |
22341 | key: key, | |
22342 | padding: padding, | |
22343 | iv: iv | |
22344 | }).encrypt(data).result; | |
22345 | } | |
22346 | function cfb_aes_decrypt_bytes(data, key, padding, iv) { | |
22347 | if (data === undefined) throw new SyntaxError("data required"); | |
22348 | if (key === undefined) throw new SyntaxError("key required"); | |
22349 | return cfb_aes_instance.reset({ | |
22350 | key: key, | |
22351 | padding: padding, | |
22352 | iv: iv | |
22353 | }).decrypt(data).result; | |
22354 | } | |
22355 | exports.AES_CFB = { | |
22356 | encrypt: cfb_aes_encrypt_bytes, | |
22357 | decrypt: cfb_aes_decrypt_bytes | |
22358 | }; | |
22359 | var cfb_aes_decrypt_instance = new cfb_aes_decrypt_constructor({ | |
22360 | heap: cbc_aes_instance.heap, | |
22361 | asm: cbc_aes_instance.asm | |
22362 | }); | |
22363 | function cfb_aes_decrypt_init(key, padding, iv) { | |
22364 | if (key === undefined) throw new SyntaxError("key required"); | |
22365 | return cfb_aes_decrypt_instance.reset({ | |
22366 | key: key, | |
22367 | padding: padding, | |
22368 | iv: iv | |
22369 | }); | |
22370 | } | |
22371 | exports.AES_CFB = exports.AES_CFB || {}; | |
22372 | exports.AES_CFB.decryptor = { | |
22373 | init: cfb_aes_decrypt_init | |
22374 | }; | |
22375 | })({}, function() { | |
22376 | return this; | |
22377 | }()); | |
22378 | </script> | |
22379 | ||
22380 | <!--<script src="/js/jsbip39.js"></script>--> | |
22381 | <script> | |
22382 | /* | |
22383 | * Copyright (c) 2013 Pavol Rusnak | |
22384 | * | |
22385 | * Permission is hereby granted, free of charge, to any person obtaining a copy of | |
22386 | * this software and associated documentation files (the "Software"), to deal in | |
22387 | * the Software without restriction, including without limitation the rights to | |
22388 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | |
22389 | * of the Software, and to permit persons to whom the Software is furnished to do | |
22390 | * so, subject to the following conditions: | |
22391 | * | |
22392 | * The above copyright notice and this permission notice shall be included in all | |
22393 | * copies or substantial portions of the Software. | |
22394 | * | |
22395 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
22396 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
22397 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
22398 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |
22399 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |
22400 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
22401 | */ | |
22402 | ||
22403 | /* | |
22404 | * Javascript port from python by Ian Coleman | |
22405 | * | |
22406 | * Includes code from asmCrypto | |
22407 | * https://github.com/tresorit/asmcrypto.js | |
22408 | */ | |
22409 | ||
22410 | var Mnemonic = function(language) { | |
22411 | ||
22412 | var PBKDF2_ROUNDS = 2048; | |
22413 | var RADIX = 2048; | |
22414 | ||
22415 | var self = this; | |
22416 | var wordlist = []; | |
22417 | ||
22418 | function init() { | |
22419 | wordlist = WORDLISTS[language]; | |
22420 | if (wordlist.length != RADIX) { | |
22421 | err = 'Wordlist should contain ' + RADIX + ' words, but it contains ' + wordlist.length + ' words.'; | |
22422 | throw err; | |
22423 | } | |
22424 | } | |
22425 | ||
22426 | self.generate = function(strength) { | |
22427 | strength = strength || 128; | |
22428 | var r = strength % 32; | |
22429 | if (r > 0) { | |
22430 | throw 'Strength should be divisible by 32, but it is not (' + r + ').'; | |
22431 | } | |
22432 | var hasStrongCrypto = 'crypto' in window && window['crypto'] !== null; | |
22433 | if (!hasStrongCrypto) { | |
22434 | throw 'Mnemonic should be generated with strong randomness, but crypto.getRandomValues is unavailable'; | |
22435 | } | |
22436 | var buffer = new Uint8Array(strength / 8); | |
22437 | var data = crypto.getRandomValues(buffer); | |
22438 | return self.toMnemonic(data); | |
22439 | } | |
22440 | ||
22441 | self.toMnemonic = function(data) { | |
22442 | if (data.length % 4 > 0) { | |
22443 | throw 'Data length in bits should be divisible by 32, but it is not (' + data.length + ' bytes = ' + data.length*8 + ' bits).' | |
22444 | } | |
22445 | ||
22446 | //h = hashlib.sha256(data).hexdigest() | |
22447 | var uintArray = new Uint8Array(data); | |
22448 | var h = asmCrypto.SHA256.bytes(uintArray); | |
22449 | ||
22450 | // b is a binary string, eg '00111010101100...' | |
22451 | //b = bin(int(binascii.hexlify(data), 16))[2:].zfill(len(data) * 8) + \ | |
22452 | // bin(int(h, 16))[2:].zfill(256)[:len(data) * 8 / 32] | |
22453 | // | |
22454 | // a = bin(int(binascii.hexlify(data), 16))[2:].zfill(len(data) * 8) | |
22455 | // c = bin(int(h, 16))[2:].zfill(256) | |
22456 | // d = c[:len(data) * 8 / 32] | |
22457 | var a = byteArrayToBinaryString(data); | |
22458 | var c = byteArrayToBinaryString(h); | |
22459 | var d = c.substring(0, data.length * 8 / 32); | |
22460 | // b = line1 + line2 | |
22461 | var b = a + d; | |
22462 | ||
22463 | var result = []; | |
22464 | var blen = b.length / 11; | |
22465 | for (var i=0; i<blen; i++) { | |
22466 | var idx = parseInt(b.substring(i * 11, (i + 1) * 11), 2); | |
22467 | result.push(wordlist[idx]); | |
22468 | } | |
22469 | return result.join(' '); | |
22470 | } | |
22471 | ||
22472 | self.check = function(mnemonic) { | |
22473 | var mnemonic = mnemonic.split(' ') | |
22474 | if (mnemonic.length % 3 > 0) { | |
22475 | return false | |
22476 | } | |
22477 | // idx = map(lambda x: bin(self.wordlist.index(x))[2:].zfill(11), mnemonic) | |
22478 | var idx = []; | |
22479 | for (var i=0; i<mnemonic.length; i++) { | |
22480 | var word = mnemonic[i]; | |
22481 | var wordIndex = wordlist.indexOf(word); | |
22482 | if (wordIndex == -1) { | |
22483 | return false; | |
22484 | } | |
22485 | var binaryIndex = zfill(wordIndex.toString(2), 11); | |
22486 | idx.push(binaryIndex); | |
22487 | } | |
22488 | var b = idx.join(''); | |
22489 | var l = b.length; | |
22490 | //d = b[:l / 33 * 32] | |
22491 | //h = b[-l / 33:] | |
22492 | var d = b.substring(0, l / 33 * 32); | |
22493 | var h = b.substring(l - l / 33, l); | |
22494 | //nd = binascii.unhexlify(hex(int(d, 2))[2:].rstrip('L').zfill(l / 33 * 8)) | |
22495 | //nh = bin(int(hashlib.sha256(nd).hexdigest(), 16))[2:].zfill(256)[:l / 33] | |
22496 | var nd = binaryStringToByteArray(d); | |
22497 | var ndHash = asmCrypto.SHA256.bytes(nd); | |
22498 | var ndBstr = zfill(byteArrayToBinaryString(ndHash), 256); | |
22499 | var nh = ndBstr.substring(0,l/33); | |
22500 | return h == nh; | |
22501 | } | |
22502 | ||
22503 | self.toSeed = function(mnemonic, passphrase) { | |
22504 | passphrase = passphrase || ''; | |
22505 | mnemonic = normalizeString(mnemonic) | |
22506 | passphrase = normalizeString(passphrase) | |
22507 | passphrase = "mnemonic" + passphrase; | |
22508 | //return PBKDF2(mnemonic, 'mnemonic' + passphrase, iterations=PBKDF2_ROUNDS, macmodule=hmac, digestmodule=hashlib.sha512).read(64) | |
22509 | return asmCrypto.PBKDF2_HMAC_SHA512.hex(mnemonic, passphrase, PBKDF2_ROUNDS, 512/8); | |
22510 | } | |
22511 | ||
22512 | function normalizeString(str) { | |
22513 | if (typeof str.normalize == "function") { | |
22514 | return str.normalize("NFKD"); | |
22515 | } | |
22516 | else { | |
22517 | // TODO find a library to do this | |
22518 | // Not supported on firefox mobile | |
22519 | console.warn("NFKD Normalization is unavailable"); | |
22520 | return str; | |
22521 | } | |
22522 | } | |
22523 | ||
22524 | function byteArrayToBinaryString(data) { | |
22525 | var bin = ""; | |
22526 | for (var i=0; i<data.length; i++) { | |
22527 | bin += zfill(data[i].toString(2), 8); | |
22528 | } | |
22529 | return bin; | |
22530 | } | |
22531 | ||
22532 | function binaryStringToByteArray(str) { | |
22533 | var arrayLen = str.length / 8; | |
22534 | var array = new Uint8Array(arrayLen); | |
22535 | for (var i=0; i<arrayLen; i++) { | |
22536 | var valueStr = str.substring(0,8); | |
22537 | var value = parseInt(valueStr, 2); | |
22538 | array[i] = value; | |
22539 | str = str.slice(8); | |
22540 | } | |
22541 | return array; | |
22542 | } | |
22543 | ||
22544 | // Pad a numeric string on the left with zero digits until the given width | |
22545 | // is reached. | |
22546 | // Note this differs to the python implementation because it does not | |
22547 | // handle numbers starting with a sign. | |
22548 | function zfill(source, length) { | |
22549 | source = source.toString(); | |
22550 | while (source.length < length) { | |
22551 | source = '0' + source; | |
22552 | } | |
22553 | return source; | |
22554 | } | |
22555 | ||
22556 | init(); | |
22557 | ||
22558 | } | |
22559 | ||
22560 | WORDLISTS = { | |
22561 | "english": [ | |
22562 | "abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse", | |
22563 | "access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act", | |
22564 | "action","actor","actress","actual","adapt","add","addict","address","adjust","admit", | |
22565 | "adult","advance","advice","aerobic","affair","afford","afraid","again","age","agent", | |
22566 | "agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert", | |
22567 | "alien","all","alley","allow","almost","alone","alpha","already","also","alter", | |
22568 | "always","amateur","amazing","among","amount","amused","analyst","anchor","ancient","anger", | |
22569 | "angle","angry","animal","ankle","announce","annual","another","answer","antenna","antique", | |
22570 | "anxiety","any","apart","apology","appear","apple","approve","april","arch","arctic", | |
22571 | "area","arena","argue","arm","armed","armor","army","around","arrange","arrest", | |
22572 | "arrive","arrow","art","artefact","artist","artwork","ask","aspect","assault","asset", | |
22573 | "assist","assume","asthma","athlete","atom","attack","attend","attitude","attract","auction", | |
22574 | "audit","august","aunt","author","auto","autumn","average","avocado","avoid","awake", | |
22575 | "aware","away","awesome","awful","awkward","axis","baby","bachelor","bacon","badge", | |
22576 | "bag","balance","balcony","ball","bamboo","banana","banner","bar","barely","bargain", | |
22577 | "barrel","base","basic","basket","battle","beach","bean","beauty","because","become", | |
22578 | "beef","before","begin","behave","behind","believe","below","belt","bench","benefit", | |
22579 | "best","betray","better","between","beyond","bicycle","bid","bike","bind","biology", | |
22580 | "bird","birth","bitter","black","blade","blame","blanket","blast","bleak","bless", | |
22581 | "blind","blood","blossom","blouse","blue","blur","blush","board","boat","body", | |
22582 | "boil","bomb","bone","bonus","book","boost","border","boring","borrow","boss", | |
22583 | "bottom","bounce","box","boy","bracket","brain","brand","brass","brave","bread", | |
22584 | "breeze","brick","bridge","brief","bright","bring","brisk","broccoli","broken","bronze", | |
22585 | "broom","brother","brown","brush","bubble","buddy","budget","buffalo","build","bulb", | |
22586 | "bulk","bullet","bundle","bunker","burden","burger","burst","bus","business","busy", | |
22587 | "butter","buyer","buzz","cabbage","cabin","cable","cactus","cage","cake","call", | |
22588 | "calm","camera","camp","can","canal","cancel","candy","cannon","canoe","canvas", | |
22589 | "canyon","capable","capital","captain","car","carbon","card","cargo","carpet","carry", | |
22590 | "cart","case","cash","casino","castle","casual","cat","catalog","catch","category", | |
22591 | "cattle","caught","cause","caution","cave","ceiling","celery","cement","census","century", | |
22592 | "cereal","certain","chair","chalk","champion","change","chaos","chapter","charge","chase", | |
22593 | "chat","cheap","check","cheese","chef","cherry","chest","chicken","chief","child", | |
22594 | "chimney","choice","choose","chronic","chuckle","chunk","churn","cigar","cinnamon","circle", | |
22595 | "citizen","city","civil","claim","clap","clarify","claw","clay","clean","clerk", | |
22596 | "clever","click","client","cliff","climb","clinic","clip","clock","clog","close", | |
22597 | "cloth","cloud","clown","club","clump","cluster","clutch","coach","coast","coconut", | |
22598 | "code","coffee","coil","coin","collect","color","column","combine","come","comfort", | |
22599 | "comic","common","company","concert","conduct","confirm","congress","connect","consider","control", | |
22600 | "convince","cook","cool","copper","copy","coral","core","corn","correct","cost", | |
22601 | "cotton","couch","country","couple","course","cousin","cover","coyote","crack","cradle", | |
22602 | "craft","cram","crane","crash","crater","crawl","crazy","cream","credit","creek", | |
22603 | "crew","cricket","crime","crisp","critic","crop","cross","crouch","crowd","crucial", | |
22604 | "cruel","cruise","crumble","crunch","crush","cry","crystal","cube","culture","cup", | |
22605 | "cupboard","curious","current","curtain","curve","cushion","custom","cute","cycle","dad", | |
22606 | "damage","damp","dance","danger","daring","dash","daughter","dawn","day","deal", | |
22607 | "debate","debris","decade","december","decide","decline","decorate","decrease","deer","defense", | |
22608 | "define","defy","degree","delay","deliver","demand","demise","denial","dentist","deny", | |
22609 | "depart","depend","deposit","depth","deputy","derive","describe","desert","design","desk", | |
22610 | "despair","destroy","detail","detect","develop","device","devote","diagram","dial","diamond", | |
22611 | "diary","dice","diesel","diet","differ","digital","dignity","dilemma","dinner","dinosaur", | |
22612 | "direct","dirt","disagree","discover","disease","dish","dismiss","disorder","display","distance", | |
22613 | "divert","divide","divorce","dizzy","doctor","document","dog","doll","dolphin","domain", | |
22614 | "donate","donkey","donor","door","dose","double","dove","draft","dragon","drama", | |
22615 | "drastic","draw","dream","dress","drift","drill","drink","drip","drive","drop", | |
22616 | "drum","dry","duck","dumb","dune","during","dust","dutch","duty","dwarf", | |
22617 | "dynamic","eager","eagle","early","earn","earth","easily","east","easy","echo", | |
22618 | "ecology","economy","edge","edit","educate","effort","egg","eight","either","elbow", | |
22619 | "elder","electric","elegant","element","elephant","elevator","elite","else","embark","embody", | |
22620 | "embrace","emerge","emotion","employ","empower","empty","enable","enact","end","endless", | |
22621 | "endorse","enemy","energy","enforce","engage","engine","enhance","enjoy","enlist","enough", | |
22622 | "enrich","enroll","ensure","enter","entire","entry","envelope","episode","equal","equip", | |
22623 | "era","erase","erode","erosion","error","erupt","escape","essay","essence","estate", | |
22624 | "eternal","ethics","evidence","evil","evoke","evolve","exact","example","excess","exchange", | |
22625 | "excite","exclude","excuse","execute","exercise","exhaust","exhibit","exile","exist","exit", | |
22626 | "exotic","expand","expect","expire","explain","expose","express","extend","extra","eye", | |
22627 | "eyebrow","fabric","face","faculty","fade","faint","faith","fall","false","fame", | |
22628 | "family","famous","fan","fancy","fantasy","farm","fashion","fat","fatal","father", | |
22629 | "fatigue","fault","favorite","feature","february","federal","fee","feed","feel","female", | |
22630 | "fence","festival","fetch","fever","few","fiber","fiction","field","figure","file", | |
22631 | "film","filter","final","find","fine","finger","finish","fire","firm","first", | |
22632 | "fiscal","fish","fit","fitness","fix","flag","flame","flash","flat","flavor", | |
22633 | "flee","flight","flip","float","flock","floor","flower","fluid","flush","fly", | |
22634 | "foam","focus","fog","foil","fold","follow","food","foot","force","forest", | |
22635 | "forget","fork","fortune","forum","forward","fossil","foster","found","fox","fragile", | |
22636 | "frame","frequent","fresh","friend","fringe","frog","front","frost","frown","frozen", | |
22637 | "fruit","fuel","fun","funny","furnace","fury","future","gadget","gain","galaxy", | |
22638 | "gallery","game","gap","garage","garbage","garden","garlic","garment","gas","gasp", | |
22639 | "gate","gather","gauge","gaze","general","genius","genre","gentle","genuine","gesture", | |
22640 | "ghost","giant","gift","giggle","ginger","giraffe","girl","give","glad","glance", | |
22641 | "glare","glass","glide","glimpse","globe","gloom","glory","glove","glow","glue", | |
22642 | "goat","goddess","gold","good","goose","gorilla","gospel","gossip","govern","gown", | |
22643 | "grab","grace","grain","grant","grape","grass","gravity","great","green","grid", | |
22644 | "grief","grit","grocery","group","grow","grunt","guard","guess","guide","guilt", | |
22645 | "guitar","gun","gym","habit","hair","half","hammer","hamster","hand","happy", | |
22646 | "harbor","hard","harsh","harvest","hat","have","hawk","hazard","head","health", | |
22647 | "heart","heavy","hedgehog","height","hello","helmet","help","hen","hero","hidden", | |
22648 | "high","hill","hint","hip","hire","history","hobby","hockey","hold","hole", | |
22649 | "holiday","hollow","home","honey","hood","hope","horn","horror","horse","hospital", | |
22650 | "host","hotel","hour","hover","hub","huge","human","humble","humor","hundred", | |
22651 | "hungry","hunt","hurdle","hurry","hurt","husband","hybrid","ice","icon","idea", | |
22652 | "identify","idle","ignore","ill","illegal","illness","image","imitate","immense","immune", | |
22653 | "impact","impose","improve","impulse","inch","include","income","increase","index","indicate", | |
22654 | "indoor","industry","infant","inflict","inform","inhale","inherit","initial","inject","injury", | |
22655 | "inmate","inner","innocent","input","inquiry","insane","insect","inside","inspire","install", | |
22656 | "intact","interest","into","invest","invite","involve","iron","island","isolate","issue", | |
22657 | "item","ivory","jacket","jaguar","jar","jazz","jealous","jeans","jelly","jewel", | |
22658 | "job","join","joke","journey","joy","judge","juice","jump","jungle","junior", | |
22659 | "junk","just","kangaroo","keen","keep","ketchup","key","kick","kid","kidney", | |
22660 | "kind","kingdom","kiss","kit","kitchen","kite","kitten","kiwi","knee","knife", | |
22661 | "knock","know","lab","label","labor","ladder","lady","lake","lamp","language", | |
22662 | "laptop","large","later","latin","laugh","laundry","lava","law","lawn","lawsuit", | |
22663 | "layer","lazy","leader","leaf","learn","leave","lecture","left","leg","legal", | |
22664 | "legend","leisure","lemon","lend","length","lens","leopard","lesson","letter","level", | |
22665 | "liar","liberty","library","license","life","lift","light","like","limb","limit", | |
22666 | "link","lion","liquid","list","little","live","lizard","load","loan","lobster", | |
22667 | "local","lock","logic","lonely","long","loop","lottery","loud","lounge","love", | |
22668 | "loyal","lucky","luggage","lumber","lunar","lunch","luxury","lyrics","machine","mad", | |
22669 | "magic","magnet","maid","mail","main","major","make","mammal","man","manage", | |
22670 | "mandate","mango","mansion","manual","maple","marble","march","margin","marine","market", | |
22671 | "marriage","mask","mass","master","match","material","math","matrix","matter","maximum", | |
22672 | "maze","meadow","mean","measure","meat","mechanic","medal","media","melody","melt", | |
22673 | "member","memory","mention","menu","mercy","merge","merit","merry","mesh","message", | |
22674 | "metal","method","middle","midnight","milk","million","mimic","mind","minimum","minor", | |
22675 | "minute","miracle","mirror","misery","miss","mistake","mix","mixed","mixture","mobile", | |
22676 | "model","modify","mom","moment","monitor","monkey","monster","month","moon","moral", | |
22677 | "more","morning","mosquito","mother","motion","motor","mountain","mouse","move","movie", | |
22678 | "much","muffin","mule","multiply","muscle","museum","mushroom","music","must","mutual", | |
22679 | "myself","mystery","myth","naive","name","napkin","narrow","nasty","nation","nature", | |
22680 | "near","neck","need","negative","neglect","neither","nephew","nerve","nest","net", | |
22681 | "network","neutral","never","news","next","nice","night","noble","noise","nominee", | |
22682 | "noodle","normal","north","nose","notable","note","nothing","notice","novel","now", | |
22683 | "nuclear","number","nurse","nut","oak","obey","object","oblige","obscure","observe", | |
22684 | "obtain","obvious","occur","ocean","october","odor","off","offer","office","often", | |
22685 | "oil","okay","old","olive","olympic","omit","once","one","onion","online", | |
22686 | "only","open","opera","opinion","oppose","option","orange","orbit","orchard","order", | |
22687 | "ordinary","organ","orient","original","orphan","ostrich","other","outdoor","outer","output", | |
22688 | "outside","oval","oven","over","own","owner","oxygen","oyster","ozone","pact", | |
22689 | "paddle","page","pair","palace","palm","panda","panel","panic","panther","paper", | |
22690 | "parade","parent","park","parrot","party","pass","patch","path","patient","patrol", | |
22691 | "pattern","pause","pave","payment","peace","peanut","pear","peasant","pelican","pen", | |
22692 | "penalty","pencil","people","pepper","perfect","permit","person","pet","phone","photo", | |
22693 | "phrase","physical","piano","picnic","picture","piece","pig","pigeon","pill","pilot", | |
22694 | "pink","pioneer","pipe","pistol","pitch","pizza","place","planet","plastic","plate", | |
22695 | "play","please","pledge","pluck","plug","plunge","poem","poet","point","polar", | |
22696 | "pole","police","pond","pony","pool","popular","portion","position","possible","post", | |
22697 | "potato","pottery","poverty","powder","power","practice","praise","predict","prefer","prepare", | |
22698 | "present","pretty","prevent","price","pride","primary","print","priority","prison","private", | |
22699 | "prize","problem","process","produce","profit","program","project","promote","proof","property", | |
22700 | "prosper","protect","proud","provide","public","pudding","pull","pulp","pulse","pumpkin", | |
22701 | "punch","pupil","puppy","purchase","purity","purpose","purse","push","put","puzzle", | |
22702 | "pyramid","quality","quantum","quarter","question","quick","quit","quiz","quote","rabbit", | |
22703 | "raccoon","race","rack","radar","radio","rail","rain","raise","rally","ramp", | |
22704 | "ranch","random","range","rapid","rare","rate","rather","raven","raw","razor", | |
22705 | "ready","real","reason","rebel","rebuild","recall","receive","recipe","record","recycle", | |
22706 | "reduce","reflect","reform","refuse","region","regret","regular","reject","relax","release", | |
22707 | "relief","rely","remain","remember","remind","remove","render","renew","rent","reopen", | |
22708 | "repair","repeat","replace","report","require","rescue","resemble","resist","resource","response", | |
22709 | "result","retire","retreat","return","reunion","reveal","review","reward","rhythm","rib", | |
22710 | "ribbon","rice","rich","ride","ridge","rifle","right","rigid","ring","riot", | |
22711 | "ripple","risk","ritual","rival","river","road","roast","robot","robust","rocket", | |
22712 | "romance","roof","rookie","room","rose","rotate","rough","round","route","royal", | |
22713 | "rubber","rude","rug","rule","run","runway","rural","sad","saddle","sadness", | |
22714 | "safe","sail","salad","salmon","salon","salt","salute","same","sample","sand", | |
22715 | "satisfy","satoshi","sauce","sausage","save","say","scale","scan","scare","scatter", | |
22716 | "scene","scheme","school","science","scissors","scorpion","scout","scrap","screen","script", | |
22717 | "scrub","sea","search","season","seat","second","secret","section","security","seed", | |
22718 | "seek","segment","select","sell","seminar","senior","sense","sentence","series","service", | |
22719 | "session","settle","setup","seven","shadow","shaft","shallow","share","shed","shell", | |
22720 | "sheriff","shield","shift","shine","ship","shiver","shock","shoe","shoot","shop", | |
22721 | "short","shoulder","shove","shrimp","shrug","shuffle","shy","sibling","sick","side", | |
22722 | "siege","sight","sign","silent","silk","silly","silver","similar","simple","since", | |
22723 | "sing","siren","sister","situate","six","size","skate","sketch","ski","skill", | |
22724 | "skin","skirt","skull","slab","slam","sleep","slender","slice","slide","slight", | |
22725 | "slim","slogan","slot","slow","slush","small","smart","smile","smoke","smooth", | |
22726 | "snack","snake","snap","sniff","snow","soap","soccer","social","sock","soda", | |
22727 | "soft","solar","soldier","solid","solution","solve","someone","song","soon","sorry", | |
22728 | "sort","soul","sound","soup","source","south","space","spare","spatial","spawn", | |
22729 | "speak","special","speed","spell","spend","sphere","spice","spider","spike","spin", | |
22730 | "spirit","split","spoil","sponsor","spoon","sport","spot","spray","spread","spring", | |
22731 | "spy","square","squeeze","squirrel","stable","stadium","staff","stage","stairs","stamp", | |
22732 | "stand","start","state","stay","steak","steel","stem","step","stereo","stick", | |
22733 | "still","sting","stock","stomach","stone","stool","story","stove","strategy","street", | |
22734 | "strike","strong","struggle","student","stuff","stumble","style","subject","submit","subway", | |
22735 | "success","such","sudden","suffer","sugar","suggest","suit","summer","sun","sunny", | |
22736 | "sunset","super","supply","supreme","sure","surface","surge","surprise","surround","survey", | |
22737 | "suspect","sustain","swallow","swamp","swap","swarm","swear","sweet","swift","swim", | |
22738 | "swing","switch","sword","symbol","symptom","syrup","system","table","tackle","tag", | |
22739 | "tail","talent","talk","tank","tape","target","task","taste","tattoo","taxi", | |
22740 | "teach","team","tell","ten","tenant","tennis","tent","term","test","text", | |
22741 | "thank","that","theme","then","theory","there","they","thing","this","thought", | |
22742 | "three","thrive","throw","thumb","thunder","ticket","tide","tiger","tilt","timber", | |
22743 | "time","tiny","tip","tired","tissue","title","toast","tobacco","today","toddler", | |
22744 | "toe","together","toilet","token","tomato","tomorrow","tone","tongue","tonight","tool", | |
22745 | "tooth","top","topic","topple","torch","tornado","tortoise","toss","total","tourist", | |
22746 | "toward","tower","town","toy","track","trade","traffic","tragic","train","transfer", | |
22747 | "trap","trash","travel","tray","treat","tree","trend","trial","tribe","trick", | |
22748 | "trigger","trim","trip","trophy","trouble","truck","true","truly","trumpet","trust", | |
22749 | "truth","try","tube","tuition","tumble","tuna","tunnel","turkey","turn","turtle", | |
22750 | "twelve","twenty","twice","twin","twist","two","type","typical","ugly","umbrella", | |
22751 | "unable","unaware","uncle","uncover","under","undo","unfair","unfold","unhappy","uniform", | |
22752 | "unique","unit","universe","unknown","unlock","until","unusual","unveil","update","upgrade", | |
22753 | "uphold","upon","upper","upset","urban","urge","usage","use","used","useful", | |
22754 | "useless","usual","utility","vacant","vacuum","vague","valid","valley","valve","van", | |
22755 | "vanish","vapor","various","vast","vault","vehicle","velvet","vendor","venture","venue", | |
22756 | "verb","verify","version","very","vessel","veteran","viable","vibrant","vicious","victory", | |
22757 | "video","view","village","vintage","violin","virtual","virus","visa","visit","visual", | |
22758 | "vital","vivid","vocal","voice","void","volcano","volume","vote","voyage","wage", | |
22759 | "wagon","wait","walk","wall","walnut","want","warfare","warm","warrior","wash", | |
22760 | "wasp","waste","water","wave","way","wealth","weapon","wear","weasel","weather", | |
22761 | "web","wedding","weekend","weird","welcome","west","wet","whale","what","wheat", | |
22762 | "wheel","when","where","whip","whisper","wide","width","wife","wild","will", | |
22763 | "win","window","wine","wing","wink","winner","winter","wire","wisdom","wise", | |
22764 | "wish","witness","wolf","woman","wonder","wood","wool","word","work","world", | |
22765 | "worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year", | |
22766 | "yellow","you","young","youth","zebra","zero","zone","zoo"] | |
22767 | }; | |
22768 | </script> | |
22769 | ||
22770 | <!--<script src="/js/index.js"></script>--> | |
22771 | <script> | |
22772 | (function() { | |
22773 | ||
22774 | var mnemonic = new Mnemonic("english"); | |
22775 | var bip32RootKey = null; | |
22776 | var bip32ExtendedKey = null; | |
22777 | var network = Bitcoin.networks.bitcoin; | |
22778 | var addressRowTemplate = $("#address-row-template"); | |
22779 | ||
22780 | var phraseChangeTimeoutEvent = null; | |
22781 | ||
22782 | var DOM = {}; | |
22783 | DOM.phrase = $(".phrase"); | |
721b7284 | 22784 | DOM.passphrase = $(".passphrase"); |
ebd8d4e8 IC |
22785 | DOM.generate = $(".generate"); |
22786 | DOM.rootKey = $(".root-key"); | |
22787 | DOM.extendedPrivKey = $(".extended-priv-key"); | |
22788 | DOM.extendedPubKey = $(".extended-pub-key"); | |
22789 | DOM.bip32path = $("#bip32-path"); | |
22790 | DOM.bip44path = $("#bip44-path"); | |
22791 | DOM.bip44purpose = $("#bip44 .purpose"); | |
22792 | DOM.bip44coin = $("#bip44 .coin"); | |
22793 | DOM.bip44account = $("#bip44 .account"); | |
22794 | DOM.bip44change = $("#bip44 .change"); | |
22795 | DOM.strength = $(".strength"); | |
22796 | DOM.addresses = $(".addresses"); | |
22797 | DOM.rowsToAdd = $(".rows-to-add"); | |
22798 | DOM.more = $(".more"); | |
22799 | DOM.feedback = $(".feedback"); | |
22800 | DOM.tab = $(".derivation-type a"); | |
22801 | DOM.indexToggle = $(".index-toggle"); | |
22802 | DOM.addressToggle = $(".address-toggle"); | |
22803 | DOM.privateKeyToggle = $(".private-key-toggle"); | |
22804 | ||
22805 | var derivationPath = DOM.bip44path.val(); | |
22806 | ||
22807 | function init() { | |
22808 | // Events | |
22809 | DOM.phrase.on("keyup", delayedPhraseChanged); | |
721b7284 | 22810 | DOM.passphrase.on("keyup", delayedPhraseChanged); |
ebd8d4e8 IC |
22811 | DOM.generate.on("click", generateClicked); |
22812 | DOM.more.on("click", showMore); | |
22813 | DOM.bip32path.on("keyup", bip32Changed); | |
22814 | DOM.bip44purpose.on("keyup", bip44Changed); | |
22815 | DOM.bip44coin.on("keyup", bip44Changed); | |
22816 | DOM.bip44account.on("keyup", bip44Changed); | |
22817 | DOM.bip44change.on("keyup", bip44Changed); | |
22818 | DOM.tab.on("click", tabClicked); | |
22819 | DOM.indexToggle.on("click", toggleIndexes); | |
22820 | DOM.addressToggle.on("click", toggleAddresses); | |
22821 | DOM.privateKeyToggle.on("click", togglePrivateKeys); | |
22822 | disableForms(); | |
22823 | hidePending(); | |
22824 | hideValidationError(); | |
22825 | } | |
22826 | ||
22827 | // Event handlers | |
22828 | ||
22829 | function delayedPhraseChanged() { | |
22830 | hideValidationError(); | |
22831 | showPending(); | |
22832 | if (phraseChangeTimeoutEvent != null) { | |
22833 | clearTimeout(phraseChangeTimeoutEvent); | |
22834 | } | |
22835 | phraseChangeTimeoutEvent = setTimeout(phraseChanged, 400); | |
22836 | } | |
22837 | ||
22838 | function phraseChanged() { | |
22839 | showPending(); | |
22840 | hideValidationError(); | |
22841 | // Get the mnemonic phrase | |
22842 | var phrase = DOM.phrase.val(); | |
721b7284 | 22843 | var passphrase = DOM.passphrase.val(); |
ebd8d4e8 IC |
22844 | var errorText = findPhraseErrors(phrase); |
22845 | if (errorText) { | |
22846 | showValidationError(errorText); | |
22847 | return; | |
22848 | } | |
22849 | // Get the derivation path | |
22850 | var errorText = findDerivationPathErrors(); | |
22851 | if (errorText) { | |
22852 | showValidationError(errorText); | |
22853 | return; | |
22854 | } | |
22855 | // Calculate and display | |
721b7284 | 22856 | calcBip32Seed(phrase, passphrase, derivationPath); |
ebd8d4e8 IC |
22857 | displayBip32Info(); |
22858 | hidePending(); | |
22859 | } | |
22860 | ||
22861 | function generateClicked() { | |
22862 | clearDisplay(); | |
22863 | showPending(); | |
22864 | setTimeout(function() { | |
22865 | var phrase = generateRandomPhrase(); | |
22866 | if (!phrase) { | |
22867 | return; | |
22868 | } | |
22869 | phraseChanged(); | |
22870 | }, 50); | |
22871 | } | |
22872 | ||
22873 | function tabClicked(e) { | |
22874 | var activePath = $(e.target.getAttribute("href") + " .path"); | |
22875 | derivationPath = activePath.val(); | |
22876 | derivationChanged(); | |
22877 | } | |
22878 | ||
22879 | function derivationChanged() { | |
22880 | delayedPhraseChanged(); | |
22881 | } | |
22882 | ||
22883 | function bip32Changed() { | |
22884 | derivationPath = DOM.bip32path.val(); | |
22885 | derivationChanged(); | |
22886 | } | |
22887 | ||
22888 | function bip44Changed() { | |
22889 | setBip44DerivationPath(); | |
22890 | derivationPath = DOM.bip44path.val(); | |
22891 | derivationChanged(); | |
22892 | } | |
22893 | ||
22894 | function toggleIndexes() { | |
22895 | $("td.index span").toggleClass("invisible"); | |
22896 | } | |
22897 | ||
22898 | function toggleAddresses() { | |
22899 | $("td.address span").toggleClass("invisible"); | |
22900 | } | |
22901 | ||
22902 | function togglePrivateKeys() { | |
22903 | $("td.privkey span").toggleClass("invisible"); | |
22904 | } | |
22905 | ||
22906 | // Private methods | |
22907 | ||
22908 | function generateRandomPhrase() { | |
22909 | if (!hasStrongRandom()) { | |
22910 | var errorText = "This browser does not support strong randomness"; | |
22911 | showValidationError(errorText); | |
22912 | return; | |
22913 | } | |
22914 | var numWords = parseInt(DOM.strength.val()); | |
22915 | // Check strength is an integer | |
22916 | if (isNaN(numWords)) { | |
22917 | DOM.strength.val("12"); | |
22918 | numWords = 12; | |
22919 | } | |
22920 | // Check strength is a multiple of 32, if not round it down | |
22921 | if (numWords % 3 != 0) { | |
22922 | numWords = Math.floor(numWords / 3) * 3; | |
22923 | DOM.strength.val(numWords); | |
22924 | } | |
22925 | // Check strength is at least 32 | |
22926 | if (numWords == 0) { | |
22927 | numWords = 3; | |
22928 | DOM.strength.val(numWords); | |
22929 | } | |
22930 | var strength = numWords / 3 * 32; | |
22931 | var words = mnemonic.generate(strength); | |
22932 | DOM.phrase.val(words); | |
22933 | return words; | |
22934 | } | |
22935 | ||
721b7284 IC |
22936 | function calcBip32Seed(phrase, passphrase, path) { |
22937 | var seed = mnemonic.toSeed(phrase, passphrase); | |
ebd8d4e8 IC |
22938 | var seedHash = Bitcoin.crypto.sha256(seed).toString("hex"); |
22939 | bip32RootKey = Bitcoin.HDNode.fromSeedHex(seedHash, network); | |
22940 | bip32ExtendedKey = bip32RootKey; | |
22941 | // Derive the key from the path | |
22942 | var pathBits = path.split("/"); | |
22943 | for (var i=0; i<pathBits.length; i++) { | |
22944 | var bit = pathBits[i]; | |
22945 | var index = parseInt(bit); | |
22946 | if (isNaN(index)) { | |
22947 | continue; | |
22948 | } | |
22949 | var hardened = bit[bit.length-1] == "'"; | |
22950 | if (hardened) { | |
22951 | bip32ExtendedKey = bip32ExtendedKey.deriveHardened(index); | |
22952 | } | |
22953 | else { | |
22954 | bip32ExtendedKey = bip32ExtendedKey.derive(index); | |
22955 | } | |
22956 | } | |
22957 | } | |
22958 | ||
22959 | function showValidationError(errorText) { | |
22960 | DOM.feedback | |
22961 | .text(errorText) | |
22962 | .show(); | |
22963 | } | |
22964 | ||
22965 | function hideValidationError() { | |
22966 | DOM.feedback | |
22967 | .text("") | |
22968 | .hide(); | |
22969 | } | |
22970 | ||
22971 | function findPhraseErrors(phrase) { | |
22972 | // TODO make this right | |
22973 | // Preprocess the words | |
22974 | var parts = phrase.split(" "); | |
22975 | var proper = []; | |
22976 | for (var i=0; i<parts.length; i++) { | |
22977 | var part = parts[i]; | |
22978 | if (part.length > 0) { | |
22979 | // TODO check that lowercasing is always valid to do | |
22980 | proper.push(part.toLowerCase()); | |
22981 | } | |
22982 | } | |
22983 | // TODO some levenstein on the words | |
22984 | var properPhrase = proper.join(' '); | |
22985 | // Check the words are valid | |
22986 | var isValid = mnemonic.check(properPhrase); | |
22987 | if (!isValid) { | |
22988 | return "Invalid mnemonic"; | |
22989 | } | |
22990 | return false; | |
22991 | } | |
22992 | ||
22993 | function findDerivationPathErrors(path) { | |
22994 | // TODO | |
22995 | return false; | |
22996 | } | |
22997 | ||
22998 | function displayBip32Info() { | |
22999 | // Display the key | |
23000 | var rootKey = bip32RootKey.toBase58(); | |
23001 | DOM.rootKey.val(rootKey); | |
23002 | var extendedPrivKey = bip32ExtendedKey.toBase58(); | |
23003 | DOM.extendedPrivKey.val(extendedPrivKey); | |
23004 | var extendedPubKey = bip32ExtendedKey.toBase58(false); | |
23005 | DOM.extendedPubKey.val(extendedPubKey); | |
23006 | // Display the addresses and privkeys | |
23007 | clearAddressesList(); | |
23008 | displayAddresses(0, 20); | |
23009 | } | |
23010 | ||
23011 | function displayAddresses(start, total) { | |
23012 | for (var i=0; i<total; i++) { | |
23013 | var index = i+ start; | |
23014 | var key = bip32ExtendedKey.derive(index); | |
23015 | var address = key.getAddress().toString(); | |
23016 | var privkey = key.privKey.toWIF(); | |
23017 | addAddressToList(index, address, privkey); | |
23018 | } | |
23019 | } | |
23020 | ||
23021 | function showMore() { | |
23022 | var start = DOM.addresses.children().length; | |
23023 | var rowsToAdd = parseInt(DOM.rowsToAdd.val()); | |
23024 | if (isNaN(rowsToAdd)) { | |
23025 | rowsToAdd = 20; | |
23026 | DOM.rowsToAdd.val("20"); | |
23027 | } | |
23028 | if (rowsToAdd > 200) { | |
23029 | var msg = "Generating " + rowsToAdd + " rows could take a while. "; | |
23030 | msg += "Do you want to continue?"; | |
23031 | if (!confirm(msg)) { | |
23032 | return; | |
23033 | } | |
23034 | } | |
23035 | showPending(); | |
23036 | setTimeout(function() { | |
23037 | displayAddresses(start, rowsToAdd); | |
23038 | hidePending(); | |
23039 | }, 50); | |
23040 | } | |
23041 | ||
23042 | function clearDisplay() { | |
23043 | clearAddressesList(); | |
23044 | clearKey(); | |
23045 | hideValidationError(); | |
23046 | } | |
23047 | ||
23048 | function clearAddressesList() { | |
23049 | DOM.addresses.empty(); | |
23050 | } | |
23051 | ||
23052 | function clearKey() { | |
23053 | DOM.rootKey.val(""); | |
23054 | DOM.extendedPrivKey.val(""); | |
23055 | DOM.extendedPubKey.val(""); | |
23056 | } | |
23057 | ||
23058 | function addAddressToList(index, address, privkey) { | |
23059 | var row = $(addressRowTemplate.html()); | |
23060 | row.find(".index span").text(index); | |
23061 | row.find(".address span").text(address); | |
23062 | row.find(".privkey span").text(privkey); | |
23063 | DOM.addresses.append(row); | |
23064 | } | |
23065 | ||
23066 | function hasStrongRandom() { | |
23067 | return 'crypto' in window && window['crypto'] !== null; | |
23068 | } | |
23069 | ||
23070 | function disableForms() { | |
23071 | $("form").on("submit", function(e) { | |
23072 | e.preventDefault(); | |
23073 | }); | |
23074 | } | |
23075 | ||
23076 | function setBip44DerivationPath() { | |
23077 | var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44); | |
23078 | var coin = parseIntNoNaN(DOM.bip44coin.val(), 0); | |
23079 | var account = parseIntNoNaN(DOM.bip44account.val(), 0); | |
23080 | var change = parseIntNoNaN(DOM.bip44change.val(), 0); | |
23081 | var path = "m/"; | |
23082 | path += purpose + "'/"; | |
23083 | path += coin + "'/"; | |
23084 | path += account + "'/"; | |
23085 | path += change; | |
23086 | DOM.bip44path.val(path); | |
23087 | } | |
23088 | ||
23089 | function parseIntNoNaN(val, defaultVal) { | |
23090 | var v = parseInt(val); | |
23091 | if (isNaN(v)) { | |
23092 | return defaultVal; | |
23093 | } | |
23094 | return v; | |
23095 | } | |
23096 | ||
23097 | function showPending() { | |
23098 | DOM.feedback | |
23099 | .text("Calculating...") | |
23100 | .show(); | |
23101 | } | |
23102 | ||
23103 | function hidePending() { | |
23104 | DOM.feedback | |
23105 | .text("") | |
23106 | .hide(); | |
23107 | } | |
23108 | ||
23109 | init(); | |
23110 | ||
23111 | })(); | |
23112 | </script> | |
23113 | </body> | |
23114 | </html> |