]>
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 | } | |
d198865f IC |
24 | .form-control[readonly] { |
25 | cursor: text; | |
dd566a1e | 26 | } |
ebd8d4e8 IC |
27 | .feedback-container { |
28 | position: fixed; | |
29 | top: 0; | |
30 | width: 100%; | |
31 | text-align: center; | |
32 | z-index: 4; | |
33 | } | |
34 | .feedback { | |
35 | display: table; | |
36 | padding: 0.5em 1em; | |
37 | background-color: orange; | |
38 | margin: 0 auto; | |
39 | font-size: 2em; | |
40 | color: #444; | |
41 | border: 2px solid #555; | |
42 | border-top: 0; | |
43 | border-bottom-left-radius: 20px 20px; | |
44 | border-bottom-right-radius: 20px 20px; | |
45 | } | |
46 | </style> | |
47 | </head> | |
48 | <body> | |
49 | <div class="container"> | |
50 | ||
51 | <h1 class="text-center">Mnemonic Code Converter</h1> | |
52 | <hr> | |
53 | <div class="row"> | |
54 | <div class="col-md-12"> | |
d4779799 | 55 | <h2>Mnemonic</h2> |
ebd8d4e8 IC |
56 | <form class="form-horizontal" role="form"> |
57 | <div class="col-sm-2"></div> | |
58 | <div class="col-sm-10"> | |
d4779799 | 59 | <p>You can enter an existing BIP39 mnemonic, 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 |
60 | <p>For more info see the <a href="https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki" target="_blank">BIP39 spec</a></p> |
61 | </div> | |
62 | <div class="form-group"> | |
d4779799 | 63 | <label for="phrase" class="col-sm-2 control-label">BIP39 Mnemonic</label> |
ebd8d4e8 IC |
64 | <div class="col-sm-10"> |
65 | <textarea id="phrase" class="phrase form-control"></textarea> | |
66 | </div> | |
67 | </div> | |
68 | <div class="form-group"> | |
69 | <label for="strength" class="col-sm-2 control-label">Number of words</label> | |
70 | <div class="col-sm-10"> | |
71 | <div class="input-group"> | |
72 | <input type="number" class="strength form-control" id="strength" value="12"> | |
73 | <span class="input-group-btn"> | |
d4779799 | 74 | <button class="btn generate">Generate Random Mnemonic</button> |
ebd8d4e8 IC |
75 | </span> |
76 | </div> | |
77 | </div> | |
78 | </div> | |
721b7284 IC |
79 | <div class="form-group"> |
80 | <label for="passphrase" class="col-sm-2 control-label">BIP39 Passphrase (optional)</label> | |
81 | <div class="col-sm-10"> | |
82 | <textarea id="passphrase" class="passphrase form-control"></textarea> | |
83 | </div> | |
84 | </div> | |
ebd8d4e8 IC |
85 | <div class="form-group"> |
86 | <label for="root-key" class="col-sm-2 control-label">BIP32 Root Key</label> | |
87 | <div class="col-sm-10"> | |
d198865f | 88 | <textarea id="root-key" class="root-key form-control" readonly="readonly"></textarea> |
ebd8d4e8 IC |
89 | </div> |
90 | </div> | |
91 | </form> | |
92 | </div> | |
93 | </div> | |
94 | ||
95 | <hr> | |
96 | ||
97 | <div class="row"> | |
98 | <div class="col-md-12"> | |
99 | <h2>Derivation Path</h2> | |
100 | <ul class="derivation-type nav nav-tabs" role="tablist"> | |
101 | <li class="active"> | |
102 | <a href="#bip44" role="tab" data-toggle="tab">BIP44</a></li> | |
103 | <li><a href="#bip32" role="tab" data-toggle="tab">BIP32</a></li> | |
104 | </ul> | |
105 | <div class="derivation-type tab-content"> | |
106 | <div id="bip44" class="tab-pane active"> | |
107 | <form class="form-horizontal" role="form"> | |
108 | <br> | |
109 | <div class="col-sm-2"></div> | |
110 | <div class="col-sm-10"> | |
111 | <p>For more info see the <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki" target="_blank">BIP44 spec</a></p> | |
112 | </div> | |
113 | <div class="form-group"> | |
114 | <label for="purpose" class="col-sm-2 control-label"> | |
115 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#purpose" target="_blank">Purpose</a> | |
116 | </label> | |
117 | <div class="col-sm-10"> | |
118 | <input id="purpose" type="text" class="purpose form-control" value="44"> | |
119 | </div> | |
120 | </div> | |
121 | <div class="form-group"> | |
122 | <label for="coin" class="col-sm-2 control-label"> | |
123 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#registered-coin-types" target="_blank">Coin</a> | |
124 | </label> | |
125 | <div class="col-sm-10"> | |
126 | <input id="coin" type="text" class="coin form-control" value="0"> | |
127 | </div> | |
128 | </div> | |
129 | <div class="form-group"> | |
130 | <label for="account" class="col-sm-2 control-label"> | |
131 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#account" target="_blank">Account</a> | |
132 | </label> | |
133 | <div class="col-sm-10"> | |
134 | <input id="account" type="text" class="account form-control" value="0"> | |
135 | </div> | |
136 | </div> | |
137 | <div class="form-group"> | |
138 | <label for="change" class="col-sm-2 control-label"> | |
139 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#change" target="_blank">External / Internal</a> | |
140 | </label> | |
141 | <div class="col-sm-10"> | |
142 | <input id="change" type="text" class="change form-control" value="0"> | |
143 | </div> | |
144 | </div> | |
145 | <div class="form-group"> | |
146 | <label for="bip44-path" class="col-sm-2 control-label">BIP32 Derivation Path</label> | |
147 | <div class="col-sm-10"> | |
d198865f | 148 | <input id="bip44-path" type="text" class="path form-control" value="m/44'/0'/0'/0" readonly="readonly"> |
ebd8d4e8 IC |
149 | </div> |
150 | </div> | |
151 | </form> | |
152 | </div> | |
153 | <div id="bip32" class="tab-pane"> | |
154 | <form class="form-horizontal" role="form"> | |
155 | <br> | |
156 | <div class="col-sm-2"></div> | |
157 | <div class="col-sm-10"> | |
158 | <p>For more info see the <a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki" target="_blank">BIP32 spec</a></p> | |
159 | </div> | |
160 | <div class="form-group"> | |
161 | <label for="bip32-path" class="col-sm-2 control-label">BIP32 Derivation Path</label> | |
162 | <div class="col-sm-10"> | |
163 | <input id="bip32-path" type="text" class="path form-control" value="m/0"> | |
164 | </div> | |
165 | </div> | |
166 | </form> | |
167 | </div> | |
168 | </div> | |
169 | <form class="form-horizontal" role="form"> | |
170 | <div class="form-group"> | |
171 | <label for="extended-priv-key" class="col-sm-2 control-label">BIP32 Extended Key</label> | |
172 | <div class="col-sm-10"> | |
d198865f | 173 | <textarea id="extended-priv-key" class="extended-priv-key form-control" readonly="readonly"></textarea> |
ebd8d4e8 IC |
174 | </div> |
175 | </div> | |
176 | <div class="form-group"> | |
177 | <label for="extended-pub-key" class="col-sm-2 control-label">BIP32 Extended Key (addresses only)</label> | |
178 | <div class="col-sm-10"> | |
d198865f | 179 | <textarea id="extended-pub-key" class="extended-pub-key form-control" readonly="readonly"></textarea> |
ebd8d4e8 IC |
180 | </div> |
181 | </div> | |
182 | </form> | |
183 | </div> | |
184 | </div> | |
185 | ||
186 | <hr> | |
187 | ||
188 | <div class="row"> | |
189 | <div class="col-md-12"> | |
212b1b46 IC |
190 | <h2>Derived Addresses</h2> |
191 | <p>Note these addreses are derived from the <strong>BIP32 Extended Key</strong></p> | |
192 | <table class="table table-striped"> | |
193 | <thead> | |
194 | <th> | |
195 | <div class="input-group"> | |
196 | Index | |
197 | <button class="index-toggle">Toggle</button> | |
198 | </div> | |
199 | </th> | |
200 | <th> | |
201 | <div class="input-group"> | |
202 | Address | |
203 | <button class="address-toggle">Toggle</button> | |
204 | </div> | |
205 | </th> | |
206 | <th> | |
207 | <div class="input-group"> | |
208 | Private Key | |
209 | <button class="private-key-toggle">Toggle</button> | |
210 | </div> | |
211 | </th> | |
212 | </thead> | |
213 | <tbody class="addresses"> | |
214 | <tr><td> </td><td> </td><td> </td></tr> | |
215 | <tr><td> </td><td> </td><td> </td></tr> | |
216 | <tr><td> </td><td> </td><td> </td></tr> | |
217 | <tr><td> </td><td> </td><td> </td></tr> | |
218 | <tr><td> </td><td> </td><td> </td></tr> | |
219 | </tbody> | |
220 | </table> | |
221 | </div> | |
222 | </div> | |
223 | <span>Show next </button> | |
224 | <input type="number" class="rows-to-add" value="20"> | |
225 | <button class="more">Show</button> | |
226 | ||
227 | <hr> | |
228 | ||
229 | <div class="row"> | |
230 | <div class="col-md-12"> | |
231 | <h2>More info</h2> | |
232 | <h3>BIP39 <span class="small">Mnemonic code for generating deterministic keys</span></h3> | |
233 | <p> | |
234 | Read more at the | |
235 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki">official BIP39 spec</a> | |
236 | </p> | |
237 | <h3>BIP32 <span class="small">Hierarchical Deterministic Wallets</span></h3> | |
238 | <p> | |
239 | Read more at the | |
240 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki" target="_blank">official BIP32 spec</a> | |
241 | and see the demo at | |
242 | <a href="http://bip32.org/" target="_blank">bip32.org</a> | |
243 | </p> | |
244 | <h3>BIP44 <span class="small">Multi-Account Hierarchy for Deterministic Wallets</span></h3> | |
245 | <p> | |
246 | Read more at the | |
247 | <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki" target="_blank">official BIP44 spec</a> | |
248 | </p> | |
249 | <h3>Private Keys</h3> | |
250 | <p> | |
251 | Use private keys at | |
252 | <a href="https://brainwallet.github.io/" target="_blank">brainwallet.org</a>, | |
253 | but be careful - it can be easy to make mistakes if you | |
254 | don't know what you're doing | |
255 | </p> | |
256 | </div> | |
257 | </div> | |
258 | ||
259 | <hr> | |
260 | ||
261 | <div class="row"> | |
262 | <div class="col-md-12"> | |
263 | ||
264 | <h2>Offline Usage</h2> | |
265 | ||
266 | <p> | |
267 | You can use this tool without having to be online. | |
268 | </p> | |
269 | <p> | |
270 | In your browser, select file save-as, and save this page | |
271 | as a file. | |
272 | </p> | |
273 | <p> | |
274 | Double-click that file to open it in a browser | |
275 | on any offline computer. | |
276 | </p> | |
277 | <p> | |
278 | Alternatively, download it from | |
279 | <a href="https://github.com/dcpos/bip39"> | |
280 | https://github.com/dcpos/bip39 | |
281 | </a> | |
282 | ||
283 | </div> | |
284 | </div> | |
285 | ||
286 | <hr> | |
287 | ||
288 | <div class="row"> | |
289 | <div class="col-md-12"> | |
290 | ||
291 | <h2>This project is 100% open-source code</h2> | |
292 | ||
293 | <p> | |
294 | <span>Get the source code at - </span> | |
295 | <a href="https://github.com/dcpos/bip39" target="_blank"> | |
296 | https://github.com/dcpos/bip39 | |
297 | </a> | |
298 | </p> | |
299 | ||
300 | <h3>Libraries</h3> | |
301 | ||
302 | <p> | |
303 | <span>BitcoinJS - </span> | |
304 | <a href="https://github.com/bitcoinjs/bitcoinjs-lib" target="_blank"> | |
305 | https://github.com/bitcoinjs/bitcoinjs-lib | |
306 | </a> | |
307 | </p> | |
308 | ||
309 | <p> | |
310 | <span>jsBIP39 - </span> | |
311 | <a href="https://github.com/iancoleman/jsbip39" target="_blank"> | |
312 | https://github.com/iancoleman/jsbip39 | |
313 | </a> | |
314 | </p> | |
315 | ||
316 | <p> | |
317 | <span>asmCrypto - </span> | |
318 | <a href="https://github.com/vibornoff/asmcrypto.js" target="_blank"> | |
319 | https://github.com/vibornoff/asmcrypto.js | |
320 | </a> | |
321 | </p> | |
322 | ||
323 | <p> | |
324 | <span>jQuery - </span> | |
325 | <a href="https://jquery.com/" target="_blank"> | |
326 | https://jquery.com/ | |
327 | </a> | |
328 | </p> | |
329 | ||
330 | <p> | |
331 | <span>Twitter Bootstrap - </span> | |
332 | <a href="http://getbootstrap.com/" target="_blank"> | |
333 | http://getbootstrap.com/ | |
334 | </a> | |
335 | </p> | |
336 | ||
337 | </div> | |
338 | </div> | |
339 | ||
ebd8d4e8 IC |
340 | </div> |
341 | ||
342 | <div class="feedback-container"> | |
d26cce22 | 343 | <div class="feedback">Loading...</div> |
ebd8d4e8 IC |
344 | </div> |
345 | ||
346 | <script type="text/template" id="address-row-template"> | |
347 | <tr> | |
348 | <td class="index"><span></span></td> | |
349 | <td class="address"><span></span></td> | |
350 | <td class="privkey"><span></span></td> | |
351 | </tr> | |
352 | </script> | |
353 | ||
354 | <!--<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>--> | |
355 | <script> | |
356 | /*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ | |
357 | !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) | |
358 | },_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)) | |
359 | },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}); | |
360 | </script> | |
361 | ||
362 | <!--<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>--> | |
363 | <script> | |
364 | /*! | |
365 | * Bootstrap v3.2.0 (http://getbootstrap.com) | |
366 | * Copyright 2011-2014 Twitter, Inc. | |
367 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) | |
368 | */ | |
369 | 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); | |
370 | </script> | |
371 | ||
372 | <!--<script src="/js/bitcoinjs-1-0-0.js"></script>--> | |
373 | <script> | |
374 | (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){ | |
375 | var assert = _dereq_('assert') | |
376 | ||
377 | module.exports = BigInteger | |
378 | ||
379 | // JavaScript engine analysis | |
380 | var canary = 0xdeadbeefcafe; | |
381 | var j_lm = ((canary&0xffffff)==0xefcafe); | |
382 | ||
383 | // (public) Constructor | |
384 | function BigInteger(a,b,c) { | |
385 | if (!(this instanceof BigInteger)) { | |
386 | return new BigInteger(a, b, c); | |
387 | } | |
388 | ||
389 | if(a != null) { | |
390 | if("number" == typeof a) this.fromNumber(a,b,c); | |
391 | else if(b == null && "string" != typeof a) this.fromString(a,256); | |
392 | else this.fromString(a,b); | |
393 | } | |
394 | } | |
395 | ||
396 | var proto = BigInteger.prototype; | |
397 | ||
398 | // return new, unset BigInteger | |
399 | function nbi() { return new BigInteger(null); } | |
400 | ||
401 | // Bits per digit | |
402 | var dbits; | |
403 | ||
404 | // am: Compute w_j += (x*this_i), propagate carries, | |
405 | // c is initial carry, returns final carry. | |
406 | // c < 3*dvalue, x < 2*dvalue, this_i < dvalue | |
407 | // We need to select the fastest one that works in this environment. | |
408 | ||
409 | // am1: use a single mult and divide to get the high bits, | |
410 | // max digit bits should be 26 because | |
411 | // max internal value = 2*dvalue^2-2*dvalue (< 2^53) | |
412 | function am1(i,x,w,j,c,n) { | |
413 | while(--n >= 0) { | |
414 | var v = x*this[i++]+w[j]+c; | |
415 | c = Math.floor(v/0x4000000); | |
416 | w[j++] = v&0x3ffffff; | |
417 | } | |
418 | return c; | |
419 | } | |
420 | // am2 avoids a big mult-and-extract completely. | |
421 | // Max digit bits should be <= 30 because we do bitwise ops | |
422 | // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) | |
423 | function am2(i,x,w,j,c,n) { | |
424 | var xl = x&0x7fff, xh = x>>15; | |
425 | while(--n >= 0) { | |
426 | var l = this[i]&0x7fff; | |
427 | var h = this[i++]>>15; | |
428 | var m = xh*l+h*xl; | |
429 | l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff); | |
430 | c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); | |
431 | w[j++] = l&0x3fffffff; | |
432 | } | |
433 | return c; | |
434 | } | |
435 | // Alternately, set max digit bits to 28 since some | |
436 | // browsers slow down when dealing with 32-bit numbers. | |
437 | function am3(i,x,w,j,c,n) { | |
438 | var xl = x&0x3fff, xh = x>>14; | |
439 | while(--n >= 0) { | |
440 | var l = this[i]&0x3fff; | |
441 | var h = this[i++]>>14; | |
442 | var m = xh*l+h*xl; | |
443 | l = xl*l+((m&0x3fff)<<14)+w[j]+c; | |
444 | c = (l>>28)+(m>>14)+xh*h; | |
445 | w[j++] = l&0xfffffff; | |
446 | } | |
447 | return c; | |
448 | } | |
449 | ||
450 | // wtf? | |
451 | BigInteger.prototype.am = am1; | |
452 | dbits = 26; | |
453 | ||
454 | /* | |
455 | if(j_lm && (navigator.appName == "Microsoft Internet Explorer")) { | |
456 | BigInteger.prototype.am = am2; | |
457 | dbits = 30; | |
458 | } | |
459 | else if(j_lm && (navigator.appName != "Netscape")) { | |
460 | BigInteger.prototype.am = am1; | |
461 | dbits = 26; | |
462 | } | |
463 | else { // Mozilla/Netscape seems to prefer am3 | |
464 | BigInteger.prototype.am = am3; | |
465 | dbits = 28; | |
466 | } | |
467 | */ | |
468 | ||
469 | BigInteger.prototype.DB = dbits; | |
470 | BigInteger.prototype.DM = ((1<<dbits)-1); | |
471 | var DV = BigInteger.prototype.DV = (1<<dbits); | |
472 | ||
473 | var BI_FP = 52; | |
474 | BigInteger.prototype.FV = Math.pow(2,BI_FP); | |
475 | BigInteger.prototype.F1 = BI_FP-dbits; | |
476 | BigInteger.prototype.F2 = 2*dbits-BI_FP; | |
477 | ||
478 | // Digit conversions | |
479 | var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz"; | |
480 | var BI_RC = new Array(); | |
481 | var rr,vv; | |
482 | rr = "0".charCodeAt(0); | |
483 | for(vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv; | |
484 | rr = "a".charCodeAt(0); | |
485 | for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv; | |
486 | rr = "A".charCodeAt(0); | |
487 | for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv; | |
488 | ||
489 | function int2char(n) { return BI_RM.charAt(n); } | |
490 | function intAt(s,i) { | |
491 | var c = BI_RC[s.charCodeAt(i)]; | |
492 | return (c==null)?-1:c; | |
493 | } | |
494 | ||
495 | // (protected) copy this to r | |
496 | function bnpCopyTo(r) { | |
497 | for(var i = this.t-1; i >= 0; --i) r[i] = this[i]; | |
498 | r.t = this.t; | |
499 | r.s = this.s; | |
500 | } | |
501 | ||
502 | // (protected) set from integer value x, -DV <= x < DV | |
503 | function bnpFromInt(x) { | |
504 | this.t = 1; | |
505 | this.s = (x<0)?-1:0; | |
506 | if(x > 0) this[0] = x; | |
507 | else if(x < -1) this[0] = x+DV; | |
508 | else this.t = 0; | |
509 | } | |
510 | ||
511 | // return bigint initialized to value | |
512 | function nbv(i) { var r = nbi(); r.fromInt(i); return r; } | |
513 | ||
514 | // (protected) set from string and radix | |
515 | function bnpFromString(s,b) { | |
516 | var self = this; | |
517 | ||
518 | var k; | |
519 | if(b == 16) k = 4; | |
520 | else if(b == 8) k = 3; | |
521 | else if(b == 256) k = 8; // byte array | |
522 | else if(b == 2) k = 1; | |
523 | else if(b == 32) k = 5; | |
524 | else if(b == 4) k = 2; | |
525 | else { self.fromRadix(s,b); return; } | |
526 | self.t = 0; | |
527 | self.s = 0; | |
528 | var i = s.length, mi = false, sh = 0; | |
529 | while(--i >= 0) { | |
530 | var x = (k==8)?s[i]&0xff:intAt(s,i); | |
531 | if(x < 0) { | |
532 | if(s.charAt(i) == "-") mi = true; | |
533 | continue; | |
534 | } | |
535 | mi = false; | |
536 | if(sh == 0) | |
537 | self[self.t++] = x; | |
538 | else if(sh+k > self.DB) { | |
539 | self[self.t-1] |= (x&((1<<(self.DB-sh))-1))<<sh; | |
540 | self[self.t++] = (x>>(self.DB-sh)); | |
541 | } | |
542 | else | |
543 | self[self.t-1] |= x<<sh; | |
544 | sh += k; | |
545 | if(sh >= self.DB) sh -= self.DB; | |
546 | } | |
547 | if(k == 8 && (s[0]&0x80) != 0) { | |
548 | self.s = -1; | |
549 | if(sh > 0) self[self.t-1] |= ((1<<(self.DB-sh))-1)<<sh; | |
550 | } | |
551 | self.clamp(); | |
552 | if(mi) BigInteger.ZERO.subTo(self,self); | |
553 | } | |
554 | ||
555 | // (protected) clamp off excess high words | |
556 | function bnpClamp() { | |
557 | var c = this.s&this.DM; | |
558 | while(this.t > 0 && this[this.t-1] == c) --this.t; | |
559 | } | |
560 | ||
561 | // (public) return string representation in given radix | |
562 | function bnToString(b) { | |
563 | var self = this; | |
564 | if(self.s < 0) return "-"+self.negate().toString(b); | |
565 | var k; | |
566 | if(b == 16) k = 4; | |
567 | else if(b == 8) k = 3; | |
568 | else if(b == 2) k = 1; | |
569 | else if(b == 32) k = 5; | |
570 | else if(b == 4) k = 2; | |
571 | else return self.toRadix(b); | |
572 | var km = (1<<k)-1, d, m = false, r = "", i = self.t; | |
573 | var p = self.DB-(i*self.DB)%k; | |
574 | if(i-- > 0) { | |
575 | if(p < self.DB && (d = self[i]>>p) > 0) { m = true; r = int2char(d); } | |
576 | while(i >= 0) { | |
577 | if(p < k) { | |
578 | d = (self[i]&((1<<p)-1))<<(k-p); | |
579 | d |= self[--i]>>(p+=self.DB-k); | |
580 | } | |
581 | else { | |
582 | d = (self[i]>>(p-=k))&km; | |
583 | if(p <= 0) { p += self.DB; --i; } | |
584 | } | |
585 | if(d > 0) m = true; | |
586 | if(m) r += int2char(d); | |
587 | } | |
588 | } | |
589 | return m?r:"0"; | |
590 | } | |
591 | ||
592 | // (public) -this | |
593 | function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } | |
594 | ||
595 | // (public) |this| | |
596 | function bnAbs() { return (this.s<0)?this.negate():this; } | |
597 | ||
598 | // (public) return + if this > a, - if this < a, 0 if equal | |
599 | function bnCompareTo(a) { | |
600 | var r = this.s-a.s; | |
601 | if(r != 0) return r; | |
602 | var i = this.t; | |
603 | r = i-a.t; | |
604 | if(r != 0) return (this.s<0)?-r:r; | |
605 | while(--i >= 0) if((r=this[i]-a[i]) != 0) return r; | |
606 | return 0; | |
607 | } | |
608 | ||
609 | // returns bit length of the integer x | |
610 | function nbits(x) { | |
611 | var r = 1, t; | |
612 | if((t=x>>>16) != 0) { x = t; r += 16; } | |
613 | if((t=x>>8) != 0) { x = t; r += 8; } | |
614 | if((t=x>>4) != 0) { x = t; r += 4; } | |
615 | if((t=x>>2) != 0) { x = t; r += 2; } | |
616 | if((t=x>>1) != 0) { x = t; r += 1; } | |
617 | return r; | |
618 | } | |
619 | ||
620 | // (public) return the number of bits in "this" | |
621 | function bnBitLength() { | |
622 | if(this.t <= 0) return 0; | |
623 | return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM)); | |
624 | } | |
625 | ||
626 | // (protected) r = this << n*DB | |
627 | function bnpDLShiftTo(n,r) { | |
628 | var i; | |
629 | for(i = this.t-1; i >= 0; --i) r[i+n] = this[i]; | |
630 | for(i = n-1; i >= 0; --i) r[i] = 0; | |
631 | r.t = this.t+n; | |
632 | r.s = this.s; | |
633 | } | |
634 | ||
635 | // (protected) r = this >> n*DB | |
636 | function bnpDRShiftTo(n,r) { | |
637 | for(var i = n; i < this.t; ++i) r[i-n] = this[i]; | |
638 | r.t = Math.max(this.t-n,0); | |
639 | r.s = this.s; | |
640 | } | |
641 | ||
642 | // (protected) r = this << n | |
643 | function bnpLShiftTo(n,r) { | |
644 | var self = this; | |
645 | var bs = n%self.DB; | |
646 | var cbs = self.DB-bs; | |
647 | var bm = (1<<cbs)-1; | |
648 | var ds = Math.floor(n/self.DB), c = (self.s<<bs)&self.DM, i; | |
649 | for(i = self.t-1; i >= 0; --i) { | |
650 | r[i+ds+1] = (self[i]>>cbs)|c; | |
651 | c = (self[i]&bm)<<bs; | |
652 | } | |
653 | for(i = ds-1; i >= 0; --i) r[i] = 0; | |
654 | r[ds] = c; | |
655 | r.t = self.t+ds+1; | |
656 | r.s = self.s; | |
657 | r.clamp(); | |
658 | } | |
659 | ||
660 | // (protected) r = this >> n | |
661 | function bnpRShiftTo(n,r) { | |
662 | var self = this; | |
663 | r.s = self.s; | |
664 | var ds = Math.floor(n/self.DB); | |
665 | if(ds >= self.t) { r.t = 0; return; } | |
666 | var bs = n%self.DB; | |
667 | var cbs = self.DB-bs; | |
668 | var bm = (1<<bs)-1; | |
669 | r[0] = self[ds]>>bs; | |
670 | for(var i = ds+1; i < self.t; ++i) { | |
671 | r[i-ds-1] |= (self[i]&bm)<<cbs; | |
672 | r[i-ds] = self[i]>>bs; | |
673 | } | |
674 | if(bs > 0) r[self.t-ds-1] |= (self.s&bm)<<cbs; | |
675 | r.t = self.t-ds; | |
676 | r.clamp(); | |
677 | } | |
678 | ||
679 | // (protected) r = this - a | |
680 | function bnpSubTo(a,r) { | |
681 | var self = this; | |
682 | var i = 0, c = 0, m = Math.min(a.t,self.t); | |
683 | while(i < m) { | |
684 | c += self[i]-a[i]; | |
685 | r[i++] = c&self.DM; | |
686 | c >>= self.DB; | |
687 | } | |
688 | if(a.t < self.t) { | |
689 | c -= a.s; | |
690 | while(i < self.t) { | |
691 | c += self[i]; | |
692 | r[i++] = c&self.DM; | |
693 | c >>= self.DB; | |
694 | } | |
695 | c += self.s; | |
696 | } | |
697 | else { | |
698 | c += self.s; | |
699 | while(i < a.t) { | |
700 | c -= a[i]; | |
701 | r[i++] = c&self.DM; | |
702 | c >>= self.DB; | |
703 | } | |
704 | c -= a.s; | |
705 | } | |
706 | r.s = (c<0)?-1:0; | |
707 | if(c < -1) r[i++] = self.DV+c; | |
708 | else if(c > 0) r[i++] = c; | |
709 | r.t = i; | |
710 | r.clamp(); | |
711 | } | |
712 | ||
713 | // (protected) r = this * a, r != this,a (HAC 14.12) | |
714 | // "this" should be the larger one if appropriate. | |
715 | function bnpMultiplyTo(a,r) { | |
716 | var x = this.abs(), y = a.abs(); | |
717 | var i = x.t; | |
718 | r.t = i+y.t; | |
719 | while(--i >= 0) r[i] = 0; | |
720 | for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t); | |
721 | r.s = 0; | |
722 | r.clamp(); | |
723 | if(this.s != a.s) BigInteger.ZERO.subTo(r,r); | |
724 | } | |
725 | ||
726 | // (protected) r = this^2, r != this (HAC 14.16) | |
727 | function bnpSquareTo(r) { | |
728 | var x = this.abs(); | |
729 | var i = r.t = 2*x.t; | |
730 | while(--i >= 0) r[i] = 0; | |
731 | for(i = 0; i < x.t-1; ++i) { | |
732 | var c = x.am(i,x[i],r,2*i,0,1); | |
733 | if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) { | |
734 | r[i+x.t] -= x.DV; | |
735 | r[i+x.t+1] = 1; | |
736 | } | |
737 | } | |
738 | if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1); | |
739 | r.s = 0; | |
740 | r.clamp(); | |
741 | } | |
742 | ||
743 | // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) | |
744 | // r != q, this != m. q or r may be null. | |
745 | function bnpDivRemTo(m,q,r) { | |
746 | var self = this; | |
747 | var pm = m.abs(); | |
748 | if(pm.t <= 0) return; | |
749 | var pt = self.abs(); | |
750 | if(pt.t < pm.t) { | |
751 | if(q != null) q.fromInt(0); | |
752 | if(r != null) self.copyTo(r); | |
753 | return; | |
754 | } | |
755 | if(r == null) r = nbi(); | |
756 | var y = nbi(), ts = self.s, ms = m.s; | |
757 | var nsh = self.DB-nbits(pm[pm.t-1]); // normalize modulus | |
758 | if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } | |
759 | else { pm.copyTo(y); pt.copyTo(r); } | |
760 | var ys = y.t; | |
761 | var y0 = y[ys-1]; | |
762 | if(y0 == 0) return; | |
763 | var yt = y0*(1<<self.F1)+((ys>1)?y[ys-2]>>self.F2:0); | |
764 | var d1 = self.FV/yt, d2 = (1<<self.F1)/yt, e = 1<<self.F2; | |
765 | var i = r.t, j = i-ys, t = (q==null)?nbi():q; | |
766 | y.dlShiftTo(j,t); | |
767 | if(r.compareTo(t) >= 0) { | |
768 | r[r.t++] = 1; | |
769 | r.subTo(t,r); | |
770 | } | |
771 | BigInteger.ONE.dlShiftTo(ys,t); | |
772 | t.subTo(y,y); // "negative" y so we can replace sub with am later | |
773 | while(y.t < ys) y[y.t++] = 0; | |
774 | while(--j >= 0) { | |
775 | // Estimate quotient digit | |
776 | var qd = (r[--i]==y0)?self.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2); | |
777 | if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out | |
778 | y.dlShiftTo(j,t); | |
779 | r.subTo(t,r); | |
780 | while(r[i] < --qd) r.subTo(t,r); | |
781 | } | |
782 | } | |
783 | if(q != null) { | |
784 | r.drShiftTo(ys,q); | |
785 | if(ts != ms) BigInteger.ZERO.subTo(q,q); | |
786 | } | |
787 | r.t = ys; | |
788 | r.clamp(); | |
789 | if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder | |
790 | if(ts < 0) BigInteger.ZERO.subTo(r,r); | |
791 | } | |
792 | ||
793 | // (public) this mod a | |
794 | function bnMod(a) { | |
795 | var r = nbi(); | |
796 | this.abs().divRemTo(a,null,r); | |
797 | if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); | |
798 | return r; | |
799 | } | |
800 | ||
801 | // Modular reduction using "classic" algorithm | |
802 | function Classic(m) { this.m = m; } | |
803 | function cConvert(x) { | |
804 | if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); | |
805 | else return x; | |
806 | } | |
807 | function cRevert(x) { return x; } | |
808 | function cReduce(x) { x.divRemTo(this.m,null,x); } | |
809 | function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } | |
810 | function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } | |
811 | ||
812 | Classic.prototype.convert = cConvert; | |
813 | Classic.prototype.revert = cRevert; | |
814 | Classic.prototype.reduce = cReduce; | |
815 | Classic.prototype.mulTo = cMulTo; | |
816 | Classic.prototype.sqrTo = cSqrTo; | |
817 | ||
818 | // (protected) return "-1/this % 2^DB"; useful for Mont. reduction | |
819 | // justification: | |
820 | // xy == 1 (mod m) | |
821 | // xy = 1+km | |
822 | // xy(2-xy) = (1+km)(1-km) | |
823 | // x[y(2-xy)] = 1-k^2m^2 | |
824 | // x[y(2-xy)] == 1 (mod m^2) | |
825 | // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 | |
826 | // should reduce x and y(2-xy) by m^2 at each step to keep size bounded. | |
827 | // JS multiply "overflows" differently from C/C++, so care is needed here. | |
828 | function bnpInvDigit() { | |
829 | if(this.t < 1) return 0; | |
830 | var x = this[0]; | |
831 | if((x&1) == 0) return 0; | |
832 | var y = x&3; // y == 1/x mod 2^2 | |
833 | y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 | |
834 | y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 | |
835 | y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 | |
836 | // last step - calculate inverse mod DV directly; | |
837 | // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints | |
838 | y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits | |
839 | // we really want the negative inverse, and -DV < y < DV | |
840 | return (y>0)?this.DV-y:-y; | |
841 | } | |
842 | ||
843 | // Montgomery reduction | |
844 | function Montgomery(m) { | |
845 | this.m = m; | |
846 | this.mp = m.invDigit(); | |
847 | this.mpl = this.mp&0x7fff; | |
848 | this.mph = this.mp>>15; | |
849 | this.um = (1<<(m.DB-15))-1; | |
850 | this.mt2 = 2*m.t; | |
851 | } | |
852 | ||
853 | // xR mod m | |
854 | function montConvert(x) { | |
855 | var r = nbi(); | |
856 | x.abs().dlShiftTo(this.m.t,r); | |
857 | r.divRemTo(this.m,null,r); | |
858 | if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); | |
859 | return r; | |
860 | } | |
861 | ||
862 | // x/R mod m | |
863 | function montRevert(x) { | |
864 | var r = nbi(); | |
865 | x.copyTo(r); | |
866 | this.reduce(r); | |
867 | return r; | |
868 | } | |
869 | ||
870 | // x = x/R mod m (HAC 14.32) | |
871 | function montReduce(x) { | |
872 | while(x.t <= this.mt2) // pad x so am has enough room later | |
873 | x[x.t++] = 0; | |
874 | for(var i = 0; i < this.m.t; ++i) { | |
875 | // faster way of calculating u0 = x[i]*mp mod DV | |
876 | var j = x[i]&0x7fff; | |
877 | var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM; | |
878 | // use am to combine the multiply-shift-add into one call | |
879 | j = i+this.m.t; | |
880 | x[j] += this.m.am(0,u0,x,i,0,this.m.t); | |
881 | // propagate carry | |
882 | while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; } | |
883 | } | |
884 | x.clamp(); | |
885 | x.drShiftTo(this.m.t,x); | |
886 | if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); | |
887 | } | |
888 | ||
889 | // r = "x^2/R mod m"; x != r | |
890 | function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } | |
891 | ||
892 | // r = "xy/R mod m"; x,y != r | |
893 | function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } | |
894 | ||
895 | Montgomery.prototype.convert = montConvert; | |
896 | Montgomery.prototype.revert = montRevert; | |
897 | Montgomery.prototype.reduce = montReduce; | |
898 | Montgomery.prototype.mulTo = montMulTo; | |
899 | Montgomery.prototype.sqrTo = montSqrTo; | |
900 | ||
901 | // (protected) true iff this is even | |
902 | function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; } | |
903 | ||
904 | // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) | |
905 | function bnpExp(e,z) { | |
906 | if(e > 0xffffffff || e < 1) return BigInteger.ONE; | |
907 | var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; | |
908 | g.copyTo(r); | |
909 | while(--i >= 0) { | |
910 | z.sqrTo(r,r2); | |
911 | if((e&(1<<i)) > 0) z.mulTo(r2,g,r); | |
912 | else { var t = r; r = r2; r2 = t; } | |
913 | } | |
914 | return z.revert(r); | |
915 | } | |
916 | ||
917 | // (public) this^e % m, 0 <= e < 2^32 | |
918 | function bnModPowInt(e,m) { | |
919 | var z; | |
920 | if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); | |
921 | return this.exp(e,z); | |
922 | } | |
923 | ||
924 | // protected | |
925 | proto.copyTo = bnpCopyTo; | |
926 | proto.fromInt = bnpFromInt; | |
927 | proto.fromString = bnpFromString; | |
928 | proto.clamp = bnpClamp; | |
929 | proto.dlShiftTo = bnpDLShiftTo; | |
930 | proto.drShiftTo = bnpDRShiftTo; | |
931 | proto.lShiftTo = bnpLShiftTo; | |
932 | proto.rShiftTo = bnpRShiftTo; | |
933 | proto.subTo = bnpSubTo; | |
934 | proto.multiplyTo = bnpMultiplyTo; | |
935 | proto.squareTo = bnpSquareTo; | |
936 | proto.divRemTo = bnpDivRemTo; | |
937 | proto.invDigit = bnpInvDigit; | |
938 | proto.isEven = bnpIsEven; | |
939 | proto.exp = bnpExp; | |
940 | ||
941 | // public | |
942 | proto.toString = bnToString; | |
943 | proto.negate = bnNegate; | |
944 | proto.abs = bnAbs; | |
945 | proto.compareTo = bnCompareTo; | |
946 | proto.bitLength = bnBitLength; | |
947 | proto.mod = bnMod; | |
948 | proto.modPowInt = bnModPowInt; | |
949 | ||
950 | //// jsbn2 | |
951 | ||
952 | function nbi() { return new BigInteger(null); } | |
953 | ||
954 | // (public) | |
955 | function bnClone() { var r = nbi(); this.copyTo(r); return r; } | |
956 | ||
957 | // (public) return value as integer | |
958 | function bnIntValue() { | |
959 | if(this.s < 0) { | |
960 | if(this.t == 1) return this[0]-this.DV; | |
961 | else if(this.t == 0) return -1; | |
962 | } | |
963 | else if(this.t == 1) return this[0]; | |
964 | else if(this.t == 0) return 0; | |
965 | // assumes 16 < DB < 32 | |
966 | return ((this[1]&((1<<(32-this.DB))-1))<<this.DB)|this[0]; | |
967 | } | |
968 | ||
969 | // (public) return value as byte | |
970 | function bnByteValue() { return (this.t==0)?this.s:(this[0]<<24)>>24; } | |
971 | ||
972 | // (public) return value as short (assumes DB>=16) | |
973 | function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; } | |
974 | ||
975 | // (protected) return x s.t. r^x < DV | |
976 | function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); } | |
977 | ||
978 | // (public) 0 if this == 0, 1 if this > 0 | |
979 | function bnSigNum() { | |
980 | if(this.s < 0) return -1; | |
981 | else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0; | |
982 | else return 1; | |
983 | } | |
984 | ||
985 | // (protected) convert to radix string | |
986 | function bnpToRadix(b) { | |
987 | if(b == null) b = 10; | |
988 | if(this.signum() == 0 || b < 2 || b > 36) return "0"; | |
989 | var cs = this.chunkSize(b); | |
990 | var a = Math.pow(b,cs); | |
991 | var d = nbv(a), y = nbi(), z = nbi(), r = ""; | |
992 | this.divRemTo(d,y,z); | |
993 | while(y.signum() > 0) { | |
994 | r = (a+z.intValue()).toString(b).substr(1) + r; | |
995 | y.divRemTo(d,y,z); | |
996 | } | |
997 | return z.intValue().toString(b) + r; | |
998 | } | |
999 | ||
1000 | // (protected) convert from radix string | |
1001 | function bnpFromRadix(s,b) { | |
1002 | var self = this; | |
1003 | self.fromInt(0); | |
1004 | if(b == null) b = 10; | |
1005 | var cs = self.chunkSize(b); | |
1006 | var d = Math.pow(b,cs), mi = false, j = 0, w = 0; | |
1007 | for(var i = 0; i < s.length; ++i) { | |
1008 | var x = intAt(s,i); | |
1009 | if(x < 0) { | |
1010 | if(s.charAt(i) == "-" && self.signum() == 0) mi = true; | |
1011 | continue; | |
1012 | } | |
1013 | w = b*w+x; | |
1014 | if(++j >= cs) { | |
1015 | self.dMultiply(d); | |
1016 | self.dAddOffset(w,0); | |
1017 | j = 0; | |
1018 | w = 0; | |
1019 | } | |
1020 | } | |
1021 | if(j > 0) { | |
1022 | self.dMultiply(Math.pow(b,j)); | |
1023 | self.dAddOffset(w,0); | |
1024 | } | |
1025 | if(mi) BigInteger.ZERO.subTo(self,self); | |
1026 | } | |
1027 | ||
1028 | // (protected) alternate constructor | |
1029 | function bnpFromNumber(a,b,c) { | |
1030 | var self = this; | |
1031 | if("number" == typeof b) { | |
1032 | // new BigInteger(int,int,RNG) | |
1033 | if(a < 2) self.fromInt(1); | |
1034 | else { | |
1035 | self.fromNumber(a,c); | |
1036 | if(!self.testBit(a-1)) // force MSB set | |
1037 | self.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,self); | |
1038 | if(self.isEven()) self.dAddOffset(1,0); // force odd | |
1039 | while(!self.isProbablePrime(b)) { | |
1040 | self.dAddOffset(2,0); | |
1041 | if(self.bitLength() > a) self.subTo(BigInteger.ONE.shiftLeft(a-1),self); | |
1042 | } | |
1043 | } | |
1044 | } | |
1045 | else { | |
1046 | // new BigInteger(int,RNG) | |
1047 | var x = new Array(), t = a&7; | |
1048 | x.length = (a>>3)+1; | |
1049 | b.nextBytes(x); | |
1050 | if(t > 0) x[0] &= ((1<<t)-1); else x[0] = 0; | |
1051 | self.fromString(x,256); | |
1052 | } | |
1053 | } | |
1054 | ||
1055 | // (public) convert to bigendian byte array | |
1056 | function bnToByteArray() { | |
1057 | var self = this; | |
1058 | var i = self.t, r = new Array(); | |
1059 | r[0] = self.s; | |
1060 | var p = self.DB-(i*self.DB)%8, d, k = 0; | |
1061 | if(i-- > 0) { | |
1062 | if(p < self.DB && (d = self[i]>>p) != (self.s&self.DM)>>p) | |
1063 | r[k++] = d|(self.s<<(self.DB-p)); | |
1064 | while(i >= 0) { | |
1065 | if(p < 8) { | |
1066 | d = (self[i]&((1<<p)-1))<<(8-p); | |
1067 | d |= self[--i]>>(p+=self.DB-8); | |
1068 | } | |
1069 | else { | |
1070 | d = (self[i]>>(p-=8))&0xff; | |
1071 | if(p <= 0) { p += self.DB; --i; } | |
1072 | } | |
1073 | if((d&0x80) != 0) d |= -256; | |
1074 | if(k === 0 && (self.s&0x80) != (d&0x80)) ++k; | |
1075 | if(k > 0 || d != self.s) r[k++] = d; | |
1076 | } | |
1077 | } | |
1078 | return r; | |
1079 | } | |
1080 | ||
1081 | function bnEquals(a) { return(this.compareTo(a)==0); } | |
1082 | function bnMin(a) { return(this.compareTo(a)<0)?this:a; } | |
1083 | function bnMax(a) { return(this.compareTo(a)>0)?this:a; } | |
1084 | ||
1085 | // (protected) r = this op a (bitwise) | |
1086 | function bnpBitwiseTo(a,op,r) { | |
1087 | var self = this; | |
1088 | var i, f, m = Math.min(a.t,self.t); | |
1089 | for(i = 0; i < m; ++i) r[i] = op(self[i],a[i]); | |
1090 | if(a.t < self.t) { | |
1091 | f = a.s&self.DM; | |
1092 | for(i = m; i < self.t; ++i) r[i] = op(self[i],f); | |
1093 | r.t = self.t; | |
1094 | } | |
1095 | else { | |
1096 | f = self.s&self.DM; | |
1097 | for(i = m; i < a.t; ++i) r[i] = op(f,a[i]); | |
1098 | r.t = a.t; | |
1099 | } | |
1100 | r.s = op(self.s,a.s); | |
1101 | r.clamp(); | |
1102 | } | |
1103 | ||
1104 | // (public) this & a | |
1105 | function op_and(x,y) { return x&y; } | |
1106 | function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; } | |
1107 | ||
1108 | // (public) this | a | |
1109 | function op_or(x,y) { return x|y; } | |
1110 | function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; } | |
1111 | ||
1112 | // (public) this ^ a | |
1113 | function op_xor(x,y) { return x^y; } | |
1114 | function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; } | |
1115 | ||
1116 | // (public) this & ~a | |
1117 | function op_andnot(x,y) { return x&~y; } | |
1118 | function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; } | |
1119 | ||
1120 | // (public) ~this | |
1121 | function bnNot() { | |
1122 | var r = nbi(); | |
1123 | for(var i = 0; i < this.t; ++i) r[i] = this.DM&~this[i]; | |
1124 | r.t = this.t; | |
1125 | r.s = ~this.s; | |
1126 | return r; | |
1127 | } | |
1128 | ||
1129 | // (public) this << n | |
1130 | function bnShiftLeft(n) { | |
1131 | var r = nbi(); | |
1132 | if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r); | |
1133 | return r; | |
1134 | } | |
1135 | ||
1136 | // (public) this >> n | |
1137 | function bnShiftRight(n) { | |
1138 | var r = nbi(); | |
1139 | if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); | |
1140 | return r; | |
1141 | } | |
1142 | ||
1143 | // return index of lowest 1-bit in x, x < 2^31 | |
1144 | function lbit(x) { | |
1145 | if(x == 0) return -1; | |
1146 | var r = 0; | |
1147 | if((x&0xffff) == 0) { x >>= 16; r += 16; } | |
1148 | if((x&0xff) == 0) { x >>= 8; r += 8; } | |
1149 | if((x&0xf) == 0) { x >>= 4; r += 4; } | |
1150 | if((x&3) == 0) { x >>= 2; r += 2; } | |
1151 | if((x&1) == 0) ++r; | |
1152 | return r; | |
1153 | } | |
1154 | ||
1155 | // (public) returns index of lowest 1-bit (or -1 if none) | |
1156 | function bnGetLowestSetBit() { | |
1157 | for(var i = 0; i < this.t; ++i) | |
1158 | if(this[i] != 0) return i*this.DB+lbit(this[i]); | |
1159 | if(this.s < 0) return this.t*this.DB; | |
1160 | return -1; | |
1161 | } | |
1162 | ||
1163 | // return number of 1 bits in x | |
1164 | function cbit(x) { | |
1165 | var r = 0; | |
1166 | while(x != 0) { x &= x-1; ++r; } | |
1167 | return r; | |
1168 | } | |
1169 | ||
1170 | // (public) return number of set bits | |
1171 | function bnBitCount() { | |
1172 | var r = 0, x = this.s&this.DM; | |
1173 | for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x); | |
1174 | return r; | |
1175 | } | |
1176 | ||
1177 | // (public) true iff nth bit is set | |
1178 | function bnTestBit(n) { | |
1179 | var j = Math.floor(n/this.DB); | |
1180 | if(j >= this.t) return(this.s!=0); | |
1181 | return((this[j]&(1<<(n%this.DB)))!=0); | |
1182 | } | |
1183 | ||
1184 | // (protected) this op (1<<n) | |
1185 | function bnpChangeBit(n,op) { | |
1186 | var r = BigInteger.ONE.shiftLeft(n); | |
1187 | this.bitwiseTo(r,op,r); | |
1188 | return r; | |
1189 | } | |
1190 | ||
1191 | // (public) this | (1<<n) | |
1192 | function bnSetBit(n) { return this.changeBit(n,op_or); } | |
1193 | ||
1194 | // (public) this & ~(1<<n) | |
1195 | function bnClearBit(n) { return this.changeBit(n,op_andnot); } | |
1196 | ||
1197 | // (public) this ^ (1<<n) | |
1198 | function bnFlipBit(n) { return this.changeBit(n,op_xor); } | |
1199 | ||
1200 | // (protected) r = this + a | |
1201 | function bnpAddTo(a,r) { | |
1202 | var self = this; | |
1203 | ||
1204 | var i = 0, c = 0, m = Math.min(a.t,self.t); | |
1205 | while(i < m) { | |
1206 | c += self[i]+a[i]; | |
1207 | r[i++] = c&self.DM; | |
1208 | c >>= self.DB; | |
1209 | } | |
1210 | if(a.t < self.t) { | |
1211 | c += a.s; | |
1212 | while(i < self.t) { | |
1213 | c += self[i]; | |
1214 | r[i++] = c&self.DM; | |
1215 | c >>= self.DB; | |
1216 | } | |
1217 | c += self.s; | |
1218 | } | |
1219 | else { | |
1220 | c += self.s; | |
1221 | while(i < a.t) { | |
1222 | c += a[i]; | |
1223 | r[i++] = c&self.DM; | |
1224 | c >>= self.DB; | |
1225 | } | |
1226 | c += a.s; | |
1227 | } | |
1228 | r.s = (c<0)?-1:0; | |
1229 | if(c > 0) r[i++] = c; | |
1230 | else if(c < -1) r[i++] = self.DV+c; | |
1231 | r.t = i; | |
1232 | r.clamp(); | |
1233 | } | |
1234 | ||
1235 | // (public) this + a | |
1236 | function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } | |
1237 | ||
1238 | // (public) this - a | |
1239 | function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } | |
1240 | ||
1241 | // (public) this * a | |
1242 | function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } | |
1243 | ||
1244 | // (public) this^2 | |
1245 | function bnSquare() { var r = nbi(); this.squareTo(r); return r; } | |
1246 | ||
1247 | // (public) this / a | |
1248 | function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } | |
1249 | ||
1250 | // (public) this % a | |
1251 | function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } | |
1252 | ||
1253 | // (public) [this/a,this%a] | |
1254 | function bnDivideAndRemainder(a) { | |
1255 | var q = nbi(), r = nbi(); | |
1256 | this.divRemTo(a,q,r); | |
1257 | return new Array(q,r); | |
1258 | } | |
1259 | ||
1260 | // (protected) this *= n, this >= 0, 1 < n < DV | |
1261 | function bnpDMultiply(n) { | |
1262 | this[this.t] = this.am(0,n-1,this,0,0,this.t); | |
1263 | ++this.t; | |
1264 | this.clamp(); | |
1265 | } | |
1266 | ||
1267 | // (protected) this += n << w words, this >= 0 | |
1268 | function bnpDAddOffset(n,w) { | |
1269 | if(n == 0) return; | |
1270 | while(this.t <= w) this[this.t++] = 0; | |
1271 | this[w] += n; | |
1272 | while(this[w] >= this.DV) { | |
1273 | this[w] -= this.DV; | |
1274 | if(++w >= this.t) this[this.t++] = 0; | |
1275 | ++this[w]; | |
1276 | } | |
1277 | } | |
1278 | ||
1279 | // A "null" reducer | |
1280 | function NullExp() {} | |
1281 | function nNop(x) { return x; } | |
1282 | function nMulTo(x,y,r) { x.multiplyTo(y,r); } | |
1283 | function nSqrTo(x,r) { x.squareTo(r); } | |
1284 | ||
1285 | NullExp.prototype.convert = nNop; | |
1286 | NullExp.prototype.revert = nNop; | |
1287 | NullExp.prototype.mulTo = nMulTo; | |
1288 | NullExp.prototype.sqrTo = nSqrTo; | |
1289 | ||
1290 | // (public) this^e | |
1291 | function bnPow(e) { return this.exp(e,new NullExp()); } | |
1292 | ||
1293 | // (protected) r = lower n words of "this * a", a.t <= n | |
1294 | // "this" should be the larger one if appropriate. | |
1295 | function bnpMultiplyLowerTo(a,n,r) { | |
1296 | var i = Math.min(this.t+a.t,n); | |
1297 | r.s = 0; // assumes a,this >= 0 | |
1298 | r.t = i; | |
1299 | while(i > 0) r[--i] = 0; | |
1300 | var j; | |
1301 | for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t); | |
1302 | for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i); | |
1303 | r.clamp(); | |
1304 | } | |
1305 | ||
1306 | // (protected) r = "this * a" without lower n words, n > 0 | |
1307 | // "this" should be the larger one if appropriate. | |
1308 | function bnpMultiplyUpperTo(a,n,r) { | |
1309 | --n; | |
1310 | var i = r.t = this.t+a.t-n; | |
1311 | r.s = 0; // assumes a,this >= 0 | |
1312 | while(--i >= 0) r[i] = 0; | |
1313 | for(i = Math.max(n-this.t,0); i < a.t; ++i) | |
1314 | r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n); | |
1315 | r.clamp(); | |
1316 | r.drShiftTo(1,r); | |
1317 | } | |
1318 | ||
1319 | // Barrett modular reduction | |
1320 | function Barrett(m) { | |
1321 | // setup Barrett | |
1322 | this.r2 = nbi(); | |
1323 | this.q3 = nbi(); | |
1324 | BigInteger.ONE.dlShiftTo(2*m.t,this.r2); | |
1325 | this.mu = this.r2.divide(m); | |
1326 | this.m = m; | |
1327 | } | |
1328 | ||
1329 | function barrettConvert(x) { | |
1330 | if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); | |
1331 | else if(x.compareTo(this.m) < 0) return x; | |
1332 | else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } | |
1333 | } | |
1334 | ||
1335 | function barrettRevert(x) { return x; } | |
1336 | ||
1337 | // x = x mod m (HAC 14.42) | |
1338 | function barrettReduce(x) { | |
1339 | var self = this; | |
1340 | x.drShiftTo(self.m.t-1,self.r2); | |
1341 | if(x.t > self.m.t+1) { x.t = self.m.t+1; x.clamp(); } | |
1342 | self.mu.multiplyUpperTo(self.r2,self.m.t+1,self.q3); | |
1343 | self.m.multiplyLowerTo(self.q3,self.m.t+1,self.r2); | |
1344 | while(x.compareTo(self.r2) < 0) x.dAddOffset(1,self.m.t+1); | |
1345 | x.subTo(self.r2,x); | |
1346 | while(x.compareTo(self.m) >= 0) x.subTo(self.m,x); | |
1347 | } | |
1348 | ||
1349 | // r = x^2 mod m; x != r | |
1350 | function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } | |
1351 | ||
1352 | // r = x*y mod m; x,y != r | |
1353 | function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } | |
1354 | ||
1355 | Barrett.prototype.convert = barrettConvert; | |
1356 | Barrett.prototype.revert = barrettRevert; | |
1357 | Barrett.prototype.reduce = barrettReduce; | |
1358 | Barrett.prototype.mulTo = barrettMulTo; | |
1359 | Barrett.prototype.sqrTo = barrettSqrTo; | |
1360 | ||
1361 | // (public) this^e % m (HAC 14.85) | |
1362 | function bnModPow(e,m) { | |
1363 | var i = e.bitLength(), k, r = nbv(1), z; | |
1364 | if(i <= 0) return r; | |
1365 | else if(i < 18) k = 1; | |
1366 | else if(i < 48) k = 3; | |
1367 | else if(i < 144) k = 4; | |
1368 | else if(i < 768) k = 5; | |
1369 | else k = 6; | |
1370 | if(i < 8) | |
1371 | z = new Classic(m); | |
1372 | else if(m.isEven()) | |
1373 | z = new Barrett(m); | |
1374 | else | |
1375 | z = new Montgomery(m); | |
1376 | ||
1377 | // precomputation | |
1378 | var g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1; | |
1379 | g[1] = z.convert(this); | |
1380 | if(k > 1) { | |
1381 | var g2 = nbi(); | |
1382 | z.sqrTo(g[1],g2); | |
1383 | while(n <= km) { | |
1384 | g[n] = nbi(); | |
1385 | z.mulTo(g2,g[n-2],g[n]); | |
1386 | n += 2; | |
1387 | } | |
1388 | } | |
1389 | ||
1390 | var j = e.t-1, w, is1 = true, r2 = nbi(), t; | |
1391 | i = nbits(e[j])-1; | |
1392 | while(j >= 0) { | |
1393 | if(i >= k1) w = (e[j]>>(i-k1))&km; | |
1394 | else { | |
1395 | w = (e[j]&((1<<(i+1))-1))<<(k1-i); | |
1396 | if(j > 0) w |= e[j-1]>>(this.DB+i-k1); | |
1397 | } | |
1398 | ||
1399 | n = k; | |
1400 | while((w&1) == 0) { w >>= 1; --n; } | |
1401 | if((i -= n) < 0) { i += this.DB; --j; } | |
1402 | if(is1) { // ret == 1, don't bother squaring or multiplying it | |
1403 | g[w].copyTo(r); | |
1404 | is1 = false; | |
1405 | } | |
1406 | else { | |
1407 | while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } | |
1408 | if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } | |
1409 | z.mulTo(r2,g[w],r); | |
1410 | } | |
1411 | ||
1412 | while(j >= 0 && (e[j]&(1<<i)) == 0) { | |
1413 | z.sqrTo(r,r2); t = r; r = r2; r2 = t; | |
1414 | if(--i < 0) { i = this.DB-1; --j; } | |
1415 | } | |
1416 | } | |
1417 | return z.revert(r); | |
1418 | } | |
1419 | ||
1420 | // (public) gcd(this,a) (HAC 14.54) | |
1421 | function bnGCD(a) { | |
1422 | var x = (this.s<0)?this.negate():this.clone(); | |
1423 | var y = (a.s<0)?a.negate():a.clone(); | |
1424 | if(x.compareTo(y) < 0) { var t = x; x = y; y = t; } | |
1425 | var i = x.getLowestSetBit(), g = y.getLowestSetBit(); | |
1426 | if(g < 0) return x; | |
1427 | if(i < g) g = i; | |
1428 | if(g > 0) { | |
1429 | x.rShiftTo(g,x); | |
1430 | y.rShiftTo(g,y); | |
1431 | } | |
1432 | while(x.signum() > 0) { | |
1433 | if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); | |
1434 | if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); | |
1435 | if(x.compareTo(y) >= 0) { | |
1436 | x.subTo(y,x); | |
1437 | x.rShiftTo(1,x); | |
1438 | } | |
1439 | else { | |
1440 | y.subTo(x,y); | |
1441 | y.rShiftTo(1,y); | |
1442 | } | |
1443 | } | |
1444 | if(g > 0) y.lShiftTo(g,y); | |
1445 | return y; | |
1446 | } | |
1447 | ||
1448 | // (protected) this % n, n < 2^26 | |
1449 | function bnpModInt(n) { | |
1450 | if(n <= 0) return 0; | |
1451 | var d = this.DV%n, r = (this.s<0)?n-1:0; | |
1452 | if(this.t > 0) | |
1453 | if(d == 0) r = this[0]%n; | |
1454 | else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n; | |
1455 | return r; | |
1456 | } | |
1457 | ||
1458 | // (public) 1/this % m (HAC 14.61) | |
1459 | function bnModInverse(m) { | |
1460 | var ac = m.isEven(); | |
1461 | if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; | |
1462 | var u = m.clone(), v = this.clone(); | |
1463 | var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); | |
1464 | while(u.signum() != 0) { | |
1465 | while(u.isEven()) { | |
1466 | u.rShiftTo(1,u); | |
1467 | if(ac) { | |
1468 | if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } | |
1469 | a.rShiftTo(1,a); | |
1470 | } | |
1471 | else if(!b.isEven()) b.subTo(m,b); | |
1472 | b.rShiftTo(1,b); | |
1473 | } | |
1474 | while(v.isEven()) { | |
1475 | v.rShiftTo(1,v); | |
1476 | if(ac) { | |
1477 | if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } | |
1478 | c.rShiftTo(1,c); | |
1479 | } | |
1480 | else if(!d.isEven()) d.subTo(m,d); | |
1481 | d.rShiftTo(1,d); | |
1482 | } | |
1483 | if(u.compareTo(v) >= 0) { | |
1484 | u.subTo(v,u); | |
1485 | if(ac) a.subTo(c,a); | |
1486 | b.subTo(d,b); | |
1487 | } | |
1488 | else { | |
1489 | v.subTo(u,v); | |
1490 | if(ac) c.subTo(a,c); | |
1491 | d.subTo(b,d); | |
1492 | } | |
1493 | } | |
1494 | if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; | |
1495 | if(d.compareTo(m) >= 0) return d.subtract(m); | |
1496 | if(d.signum() < 0) d.addTo(m,d); else return d; | |
1497 | if(d.signum() < 0) return d.add(m); else return d; | |
1498 | } | |
1499 | ||
1500 | // protected | |
1501 | proto.chunkSize = bnpChunkSize; | |
1502 | proto.toRadix = bnpToRadix; | |
1503 | proto.fromRadix = bnpFromRadix; | |
1504 | proto.fromNumber = bnpFromNumber; | |
1505 | proto.bitwiseTo = bnpBitwiseTo; | |
1506 | proto.changeBit = bnpChangeBit; | |
1507 | proto.addTo = bnpAddTo; | |
1508 | proto.dMultiply = bnpDMultiply; | |
1509 | proto.dAddOffset = bnpDAddOffset; | |
1510 | proto.multiplyLowerTo = bnpMultiplyLowerTo; | |
1511 | proto.multiplyUpperTo = bnpMultiplyUpperTo; | |
1512 | proto.modInt = bnpModInt; | |
1513 | ||
1514 | // public | |
1515 | proto.clone = bnClone; | |
1516 | proto.intValue = bnIntValue; | |
1517 | proto.byteValue = bnByteValue; | |
1518 | proto.shortValue = bnShortValue; | |
1519 | proto.signum = bnSigNum; | |
1520 | proto.toByteArray = bnToByteArray; | |
1521 | proto.equals = bnEquals; | |
1522 | proto.min = bnMin; | |
1523 | proto.max = bnMax; | |
1524 | proto.and = bnAnd; | |
1525 | proto.or = bnOr; | |
1526 | proto.xor = bnXor; | |
1527 | proto.andNot = bnAndNot; | |
1528 | proto.not = bnNot; | |
1529 | proto.shiftLeft = bnShiftLeft; | |
1530 | proto.shiftRight = bnShiftRight; | |
1531 | proto.getLowestSetBit = bnGetLowestSetBit; | |
1532 | proto.bitCount = bnBitCount; | |
1533 | proto.testBit = bnTestBit; | |
1534 | proto.setBit = bnSetBit; | |
1535 | proto.clearBit = bnClearBit; | |
1536 | proto.flipBit = bnFlipBit; | |
1537 | proto.add = bnAdd; | |
1538 | proto.subtract = bnSubtract; | |
1539 | proto.multiply = bnMultiply; | |
1540 | proto.divide = bnDivide; | |
1541 | proto.remainder = bnRemainder; | |
1542 | proto.divideAndRemainder = bnDivideAndRemainder; | |
1543 | proto.modPow = bnModPow; | |
1544 | proto.modInverse = bnModInverse; | |
1545 | proto.pow = bnPow; | |
1546 | proto.gcd = bnGCD; | |
1547 | ||
1548 | // JSBN-specific extension | |
1549 | proto.square = bnSquare; | |
1550 | ||
1551 | // BigInteger interfaces not implemented in jsbn: | |
1552 | ||
1553 | // BigInteger(int signum, byte[] magnitude) | |
1554 | // double doubleValue() | |
1555 | // float floatValue() | |
1556 | // int hashCode() | |
1557 | // long longValue() | |
1558 | // static BigInteger valueOf(long val) | |
1559 | ||
1560 | // "constants" | |
1561 | BigInteger.ZERO = nbv(0); | |
1562 | BigInteger.ONE = nbv(1); | |
1563 | BigInteger.valueOf = nbv; | |
1564 | ||
1565 | },{"assert":4}],2:[function(_dereq_,module,exports){ | |
1566 | (function (Buffer){ | |
1567 | // FIXME: Kind of a weird way to throw exceptions, consider removing | |
1568 | var assert = _dereq_('assert') | |
1569 | var BigInteger = _dereq_('./bigi') | |
1570 | ||
1571 | /** | |
1572 | * Turns a byte array into a big integer. | |
1573 | * | |
1574 | * This function will interpret a byte array as a big integer in big | |
1575 | * endian notation. | |
1576 | */ | |
1577 | BigInteger.fromByteArrayUnsigned = function(byteArray) { | |
1578 | // BigInteger expects a DER integer conformant byte array | |
1579 | if (byteArray[0] & 0x80) { | |
1580 | return new BigInteger([0].concat(byteArray)) | |
1581 | } | |
1582 | ||
1583 | return new BigInteger(byteArray) | |
1584 | } | |
1585 | ||
1586 | /** | |
1587 | * Returns a byte array representation of the big integer. | |
1588 | * | |
1589 | * This returns the absolute of the contained value in big endian | |
1590 | * form. A value of zero results in an empty array. | |
1591 | */ | |
1592 | BigInteger.prototype.toByteArrayUnsigned = function() { | |
1593 | var byteArray = this.toByteArray() | |
1594 | return byteArray[0] === 0 ? byteArray.slice(1) : byteArray | |
1595 | } | |
1596 | ||
1597 | BigInteger.fromDERInteger = function(byteArray) { | |
1598 | return new BigInteger(byteArray) | |
1599 | } | |
1600 | ||
1601 | /* | |
1602 | * Converts BigInteger to a DER integer representation. | |
1603 | * | |
1604 | * The format for this value uses the most significant bit as a sign | |
1605 | * bit. If the most significant bit is already set and the integer is | |
1606 | * positive, a 0x00 is prepended. | |
1607 | * | |
1608 | * Examples: | |
1609 | * | |
1610 | * 0 => 0x00 | |
1611 | * 1 => 0x01 | |
1612 | * -1 => 0x81 | |
1613 | * 127 => 0x7f | |
1614 | * -127 => 0xff | |
1615 | * 128 => 0x0080 | |
1616 | * -128 => 0x80 | |
1617 | * 255 => 0x00ff | |
1618 | * -255 => 0xff | |
1619 | * 16300 => 0x3fac | |
1620 | * -16300 => 0xbfac | |
1621 | * 62300 => 0x00f35c | |
1622 | * -62300 => 0xf35c | |
1623 | */ | |
1624 | BigInteger.prototype.toDERInteger = BigInteger.prototype.toByteArray | |
1625 | ||
1626 | BigInteger.fromBuffer = function(buffer) { | |
1627 | // BigInteger expects a DER integer conformant byte array | |
1628 | if (buffer[0] & 0x80) { | |
1629 | var byteArray = Array.prototype.slice.call(buffer) | |
1630 | ||
1631 | return new BigInteger([0].concat(byteArray)) | |
1632 | } | |
1633 | ||
1634 | return new BigInteger(buffer) | |
1635 | } | |
1636 | ||
1637 | BigInteger.fromHex = function(hex) { | |
1638 | if (hex === '') return BigInteger.ZERO | |
1639 | ||
1640 | assert.equal(hex, hex.match(/^[A-Fa-f0-9]+/), 'Invalid hex string') | |
1641 | assert.equal(hex.length % 2, 0, 'Incomplete hex') | |
1642 | return new BigInteger(hex, 16) | |
1643 | } | |
1644 | ||
1645 | BigInteger.prototype.toBuffer = function(size) { | |
1646 | var byteArray = this.toByteArrayUnsigned() | |
1647 | var zeros = [] | |
1648 | ||
1649 | var padding = size - byteArray.length | |
1650 | while (zeros.length < padding) zeros.push(0) | |
1651 | ||
1652 | return new Buffer(zeros.concat(byteArray)) | |
1653 | } | |
1654 | ||
1655 | BigInteger.prototype.toHex = function(size) { | |
1656 | return this.toBuffer(size).toString('hex') | |
1657 | } | |
1658 | ||
1659 | }).call(this,_dereq_("buffer").Buffer) | |
1660 | },{"./bigi":1,"assert":4,"buffer":8}],3:[function(_dereq_,module,exports){ | |
1661 | var BigInteger = _dereq_('./bigi') | |
1662 | ||
1663 | //addons | |
1664 | _dereq_('./convert') | |
1665 | ||
1666 | module.exports = BigInteger | |
1667 | },{"./bigi":1,"./convert":2}],4:[function(_dereq_,module,exports){ | |
1668 | // http://wiki.commonjs.org/wiki/Unit_Testing/1.0 | |
1669 | // | |
1670 | // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! | |
1671 | // | |
1672 | // Originally from narwhal.js (http://narwhaljs.org) | |
1673 | // Copyright (c) 2009 Thomas Robinson <280north.com> | |
1674 | // | |
1675 | // Permission is hereby granted, free of charge, to any person obtaining a copy | |
1676 | // of this software and associated documentation files (the 'Software'), to | |
1677 | // deal in the Software without restriction, including without limitation the | |
1678 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
1679 | // sell copies of the Software, and to permit persons to whom the Software is | |
1680 | // furnished to do so, subject to the following conditions: | |
1681 | // | |
1682 | // The above copyright notice and this permission notice shall be included in | |
1683 | // all copies or substantial portions of the Software. | |
1684 | // | |
1685 | // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
1686 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
1687 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
1688 | // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | |
1689 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
1690 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
1691 | ||
1692 | // when used in node, this will actually load the util module we depend on | |
1693 | // versus loading the builtin util module as happens otherwise | |
1694 | // this is a bug in node module loading as far as I am concerned | |
1695 | var util = _dereq_('util/'); | |
1696 | ||
1697 | var pSlice = Array.prototype.slice; | |
1698 | var hasOwn = Object.prototype.hasOwnProperty; | |
1699 | ||
1700 | // 1. The assert module provides functions that throw | |
1701 | // AssertionError's when particular conditions are not met. The | |
1702 | // assert module must conform to the following interface. | |
1703 | ||
1704 | var assert = module.exports = ok; | |
1705 | ||
1706 | // 2. The AssertionError is defined in assert. | |
1707 | // new assert.AssertionError({ message: message, | |
1708 | // actual: actual, | |
1709 | // expected: expected }) | |
1710 | ||
1711 | assert.AssertionError = function AssertionError(options) { | |
1712 | this.name = 'AssertionError'; | |
1713 | this.actual = options.actual; | |
1714 | this.expected = options.expected; | |
1715 | this.operator = options.operator; | |
1716 | if (options.message) { | |
1717 | this.message = options.message; | |
1718 | this.generatedMessage = false; | |
1719 | } else { | |
1720 | this.message = getMessage(this); | |
1721 | this.generatedMessage = true; | |
1722 | } | |
1723 | var stackStartFunction = options.stackStartFunction || fail; | |
1724 | ||
1725 | if (Error.captureStackTrace) { | |
1726 | Error.captureStackTrace(this, stackStartFunction); | |
1727 | } | |
1728 | else { | |
1729 | // non v8 browsers so we can have a stacktrace | |
1730 | var err = new Error(); | |
1731 | if (err.stack) { | |
1732 | var out = err.stack; | |
1733 | ||
1734 | // try to strip useless frames | |
1735 | var fn_name = stackStartFunction.name; | |
1736 | var idx = out.indexOf('\n' + fn_name); | |
1737 | if (idx >= 0) { | |
1738 | // once we have located the function frame | |
1739 | // we need to strip out everything before it (and its line) | |
1740 | var next_line = out.indexOf('\n', idx + 1); | |
1741 | out = out.substring(next_line + 1); | |
1742 | } | |
1743 | ||
1744 | this.stack = out; | |
1745 | } | |
1746 | } | |
1747 | }; | |
1748 | ||
1749 | // assert.AssertionError instanceof Error | |
1750 | util.inherits(assert.AssertionError, Error); | |
1751 | ||
1752 | function replacer(key, value) { | |
1753 | if (util.isUndefined(value)) { | |
1754 | return '' + value; | |
1755 | } | |
1756 | if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) { | |
1757 | return value.toString(); | |
1758 | } | |
1759 | if (util.isFunction(value) || util.isRegExp(value)) { | |
1760 | return value.toString(); | |
1761 | } | |
1762 | return value; | |
1763 | } | |
1764 | ||
1765 | function truncate(s, n) { | |
1766 | if (util.isString(s)) { | |
1767 | return s.length < n ? s : s.slice(0, n); | |
1768 | } else { | |
1769 | return s; | |
1770 | } | |
1771 | } | |
1772 | ||
1773 | function getMessage(self) { | |
1774 | return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' + | |
1775 | self.operator + ' ' + | |
1776 | truncate(JSON.stringify(self.expected, replacer), 128); | |
1777 | } | |
1778 | ||
1779 | // At present only the three keys mentioned above are used and | |
1780 | // understood by the spec. Implementations or sub modules can pass | |
1781 | // other keys to the AssertionError's constructor - they will be | |
1782 | // ignored. | |
1783 | ||
1784 | // 3. All of the following functions must throw an AssertionError | |
1785 | // when a corresponding condition is not met, with a message that | |
1786 | // may be undefined if not provided. All assertion methods provide | |
1787 | // both the actual and expected values to the assertion error for | |
1788 | // display purposes. | |
1789 | ||
1790 | function fail(actual, expected, message, operator, stackStartFunction) { | |
1791 | throw new assert.AssertionError({ | |
1792 | message: message, | |
1793 | actual: actual, | |
1794 | expected: expected, | |
1795 | operator: operator, | |
1796 | stackStartFunction: stackStartFunction | |
1797 | }); | |
1798 | } | |
1799 | ||
1800 | // EXTENSION! allows for well behaved errors defined elsewhere. | |
1801 | assert.fail = fail; | |
1802 | ||
1803 | // 4. Pure assertion tests whether a value is truthy, as determined | |
1804 | // by !!guard. | |
1805 | // assert.ok(guard, message_opt); | |
1806 | // This statement is equivalent to assert.equal(true, !!guard, | |
1807 | // message_opt);. To test strictly for the value true, use | |
1808 | // assert.strictEqual(true, guard, message_opt);. | |
1809 | ||
1810 | function ok(value, message) { | |
1811 | if (!value) fail(value, true, message, '==', assert.ok); | |
1812 | } | |
1813 | assert.ok = ok; | |
1814 | ||
1815 | // 5. The equality assertion tests shallow, coercive equality with | |
1816 | // ==. | |
1817 | // assert.equal(actual, expected, message_opt); | |
1818 | ||
1819 | assert.equal = function equal(actual, expected, message) { | |
1820 | if (actual != expected) fail(actual, expected, message, '==', assert.equal); | |
1821 | }; | |
1822 | ||
1823 | // 6. The non-equality assertion tests for whether two objects are not equal | |
1824 | // with != assert.notEqual(actual, expected, message_opt); | |
1825 | ||
1826 | assert.notEqual = function notEqual(actual, expected, message) { | |
1827 | if (actual == expected) { | |
1828 | fail(actual, expected, message, '!=', assert.notEqual); | |
1829 | } | |
1830 | }; | |
1831 | ||
1832 | // 7. The equivalence assertion tests a deep equality relation. | |
1833 | // assert.deepEqual(actual, expected, message_opt); | |
1834 | ||
1835 | assert.deepEqual = function deepEqual(actual, expected, message) { | |
1836 | if (!_deepEqual(actual, expected)) { | |
1837 | fail(actual, expected, message, 'deepEqual', assert.deepEqual); | |
1838 | } | |
1839 | }; | |
1840 | ||
1841 | function _deepEqual(actual, expected) { | |
1842 | // 7.1. All identical values are equivalent, as determined by ===. | |
1843 | if (actual === expected) { | |
1844 | return true; | |
1845 | ||
1846 | } else if (util.isBuffer(actual) && util.isBuffer(expected)) { | |
1847 | if (actual.length != expected.length) return false; | |
1848 | ||
1849 | for (var i = 0; i < actual.length; i++) { | |
1850 | if (actual[i] !== expected[i]) return false; | |
1851 | } | |
1852 | ||
1853 | return true; | |
1854 | ||
1855 | // 7.2. If the expected value is a Date object, the actual value is | |
1856 | // equivalent if it is also a Date object that refers to the same time. | |
1857 | } else if (util.isDate(actual) && util.isDate(expected)) { | |
1858 | return actual.getTime() === expected.getTime(); | |
1859 | ||
1860 | // 7.3 If the expected value is a RegExp object, the actual value is | |
1861 | // equivalent if it is also a RegExp object with the same source and | |
1862 | // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). | |
1863 | } else if (util.isRegExp(actual) && util.isRegExp(expected)) { | |
1864 | return actual.source === expected.source && | |
1865 | actual.global === expected.global && | |
1866 | actual.multiline === expected.multiline && | |
1867 | actual.lastIndex === expected.lastIndex && | |
1868 | actual.ignoreCase === expected.ignoreCase; | |
1869 | ||
1870 | // 7.4. Other pairs that do not both pass typeof value == 'object', | |
1871 | // equivalence is determined by ==. | |
1872 | } else if (!util.isObject(actual) && !util.isObject(expected)) { | |
1873 | return actual == expected; | |
1874 | ||
1875 | // 7.5 For all other Object pairs, including Array objects, equivalence is | |
1876 | // determined by having the same number of owned properties (as verified | |
1877 | // with Object.prototype.hasOwnProperty.call), the same set of keys | |
1878 | // (although not necessarily the same order), equivalent values for every | |
1879 | // corresponding key, and an identical 'prototype' property. Note: this | |
1880 | // accounts for both named and indexed properties on Arrays. | |
1881 | } else { | |
1882 | return objEquiv(actual, expected); | |
1883 | } | |
1884 | } | |
1885 | ||
1886 | function isArguments(object) { | |
1887 | return Object.prototype.toString.call(object) == '[object Arguments]'; | |
1888 | } | |
1889 | ||
1890 | function objEquiv(a, b) { | |
1891 | if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b)) | |
1892 | return false; | |
1893 | // an identical 'prototype' property. | |
1894 | if (a.prototype !== b.prototype) return false; | |
1895 | //~~~I've managed to break Object.keys through screwy arguments passing. | |
1896 | // Converting to array solves the problem. | |
1897 | if (isArguments(a)) { | |
1898 | if (!isArguments(b)) { | |
1899 | return false; | |
1900 | } | |
1901 | a = pSlice.call(a); | |
1902 | b = pSlice.call(b); | |
1903 | return _deepEqual(a, b); | |
1904 | } | |
1905 | try { | |
1906 | var ka = objectKeys(a), | |
1907 | kb = objectKeys(b), | |
1908 | key, i; | |
1909 | } catch (e) {//happens when one is a string literal and the other isn't | |
1910 | return false; | |
1911 | } | |
1912 | // having the same number of owned properties (keys incorporates | |
1913 | // hasOwnProperty) | |
1914 | if (ka.length != kb.length) | |
1915 | return false; | |
1916 | //the same set of keys (although not necessarily the same order), | |
1917 | ka.sort(); | |
1918 | kb.sort(); | |
1919 | //~~~cheap key test | |
1920 | for (i = ka.length - 1; i >= 0; i--) { | |
1921 | if (ka[i] != kb[i]) | |
1922 | return false; | |
1923 | } | |
1924 | //equivalent values for every corresponding key, and | |
1925 | //~~~possibly expensive deep test | |
1926 | for (i = ka.length - 1; i >= 0; i--) { | |
1927 | key = ka[i]; | |
1928 | if (!_deepEqual(a[key], b[key])) return false; | |
1929 | } | |
1930 | return true; | |
1931 | } | |
1932 | ||
1933 | // 8. The non-equivalence assertion tests for any deep inequality. | |
1934 | // assert.notDeepEqual(actual, expected, message_opt); | |
1935 | ||
1936 | assert.notDeepEqual = function notDeepEqual(actual, expected, message) { | |
1937 | if (_deepEqual(actual, expected)) { | |
1938 | fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); | |
1939 | } | |
1940 | }; | |
1941 | ||
1942 | // 9. The strict equality assertion tests strict equality, as determined by ===. | |
1943 | // assert.strictEqual(actual, expected, message_opt); | |
1944 | ||
1945 | assert.strictEqual = function strictEqual(actual, expected, message) { | |
1946 | if (actual !== expected) { | |
1947 | fail(actual, expected, message, '===', assert.strictEqual); | |
1948 | } | |
1949 | }; | |
1950 | ||
1951 | // 10. The strict non-equality assertion tests for strict inequality, as | |
1952 | // determined by !==. assert.notStrictEqual(actual, expected, message_opt); | |
1953 | ||
1954 | assert.notStrictEqual = function notStrictEqual(actual, expected, message) { | |
1955 | if (actual === expected) { | |
1956 | fail(actual, expected, message, '!==', assert.notStrictEqual); | |
1957 | } | |
1958 | }; | |
1959 | ||
1960 | function expectedException(actual, expected) { | |
1961 | if (!actual || !expected) { | |
1962 | return false; | |
1963 | } | |
1964 | ||
1965 | if (Object.prototype.toString.call(expected) == '[object RegExp]') { | |
1966 | return expected.test(actual); | |
1967 | } else if (actual instanceof expected) { | |
1968 | return true; | |
1969 | } else if (expected.call({}, actual) === true) { | |
1970 | return true; | |
1971 | } | |
1972 | ||
1973 | return false; | |
1974 | } | |
1975 | ||
1976 | function _throws(shouldThrow, block, expected, message) { | |
1977 | var actual; | |
1978 | ||
1979 | if (util.isString(expected)) { | |
1980 | message = expected; | |
1981 | expected = null; | |
1982 | } | |
1983 | ||
1984 | try { | |
1985 | block(); | |
1986 | } catch (e) { | |
1987 | actual = e; | |
1988 | } | |
1989 | ||
1990 | message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + | |
1991 | (message ? ' ' + message : '.'); | |
1992 | ||
1993 | if (shouldThrow && !actual) { | |
1994 | fail(actual, expected, 'Missing expected exception' + message); | |
1995 | } | |
1996 | ||
1997 | if (!shouldThrow && expectedException(actual, expected)) { | |
1998 | fail(actual, expected, 'Got unwanted exception' + message); | |
1999 | } | |
2000 | ||
2001 | if ((shouldThrow && actual && expected && | |
2002 | !expectedException(actual, expected)) || (!shouldThrow && actual)) { | |
2003 | throw actual; | |
2004 | } | |
2005 | } | |
2006 | ||
2007 | // 11. Expected to throw an error: | |
2008 | // assert.throws(block, Error_opt, message_opt); | |
2009 | ||
2010 | assert.throws = function(block, /*optional*/error, /*optional*/message) { | |
2011 | _throws.apply(this, [true].concat(pSlice.call(arguments))); | |
2012 | }; | |
2013 | ||
2014 | // EXTENSION! This is annoying to write outside this module. | |
2015 | assert.doesNotThrow = function(block, /*optional*/message) { | |
2016 | _throws.apply(this, [false].concat(pSlice.call(arguments))); | |
2017 | }; | |
2018 | ||
2019 | assert.ifError = function(err) { if (err) {throw err;}}; | |
2020 | ||
2021 | var objectKeys = Object.keys || function (obj) { | |
2022 | var keys = []; | |
2023 | for (var key in obj) { | |
2024 | if (hasOwn.call(obj, key)) keys.push(key); | |
2025 | } | |
2026 | return keys; | |
2027 | }; | |
2028 | ||
2029 | },{"util/":6}],5:[function(_dereq_,module,exports){ | |
2030 | module.exports = function isBuffer(arg) { | |
2031 | return arg && typeof arg === 'object' | |
2032 | && typeof arg.copy === 'function' | |
2033 | && typeof arg.fill === 'function' | |
2034 | && typeof arg.readUInt8 === 'function'; | |
2035 | } | |
2036 | },{}],6:[function(_dereq_,module,exports){ | |
2037 | (function (process,global){ | |
2038 | // Copyright Joyent, Inc. and other Node contributors. | |
2039 | // | |
2040 | // Permission is hereby granted, free of charge, to any person obtaining a | |
2041 | // copy of this software and associated documentation files (the | |
2042 | // "Software"), to deal in the Software without restriction, including | |
2043 | // without limitation the rights to use, copy, modify, merge, publish, | |
2044 | // distribute, sublicense, and/or sell copies of the Software, and to permit | |
2045 | // persons to whom the Software is furnished to do so, subject to the | |
2046 | // following conditions: | |
2047 | // | |
2048 | // The above copyright notice and this permission notice shall be included | |
2049 | // in all copies or substantial portions of the Software. | |
2050 | // | |
2051 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
2052 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
2053 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | |
2054 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | |
2055 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | |
2056 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | |
2057 | // USE OR OTHER DEALINGS IN THE SOFTWARE. | |
2058 | ||
2059 | var formatRegExp = /%[sdj%]/g; | |
2060 | exports.format = function(f) { | |
2061 | if (!isString(f)) { | |
2062 | var objects = []; | |
2063 | for (var i = 0; i < arguments.length; i++) { | |
2064 | objects.push(inspect(arguments[i])); | |
2065 | } | |
2066 | return objects.join(' '); | |
2067 | } | |
2068 | ||
2069 | var i = 1; | |
2070 | var args = arguments; | |
2071 | var len = args.length; | |
2072 | var str = String(f).replace(formatRegExp, function(x) { | |
2073 | if (x === '%%') return '%'; | |
2074 | if (i >= len) return x; | |
2075 | switch (x) { | |
2076 | case '%s': return String(args[i++]); | |
2077 | case '%d': return Number(args[i++]); | |
2078 | case '%j': | |
2079 | try { | |
2080 | return JSON.stringify(args[i++]); | |
2081 | } catch (_) { | |
2082 | return '[Circular]'; | |
2083 | } | |
2084 | default: | |
2085 | return x; | |
2086 | } | |
2087 | }); | |
2088 | for (var x = args[i]; i < len; x = args[++i]) { | |
2089 | if (isNull(x) || !isObject(x)) { | |
2090 | str += ' ' + x; | |
2091 | } else { | |
2092 | str += ' ' + inspect(x); | |
2093 | } | |
2094 | } | |
2095 | return str; | |
2096 | }; | |
2097 | ||
2098 | ||
2099 | // Mark that a method should not be used. | |
2100 | // Returns a modified function which warns once by default. | |
2101 | // If --no-deprecation is set, then it is a no-op. | |
2102 | exports.deprecate = function(fn, msg) { | |
2103 | // Allow for deprecating things in the process of starting up. | |
2104 | if (isUndefined(global.process)) { | |
2105 | return function() { | |
2106 | return exports.deprecate(fn, msg).apply(this, arguments); | |
2107 | }; | |
2108 | } | |
2109 | ||
2110 | if (process.noDeprecation === true) { | |
2111 | return fn; | |
2112 | } | |
2113 | ||
2114 | var warned = false; | |
2115 | function deprecated() { | |
2116 | if (!warned) { | |
2117 | if (process.throwDeprecation) { | |
2118 | throw new Error(msg); | |
2119 | } else if (process.traceDeprecation) { | |
2120 | console.trace(msg); | |
2121 | } else { | |
2122 | console.error(msg); | |
2123 | } | |
2124 | warned = true; | |
2125 | } | |
2126 | return fn.apply(this, arguments); | |
2127 | } | |
2128 | ||
2129 | return deprecated; | |
2130 | }; | |
2131 | ||
2132 | ||
2133 | var debugs = {}; | |
2134 | var debugEnviron; | |
2135 | exports.debuglog = function(set) { | |
2136 | if (isUndefined(debugEnviron)) | |
2137 | debugEnviron = process.env.NODE_DEBUG || ''; | |
2138 | set = set.toUpperCase(); | |
2139 | if (!debugs[set]) { | |
2140 | if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { | |
2141 | var pid = process.pid; | |
2142 | debugs[set] = function() { | |
2143 | var msg = exports.format.apply(exports, arguments); | |
2144 | console.error('%s %d: %s', set, pid, msg); | |
2145 | }; | |
2146 | } else { | |
2147 | debugs[set] = function() {}; | |
2148 | } | |
2149 | } | |
2150 | return debugs[set]; | |
2151 | }; | |
2152 | ||
2153 | ||
2154 | /** | |
2155 | * Echos the value of a value. Trys to print the value out | |
2156 | * in the best way possible given the different types. | |
2157 | * | |
2158 | * @param {Object} obj The object to print out. | |
2159 | * @param {Object} opts Optional options object that alters the output. | |
2160 | */ | |
2161 | /* legacy: obj, showHidden, depth, colors*/ | |
2162 | function inspect(obj, opts) { | |
2163 | // default options | |
2164 | var ctx = { | |
2165 | seen: [], | |
2166 | stylize: stylizeNoColor | |
2167 | }; | |
2168 | // legacy... | |
2169 | if (arguments.length >= 3) ctx.depth = arguments[2]; | |
2170 | if (arguments.length >= 4) ctx.colors = arguments[3]; | |
2171 | if (isBoolean(opts)) { | |
2172 | // legacy... | |
2173 | ctx.showHidden = opts; | |
2174 | } else if (opts) { | |
2175 | // got an "options" object | |
2176 | exports._extend(ctx, opts); | |
2177 | } | |
2178 | // set default options | |
2179 | if (isUndefined(ctx.showHidden)) ctx.showHidden = false; | |
2180 | if (isUndefined(ctx.depth)) ctx.depth = 2; | |
2181 | if (isUndefined(ctx.colors)) ctx.colors = false; | |
2182 | if (isUndefined(ctx.customInspect)) ctx.customInspect = true; | |
2183 | if (ctx.colors) ctx.stylize = stylizeWithColor; | |
2184 | return formatValue(ctx, obj, ctx.depth); | |
2185 | } | |
2186 | exports.inspect = inspect; | |
2187 | ||
2188 | ||
2189 | // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics | |
2190 | inspect.colors = { | |
2191 | 'bold' : [1, 22], | |
2192 | 'italic' : [3, 23], | |
2193 | 'underline' : [4, 24], | |
2194 | 'inverse' : [7, 27], | |
2195 | 'white' : [37, 39], | |
2196 | 'grey' : [90, 39], | |
2197 | 'black' : [30, 39], | |
2198 | 'blue' : [34, 39], | |
2199 | 'cyan' : [36, 39], | |
2200 | 'green' : [32, 39], | |
2201 | 'magenta' : [35, 39], | |
2202 | 'red' : [31, 39], | |
2203 | 'yellow' : [33, 39] | |
2204 | }; | |
2205 | ||
2206 | // Don't use 'blue' not visible on cmd.exe | |
2207 | inspect.styles = { | |
2208 | 'special': 'cyan', | |
2209 | 'number': 'yellow', | |
2210 | 'boolean': 'yellow', | |
2211 | 'undefined': 'grey', | |
2212 | 'null': 'bold', | |
2213 | 'string': 'green', | |
2214 | 'date': 'magenta', | |
2215 | // "name": intentionally not styling | |
2216 | 'regexp': 'red' | |
2217 | }; | |
2218 | ||
2219 | ||
2220 | function stylizeWithColor(str, styleType) { | |
2221 | var style = inspect.styles[styleType]; | |
2222 | ||
2223 | if (style) { | |
2224 | return '\u001b[' + inspect.colors[style][0] + 'm' + str + | |
2225 | '\u001b[' + inspect.colors[style][1] + 'm'; | |
2226 | } else { | |
2227 | return str; | |
2228 | } | |
2229 | } | |
2230 | ||
2231 | ||
2232 | function stylizeNoColor(str, styleType) { | |
2233 | return str; | |
2234 | } | |
2235 | ||
2236 | ||
2237 | function arrayToHash(array) { | |
2238 | var hash = {}; | |
2239 | ||
2240 | array.forEach(function(val, idx) { | |
2241 | hash[val] = true; | |
2242 | }); | |
2243 | ||
2244 | return hash; | |
2245 | } | |
2246 | ||
2247 | ||
2248 | function formatValue(ctx, value, recurseTimes) { | |
2249 | // Provide a hook for user-specified inspect functions. | |
2250 | // Check that value is an object with an inspect function on it | |
2251 | if (ctx.customInspect && | |
2252 | value && | |
2253 | isFunction(value.inspect) && | |
2254 | // Filter out the util module, it's inspect function is special | |
2255 | value.inspect !== exports.inspect && | |
2256 | // Also filter out any prototype objects using the circular check. | |
2257 | !(value.constructor && value.constructor.prototype === value)) { | |
2258 | var ret = value.inspect(recurseTimes, ctx); | |
2259 | if (!isString(ret)) { | |
2260 | ret = formatValue(ctx, ret, recurseTimes); | |
2261 | } | |
2262 | return ret; | |
2263 | } | |
2264 | ||
2265 | // Primitive types cannot have properties | |
2266 | var primitive = formatPrimitive(ctx, value); | |
2267 | if (primitive) { | |
2268 | return primitive; | |
2269 | } | |
2270 | ||
2271 | // Look up the keys of the object. | |
2272 | var keys = Object.keys(value); | |
2273 | var visibleKeys = arrayToHash(keys); | |
2274 | ||
2275 | if (ctx.showHidden) { | |
2276 | keys = Object.getOwnPropertyNames(value); | |
2277 | } | |
2278 | ||
2279 | // IE doesn't make error fields non-enumerable | |
2280 | // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx | |
2281 | if (isError(value) | |
2282 | && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { | |
2283 | return formatError(value); | |
2284 | } | |
2285 | ||
2286 | // Some type of object without properties can be shortcutted. | |
2287 | if (keys.length === 0) { | |
2288 | if (isFunction(value)) { | |
2289 | var name = value.name ? ': ' + value.name : ''; | |
2290 | return ctx.stylize('[Function' + name + ']', 'special'); | |
2291 | } | |
2292 | if (isRegExp(value)) { | |
2293 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); | |
2294 | } | |
2295 | if (isDate(value)) { | |
2296 | return ctx.stylize(Date.prototype.toString.call(value), 'date'); | |
2297 | } | |
2298 | if (isError(value)) { | |
2299 | return formatError(value); | |
2300 | } | |
2301 | } | |
2302 | ||
2303 | var base = '', array = false, braces = ['{', '}']; | |
2304 | ||
2305 | // Make Array say that they are Array | |
2306 | if (isArray(value)) { | |
2307 | array = true; | |
2308 | braces = ['[', ']']; | |
2309 | } | |
2310 | ||
2311 | // Make functions say that they are functions | |
2312 | if (isFunction(value)) { | |
2313 | var n = value.name ? ': ' + value.name : ''; | |
2314 | base = ' [Function' + n + ']'; | |
2315 | } | |
2316 | ||
2317 | // Make RegExps say that they are RegExps | |
2318 | if (isRegExp(value)) { | |
2319 | base = ' ' + RegExp.prototype.toString.call(value); | |
2320 | } | |
2321 | ||
2322 | // Make dates with properties first say the date | |
2323 | if (isDate(value)) { | |
2324 | base = ' ' + Date.prototype.toUTCString.call(value); | |
2325 | } | |
2326 | ||
2327 | // Make error with message first say the error | |
2328 | if (isError(value)) { | |
2329 | base = ' ' + formatError(value); | |
2330 | } | |
2331 | ||
2332 | if (keys.length === 0 && (!array || value.length == 0)) { | |
2333 | return braces[0] + base + braces[1]; | |
2334 | } | |
2335 | ||
2336 | if (recurseTimes < 0) { | |
2337 | if (isRegExp(value)) { | |
2338 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); | |
2339 | } else { | |
2340 | return ctx.stylize('[Object]', 'special'); | |
2341 | } | |
2342 | } | |
2343 | ||
2344 | ctx.seen.push(value); | |
2345 | ||
2346 | var output; | |
2347 | if (array) { | |
2348 | output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); | |
2349 | } else { | |
2350 | output = keys.map(function(key) { | |
2351 | return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); | |
2352 | }); | |
2353 | } | |
2354 | ||
2355 | ctx.seen.pop(); | |
2356 | ||
2357 | return reduceToSingleString(output, base, braces); | |
2358 | } | |
2359 | ||
2360 | ||
2361 | function formatPrimitive(ctx, value) { | |
2362 | if (isUndefined(value)) | |
2363 | return ctx.stylize('undefined', 'undefined'); | |
2364 | if (isString(value)) { | |
2365 | var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') | |
2366 | .replace(/'/g, "\\'") | |
2367 | .replace(/\\"/g, '"') + '\''; | |
2368 | return ctx.stylize(simple, 'string'); | |
2369 | } | |
2370 | if (isNumber(value)) | |
2371 | return ctx.stylize('' + value, 'number'); | |
2372 | if (isBoolean(value)) | |
2373 | return ctx.stylize('' + value, 'boolean'); | |
2374 | // For some reason typeof null is "object", so special case here. | |
2375 | if (isNull(value)) | |
2376 | return ctx.stylize('null', 'null'); | |
2377 | } | |
2378 | ||
2379 | ||
2380 | function formatError(value) { | |
2381 | return '[' + Error.prototype.toString.call(value) + ']'; | |
2382 | } | |
2383 | ||
2384 | ||
2385 | function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { | |
2386 | var output = []; | |
2387 | for (var i = 0, l = value.length; i < l; ++i) { | |
2388 | if (hasOwnProperty(value, String(i))) { | |
2389 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, | |
2390 | String(i), true)); | |
2391 | } else { | |
2392 | output.push(''); | |
2393 | } | |
2394 | } | |
2395 | keys.forEach(function(key) { | |
2396 | if (!key.match(/^\d+$/)) { | |
2397 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, | |
2398 | key, true)); | |
2399 | } | |
2400 | }); | |
2401 | return output; | |
2402 | } | |
2403 | ||
2404 | ||
2405 | function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { | |
2406 | var name, str, desc; | |
2407 | desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; | |
2408 | if (desc.get) { | |
2409 | if (desc.set) { | |
2410 | str = ctx.stylize('[Getter/Setter]', 'special'); | |
2411 | } else { | |
2412 | str = ctx.stylize('[Getter]', 'special'); | |
2413 | } | |
2414 | } else { | |
2415 | if (desc.set) { | |
2416 | str = ctx.stylize('[Setter]', 'special'); | |
2417 | } | |
2418 | } | |
2419 | if (!hasOwnProperty(visibleKeys, key)) { | |
2420 | name = '[' + key + ']'; | |
2421 | } | |
2422 | if (!str) { | |
2423 | if (ctx.seen.indexOf(desc.value) < 0) { | |
2424 | if (isNull(recurseTimes)) { | |
2425 | str = formatValue(ctx, desc.value, null); | |
2426 | } else { | |
2427 | str = formatValue(ctx, desc.value, recurseTimes - 1); | |
2428 | } | |
2429 | if (str.indexOf('\n') > -1) { | |
2430 | if (array) { | |
2431 | str = str.split('\n').map(function(line) { | |
2432 | return ' ' + line; | |
2433 | }).join('\n').substr(2); | |
2434 | } else { | |
2435 | str = '\n' + str.split('\n').map(function(line) { | |
2436 | return ' ' + line; | |
2437 | }).join('\n'); | |
2438 | } | |
2439 | } | |
2440 | } else { | |
2441 | str = ctx.stylize('[Circular]', 'special'); | |
2442 | } | |
2443 | } | |
2444 | if (isUndefined(name)) { | |
2445 | if (array && key.match(/^\d+$/)) { | |
2446 | return str; | |
2447 | } | |
2448 | name = JSON.stringify('' + key); | |
2449 | if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { | |
2450 | name = name.substr(1, name.length - 2); | |
2451 | name = ctx.stylize(name, 'name'); | |
2452 | } else { | |
2453 | name = name.replace(/'/g, "\\'") | |
2454 | .replace(/\\"/g, '"') | |
2455 | .replace(/(^"|"$)/g, "'"); | |
2456 | name = ctx.stylize(name, 'string'); | |
2457 | } | |
2458 | } | |
2459 | ||
2460 | return name + ': ' + str; | |
2461 | } | |
2462 | ||
2463 | ||
2464 | function reduceToSingleString(output, base, braces) { | |
2465 | var numLinesEst = 0; | |
2466 | var length = output.reduce(function(prev, cur) { | |
2467 | numLinesEst++; | |
2468 | if (cur.indexOf('\n') >= 0) numLinesEst++; | |
2469 | return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; | |
2470 | }, 0); | |
2471 | ||
2472 | if (length > 60) { | |
2473 | return braces[0] + | |
2474 | (base === '' ? '' : base + '\n ') + | |
2475 | ' ' + | |
2476 | output.join(',\n ') + | |
2477 | ' ' + | |
2478 | braces[1]; | |
2479 | } | |
2480 | ||
2481 | return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; | |
2482 | } | |
2483 | ||
2484 | ||
2485 | // NOTE: These type checking functions intentionally don't use `instanceof` | |
2486 | // because it is fragile and can be easily faked with `Object.create()`. | |
2487 | function isArray(ar) { | |
2488 | return Array.isArray(ar); | |
2489 | } | |
2490 | exports.isArray = isArray; | |
2491 | ||
2492 | function isBoolean(arg) { | |
2493 | return typeof arg === 'boolean'; | |
2494 | } | |
2495 | exports.isBoolean = isBoolean; | |
2496 | ||
2497 | function isNull(arg) { | |
2498 | return arg === null; | |
2499 | } | |
2500 | exports.isNull = isNull; | |
2501 | ||
2502 | function isNullOrUndefined(arg) { | |
2503 | return arg == null; | |
2504 | } | |
2505 | exports.isNullOrUndefined = isNullOrUndefined; | |
2506 | ||
2507 | function isNumber(arg) { | |
2508 | return typeof arg === 'number'; | |
2509 | } | |
2510 | exports.isNumber = isNumber; | |
2511 | ||
2512 | function isString(arg) { | |
2513 | return typeof arg === 'string'; | |
2514 | } | |
2515 | exports.isString = isString; | |
2516 | ||
2517 | function isSymbol(arg) { | |
2518 | return typeof arg === 'symbol'; | |
2519 | } | |
2520 | exports.isSymbol = isSymbol; | |
2521 | ||
2522 | function isUndefined(arg) { | |
2523 | return arg === void 0; | |
2524 | } | |
2525 | exports.isUndefined = isUndefined; | |
2526 | ||
2527 | function isRegExp(re) { | |
2528 | return isObject(re) && objectToString(re) === '[object RegExp]'; | |
2529 | } | |
2530 | exports.isRegExp = isRegExp; | |
2531 | ||
2532 | function isObject(arg) { | |
2533 | return typeof arg === 'object' && arg !== null; | |
2534 | } | |
2535 | exports.isObject = isObject; | |
2536 | ||
2537 | function isDate(d) { | |
2538 | return isObject(d) && objectToString(d) === '[object Date]'; | |
2539 | } | |
2540 | exports.isDate = isDate; | |
2541 | ||
2542 | function isError(e) { | |
2543 | return isObject(e) && | |
2544 | (objectToString(e) === '[object Error]' || e instanceof Error); | |
2545 | } | |
2546 | exports.isError = isError; | |
2547 | ||
2548 | function isFunction(arg) { | |
2549 | return typeof arg === 'function'; | |
2550 | } | |
2551 | exports.isFunction = isFunction; | |
2552 | ||
2553 | function isPrimitive(arg) { | |
2554 | return arg === null || | |
2555 | typeof arg === 'boolean' || | |
2556 | typeof arg === 'number' || | |
2557 | typeof arg === 'string' || | |
2558 | typeof arg === 'symbol' || // ES6 symbol | |
2559 | typeof arg === 'undefined'; | |
2560 | } | |
2561 | exports.isPrimitive = isPrimitive; | |
2562 | ||
2563 | exports.isBuffer = _dereq_('./support/isBuffer'); | |
2564 | ||
2565 | function objectToString(o) { | |
2566 | return Object.prototype.toString.call(o); | |
2567 | } | |
2568 | ||
2569 | ||
2570 | function pad(n) { | |
2571 | return n < 10 ? '0' + n.toString(10) : n.toString(10); | |
2572 | } | |
2573 | ||
2574 | ||
2575 | var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', | |
2576 | 'Oct', 'Nov', 'Dec']; | |
2577 | ||
2578 | // 26 Feb 16:19:34 | |
2579 | function timestamp() { | |
2580 | var d = new Date(); | |
2581 | var time = [pad(d.getHours()), | |
2582 | pad(d.getMinutes()), | |
2583 | pad(d.getSeconds())].join(':'); | |
2584 | return [d.getDate(), months[d.getMonth()], time].join(' '); | |
2585 | } | |
2586 | ||
2587 | ||
2588 | // log is just a thin wrapper to console.log that prepends a timestamp | |
2589 | exports.log = function() { | |
2590 | console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); | |
2591 | }; | |
2592 | ||
2593 | ||
2594 | /** | |
2595 | * Inherit the prototype methods from one constructor into another. | |
2596 | * | |
2597 | * The Function.prototype.inherits from lang.js rewritten as a standalone | |
2598 | * function (not on Function.prototype). NOTE: If this file is to be loaded | |
2599 | * during bootstrapping this function needs to be rewritten using some native | |
2600 | * functions as prototype setup using normal JavaScript does not work as | |
2601 | * expected during bootstrapping (see mirror.js in r114903). | |
2602 | * | |
2603 | * @param {function} ctor Constructor function which needs to inherit the | |
2604 | * prototype. | |
2605 | * @param {function} superCtor Constructor function to inherit prototype from. | |
2606 | */ | |
2607 | exports.inherits = _dereq_('inherits'); | |
2608 | ||
2609 | exports._extend = function(origin, add) { | |
2610 | // Don't do anything if add isn't an object | |
2611 | if (!add || !isObject(add)) return origin; | |
2612 | ||
2613 | var keys = Object.keys(add); | |
2614 | var i = keys.length; | |
2615 | while (i--) { | |
2616 | origin[keys[i]] = add[keys[i]]; | |
2617 | } | |
2618 | return origin; | |
2619 | }; | |
2620 | ||
2621 | function hasOwnProperty(obj, prop) { | |
2622 | return Object.prototype.hasOwnProperty.call(obj, prop); | |
2623 | } | |
2624 | ||
2625 | }).call(this,_dereq_("FWaASH"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | |
2626 | },{"./support/isBuffer":5,"FWaASH":12,"inherits":11}],7:[function(_dereq_,module,exports){ | |
2627 | ||
2628 | },{}],8:[function(_dereq_,module,exports){ | |
2629 | /*! | |
2630 | * The buffer module from node.js, for the browser. | |
2631 | * | |
2632 | * at author Feross Aboukhadijeh <feross@feross.org> <http://feross.org> | |
2633 | * at license MIT | |
2634 | */ | |
2635 | ||
2636 | var base64 = _dereq_('base64-js') | |
2637 | var ieee754 = _dereq_('ieee754') | |
2638 | ||
2639 | exports.Buffer = Buffer | |
2640 | exports.SlowBuffer = Buffer | |
2641 | exports.INSPECT_MAX_BYTES = 50 | |
2642 | Buffer.poolSize = 8192 | |
2643 | ||
2644 | /** | |
2645 | * If `Buffer._useTypedArrays`: | |
2646 | * === true Use Uint8Array implementation (fastest) | |
2647 | * === false Use Object implementation (compatible down to IE6) | |
2648 | */ | |
2649 | Buffer._useTypedArrays = (function () { | |
2650 | // Detect if browser supports Typed Arrays. Supported browsers are IE 10+, Firefox 4+, | |
2651 | // Chrome 7+, Safari 5.1+, Opera 11.6+, iOS 4.2+. If the browser does not support adding | |
2652 | // properties to `Uint8Array` instances, then that's the same as no `Uint8Array` support | |
2653 | // because we need to be able to add all the node Buffer API methods. This is an issue | |
2654 | // in Firefox 4-29. Now fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=695438 | |
2655 | try { | |
2656 | var buf = new ArrayBuffer(0) | |
2657 | var arr = new Uint8Array(buf) | |
2658 | arr.foo = function () { return 42 } | |
2659 | return 42 === arr.foo() && | |
2660 | typeof arr.subarray === 'function' // Chrome 9-10 lack `subarray` | |
2661 | } catch (e) { | |
2662 | return false | |
2663 | } | |
2664 | })() | |
2665 | ||
2666 | /** | |
2667 | * Class: Buffer | |
2668 | * ============= | |
2669 | * | |
2670 | * The Buffer constructor returns instances of `Uint8Array` that are augmented | |
2671 | * with function properties for all the node `Buffer` API functions. We use | |
2672 | * `Uint8Array` so that square bracket notation works as expected -- it returns | |
2673 | * a single octet. | |
2674 | * | |
2675 | * By augmenting the instances, we can avoid modifying the `Uint8Array` | |
2676 | * prototype. | |
2677 | */ | |
2678 | function Buffer (subject, encoding, noZero) { | |
2679 | if (!(this instanceof Buffer)) | |
2680 | return new Buffer(subject, encoding, noZero) | |
2681 | ||
2682 | var type = typeof subject | |
2683 | ||
2684 | if (encoding === 'base64' && type === 'string') { | |
2685 | subject = base64clean(subject) | |
2686 | } | |
2687 | ||
2688 | // Find the length | |
2689 | var length | |
2690 | if (type === 'number') | |
2691 | length = coerce(subject) | |
2692 | else if (type === 'string') | |
2693 | length = Buffer.byteLength(subject, encoding) | |
2694 | else if (type === 'object') | |
2695 | length = coerce(subject.length) // assume that object is array-like | |
2696 | else | |
2697 | throw new Error('First argument needs to be a number, array or string.') | |
2698 | ||
2699 | var buf | |
2700 | if (Buffer._useTypedArrays) { | |
2701 | // Preferred: Return an augmented `Uint8Array` instance for best performance | |
2702 | buf = Buffer._augment(new Uint8Array(length)) | |
2703 | } else { | |
2704 | // Fallback: Return THIS instance of Buffer (created by `new`) | |
2705 | buf = this | |
2706 | buf.length = length | |
2707 | buf._isBuffer = true | |
2708 | } | |
2709 | ||
2710 | var i | |
2711 | if (Buffer._useTypedArrays && typeof subject.byteLength === 'number') { | |
2712 | // Speed optimization -- use set if we're copying from a typed array | |
2713 | buf._set(subject) | |
2714 | } else if (isArrayish(subject)) { | |
2715 | // Treat array-ish objects as a byte array | |
2716 | if (Buffer.isBuffer(subject)) { | |
2717 | for (i = 0; i < length; i++) | |
2718 | buf[i] = subject.readUInt8(i) | |
2719 | } else { | |
2720 | for (i = 0; i < length; i++) | |
2721 | buf[i] = ((subject[i] % 256) + 256) % 256 | |
2722 | } | |
2723 | } else if (type === 'string') { | |
2724 | buf.write(subject, 0, encoding) | |
2725 | } else if (type === 'number' && !Buffer._useTypedArrays && !noZero) { | |
2726 | for (i = 0; i < length; i++) { | |
2727 | buf[i] = 0 | |
2728 | } | |
2729 | } | |
2730 | ||
2731 | return buf | |
2732 | } | |
2733 | ||
2734 | // STATIC METHODS | |
2735 | // ============== | |
2736 | ||
2737 | Buffer.isEncoding = function (encoding) { | |
2738 | switch (String(encoding).toLowerCase()) { | |
2739 | case 'hex': | |
2740 | case 'utf8': | |
2741 | case 'utf-8': | |
2742 | case 'ascii': | |
2743 | case 'binary': | |
2744 | case 'base64': | |
2745 | case 'raw': | |
2746 | case 'ucs2': | |
2747 | case 'ucs-2': | |
2748 | case 'utf16le': | |
2749 | case 'utf-16le': | |
2750 | return true | |
2751 | default: | |
2752 | return false | |
2753 | } | |
2754 | } | |
2755 | ||
2756 | Buffer.isBuffer = function (b) { | |
2757 | return !!(b !== null && b !== undefined && b._isBuffer) | |
2758 | } | |
2759 | ||
2760 | Buffer.byteLength = function (str, encoding) { | |
2761 | var ret | |
2762 | str = str.toString() | |
2763 | switch (encoding || 'utf8') { | |
2764 | case 'hex': | |
2765 | ret = str.length / 2 | |
2766 | break | |
2767 | case 'utf8': | |
2768 | case 'utf-8': | |
2769 | ret = utf8ToBytes(str).length | |
2770 | break | |
2771 | case 'ascii': | |
2772 | case 'binary': | |
2773 | case 'raw': | |
2774 | ret = str.length | |
2775 | break | |
2776 | case 'base64': | |
2777 | ret = base64ToBytes(str).length | |
2778 | break | |
2779 | case 'ucs2': | |
2780 | case 'ucs-2': | |
2781 | case 'utf16le': | |
2782 | case 'utf-16le': | |
2783 | ret = str.length * 2 | |
2784 | break | |
2785 | default: | |
2786 | throw new Error('Unknown encoding') | |
2787 | } | |
2788 | return ret | |
2789 | } | |
2790 | ||
2791 | Buffer.concat = function (list, totalLength) { | |
2792 | assert(isArray(list), 'Usage: Buffer.concat(list[, length])') | |
2793 | ||
2794 | if (list.length === 0) { | |
2795 | return new Buffer(0) | |
2796 | } else if (list.length === 1) { | |
2797 | return list[0] | |
2798 | } | |
2799 | ||
2800 | var i | |
2801 | if (totalLength === undefined) { | |
2802 | totalLength = 0 | |
2803 | for (i = 0; i < list.length; i++) { | |
2804 | totalLength += list[i].length | |
2805 | } | |
2806 | } | |
2807 | ||
2808 | var buf = new Buffer(totalLength) | |
2809 | var pos = 0 | |
2810 | for (i = 0; i < list.length; i++) { | |
2811 | var item = list[i] | |
2812 | item.copy(buf, pos) | |
2813 | pos += item.length | |
2814 | } | |
2815 | return buf | |
2816 | } | |
2817 | ||
2818 | Buffer.compare = function (a, b) { | |
2819 | assert(Buffer.isBuffer(a) && Buffer.isBuffer(b), 'Arguments must be Buffers') | |
2820 | var x = a.length | |
2821 | var y = b.length | |
2822 | for (var i = 0, len = Math.min(x, y); i < len && a[i] === b[i]; i++) {} | |
2823 | if (i !== len) { | |
2824 | x = a[i] | |
2825 | y = b[i] | |
2826 | } | |
2827 | if (x < y) { | |
2828 | return -1 | |
2829 | } | |
2830 | if (y < x) { | |
2831 | return 1 | |
2832 | } | |
2833 | return 0 | |
2834 | } | |
2835 | ||
2836 | // BUFFER INSTANCE METHODS | |
2837 | // ======================= | |
2838 | ||
2839 | function hexWrite (buf, string, offset, length) { | |
2840 | offset = Number(offset) || 0 | |
2841 | var remaining = buf.length - offset | |
2842 | if (!length) { | |
2843 | length = remaining | |
2844 | } else { | |
2845 | length = Number(length) | |
2846 | if (length > remaining) { | |
2847 | length = remaining | |
2848 | } | |
2849 | } | |
2850 | ||
2851 | // must be an even number of digits | |
2852 | var strLen = string.length | |
2853 | assert(strLen % 2 === 0, 'Invalid hex string') | |
2854 | ||
2855 | if (length > strLen / 2) { | |
2856 | length = strLen / 2 | |
2857 | } | |
2858 | for (var i = 0; i < length; i++) { | |
2859 | var byte = parseInt(string.substr(i * 2, 2), 16) | |
2860 | assert(!isNaN(byte), 'Invalid hex string') | |
2861 | buf[offset + i] = byte | |
2862 | } | |
2863 | return i | |
2864 | } | |
2865 | ||
2866 | function utf8Write (buf, string, offset, length) { | |
2867 | var charsWritten = blitBuffer(utf8ToBytes(string), buf, offset, length) | |
2868 | return charsWritten | |
2869 | } | |
2870 | ||
2871 | function asciiWrite (buf, string, offset, length) { | |
2872 | var charsWritten = blitBuffer(asciiToBytes(string), buf, offset, length) | |
2873 | return charsWritten | |
2874 | } | |
2875 | ||
2876 | function binaryWrite (buf, string, offset, length) { | |
2877 | return asciiWrite(buf, string, offset, length) | |
2878 | } | |
2879 | ||
2880 | function base64Write (buf, string, offset, length) { | |
2881 | var charsWritten = blitBuffer(base64ToBytes(string), buf, offset, length) | |
2882 | return charsWritten | |
2883 | } | |
2884 | ||
2885 | function utf16leWrite (buf, string, offset, length) { | |
2886 | var charsWritten = blitBuffer(utf16leToBytes(string), buf, offset, length) | |
2887 | return charsWritten | |
2888 | } | |
2889 | ||
2890 | Buffer.prototype.write = function (string, offset, length, encoding) { | |
2891 | // Support both (string, offset, length, encoding) | |
2892 | // and the legacy (string, encoding, offset, length) | |
2893 | if (isFinite(offset)) { | |
2894 | if (!isFinite(length)) { | |
2895 | encoding = length | |
2896 | length = undefined | |
2897 | } | |
2898 | } else { // legacy | |
2899 | var swap = encoding | |
2900 | encoding = offset | |
2901 | offset = length | |
2902 | length = swap | |
2903 | } | |
2904 | ||
2905 | offset = Number(offset) || 0 | |
2906 | var remaining = this.length - offset | |
2907 | if (!length) { | |
2908 | length = remaining | |
2909 | } else { | |
2910 | length = Number(length) | |
2911 | if (length > remaining) { | |
2912 | length = remaining | |
2913 | } | |
2914 | } | |
2915 | encoding = String(encoding || 'utf8').toLowerCase() | |
2916 | ||
2917 | var ret | |
2918 | switch (encoding) { | |
2919 | case 'hex': | |
2920 | ret = hexWrite(this, string, offset, length) | |
2921 | break | |
2922 | case 'utf8': | |
2923 | case 'utf-8': | |
2924 | ret = utf8Write(this, string, offset, length) | |
2925 | break | |
2926 | case 'ascii': | |
2927 | ret = asciiWrite(this, string, offset, length) | |
2928 | break | |
2929 | case 'binary': | |
2930 | ret = binaryWrite(this, string, offset, length) | |
2931 | break | |
2932 | case 'base64': | |
2933 | ret = base64Write(this, string, offset, length) | |
2934 | break | |
2935 | case 'ucs2': | |
2936 | case 'ucs-2': | |
2937 | case 'utf16le': | |
2938 | case 'utf-16le': | |
2939 | ret = utf16leWrite(this, string, offset, length) | |
2940 | break | |
2941 | default: | |
2942 | throw new Error('Unknown encoding') | |
2943 | } | |
2944 | return ret | |
2945 | } | |
2946 | ||
2947 | Buffer.prototype.toString = function (encoding, start, end) { | |
2948 | var self = this | |
2949 | ||
2950 | encoding = String(encoding || 'utf8').toLowerCase() | |
2951 | start = Number(start) || 0 | |
2952 | end = (end === undefined) ? self.length : Number(end) | |
2953 | ||
2954 | // Fastpath empty strings | |
2955 | if (end === start) | |
2956 | return '' | |
2957 | ||
2958 | var ret | |
2959 | switch (encoding) { | |
2960 | case 'hex': | |
2961 | ret = hexSlice(self, start, end) | |
2962 | break | |
2963 | case 'utf8': | |
2964 | case 'utf-8': | |
2965 | ret = utf8Slice(self, start, end) | |
2966 | break | |
2967 | case 'ascii': | |
2968 | ret = asciiSlice(self, start, end) | |
2969 | break | |
2970 | case 'binary': | |
2971 | ret = binarySlice(self, start, end) | |
2972 | break | |
2973 | case 'base64': | |
2974 | ret = base64Slice(self, start, end) | |
2975 | break | |
2976 | case 'ucs2': | |
2977 | case 'ucs-2': | |
2978 | case 'utf16le': | |
2979 | case 'utf-16le': | |
2980 | ret = utf16leSlice(self, start, end) | |
2981 | break | |
2982 | default: | |
2983 | throw new Error('Unknown encoding') | |
2984 | } | |
2985 | return ret | |
2986 | } | |
2987 | ||
2988 | Buffer.prototype.toJSON = function () { | |
2989 | return { | |
2990 | type: 'Buffer', | |
2991 | data: Array.prototype.slice.call(this._arr || this, 0) | |
2992 | } | |
2993 | } | |
2994 | ||
2995 | Buffer.prototype.equals = function (b) { | |
2996 | assert(Buffer.isBuffer(b), 'Argument must be a Buffer') | |
2997 | return Buffer.compare(this, b) === 0 | |
2998 | } | |
2999 | ||
3000 | Buffer.prototype.compare = function (b) { | |
3001 | assert(Buffer.isBuffer(b), 'Argument must be a Buffer') | |
3002 | return Buffer.compare(this, b) | |
3003 | } | |
3004 | ||
3005 | // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) | |
3006 | Buffer.prototype.copy = function (target, target_start, start, end) { | |
3007 | var source = this | |
3008 | ||
3009 | if (!start) start = 0 | |
3010 | if (!end && end !== 0) end = this.length | |
3011 | if (!target_start) target_start = 0 | |
3012 | ||
3013 | // Copy 0 bytes; we're done | |
3014 | if (end === start) return | |
3015 | if (target.length === 0 || source.length === 0) return | |
3016 | ||
3017 | // Fatal error conditions | |
3018 | assert(end >= start, 'sourceEnd < sourceStart') | |
3019 | assert(target_start >= 0 && target_start < target.length, | |
3020 | 'targetStart out of bounds') | |
3021 | assert(start >= 0 && start < source.length, 'sourceStart out of bounds') | |
3022 | assert(end >= 0 && end <= source.length, 'sourceEnd out of bounds') | |
3023 | ||
3024 | // Are we oob? | |
3025 | if (end > this.length) | |
3026 | end = this.length | |
3027 | if (target.length - target_start < end - start) | |
3028 | end = target.length - target_start + start | |
3029 | ||
3030 | var len = end - start | |
3031 | ||
3032 | if (len < 100 || !Buffer._useTypedArrays) { | |
3033 | for (var i = 0; i < len; i++) { | |
3034 | target[i + target_start] = this[i + start] | |
3035 | } | |
3036 | } else { | |
3037 | target._set(this.subarray(start, start + len), target_start) | |
3038 | } | |
3039 | } | |
3040 | ||
3041 | function base64Slice (buf, start, end) { | |
3042 | if (start === 0 && end === buf.length) { | |
3043 | return base64.fromByteArray(buf) | |
3044 | } else { | |
3045 | return base64.fromByteArray(buf.slice(start, end)) | |
3046 | } | |
3047 | } | |
3048 | ||
3049 | function utf8Slice (buf, start, end) { | |
3050 | var res = '' | |
3051 | var tmp = '' | |
3052 | end = Math.min(buf.length, end) | |
3053 | ||
3054 | for (var i = start; i < end; i++) { | |
3055 | if (buf[i] <= 0x7F) { | |
3056 | res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i]) | |
3057 | tmp = '' | |
3058 | } else { | |
3059 | tmp += '%' + buf[i].toString(16) | |
3060 | } | |
3061 | } | |
3062 | ||
3063 | return res + decodeUtf8Char(tmp) | |
3064 | } | |
3065 | ||
3066 | function asciiSlice (buf, start, end) { | |
3067 | var ret = '' | |
3068 | end = Math.min(buf.length, end) | |
3069 | ||
3070 | for (var i = start; i < end; i++) { | |
3071 | ret += String.fromCharCode(buf[i]) | |
3072 | } | |
3073 | return ret | |
3074 | } | |
3075 | ||
3076 | function binarySlice (buf, start, end) { | |
3077 | return asciiSlice(buf, start, end) | |
3078 | } | |
3079 | ||
3080 | function hexSlice (buf, start, end) { | |
3081 | var len = buf.length | |
3082 | ||
3083 | if (!start || start < 0) start = 0 | |
3084 | if (!end || end < 0 || end > len) end = len | |
3085 | ||
3086 | var out = '' | |
3087 | for (var i = start; i < end; i++) { | |
3088 | out += toHex(buf[i]) | |
3089 | } | |
3090 | return out | |
3091 | } | |
3092 | ||
3093 | function utf16leSlice (buf, start, end) { | |
3094 | var bytes = buf.slice(start, end) | |
3095 | var res = '' | |
3096 | for (var i = 0; i < bytes.length; i += 2) { | |
3097 | res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) | |
3098 | } | |
3099 | return res | |
3100 | } | |
3101 | ||
3102 | Buffer.prototype.slice = function (start, end) { | |
3103 | var len = this.length | |
3104 | start = clamp(start, len, 0) | |
3105 | end = clamp(end, len, len) | |
3106 | ||
3107 | if (Buffer._useTypedArrays) { | |
3108 | return Buffer._augment(this.subarray(start, end)) | |
3109 | } else { | |
3110 | var sliceLen = end - start | |
3111 | var newBuf = new Buffer(sliceLen, undefined, true) | |
3112 | for (var i = 0; i < sliceLen; i++) { | |
3113 | newBuf[i] = this[i + start] | |
3114 | } | |
3115 | return newBuf | |
3116 | } | |
3117 | } | |
3118 | ||
3119 | // `get` will be removed in Node 0.13+ | |
3120 | Buffer.prototype.get = function (offset) { | |
3121 | console.log('.get() is deprecated. Access using array indexes instead.') | |
3122 | return this.readUInt8(offset) | |
3123 | } | |
3124 | ||
3125 | // `set` will be removed in Node 0.13+ | |
3126 | Buffer.prototype.set = function (v, offset) { | |
3127 | console.log('.set() is deprecated. Access using array indexes instead.') | |
3128 | return this.writeUInt8(v, offset) | |
3129 | } | |
3130 | ||
3131 | Buffer.prototype.readUInt8 = function (offset, noAssert) { | |
3132 | if (!noAssert) { | |
3133 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3134 | assert(offset < this.length, 'Trying to read beyond buffer length') | |
3135 | } | |
3136 | ||
3137 | if (offset >= this.length) | |
3138 | return | |
3139 | ||
3140 | return this[offset] | |
3141 | } | |
3142 | ||
3143 | function readUInt16 (buf, offset, littleEndian, noAssert) { | |
3144 | if (!noAssert) { | |
3145 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3146 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3147 | assert(offset + 1 < buf.length, 'Trying to read beyond buffer length') | |
3148 | } | |
3149 | ||
3150 | var len = buf.length | |
3151 | if (offset >= len) | |
3152 | return | |
3153 | ||
3154 | var val | |
3155 | if (littleEndian) { | |
3156 | val = buf[offset] | |
3157 | if (offset + 1 < len) | |
3158 | val |= buf[offset + 1] << 8 | |
3159 | } else { | |
3160 | val = buf[offset] << 8 | |
3161 | if (offset + 1 < len) | |
3162 | val |= buf[offset + 1] | |
3163 | } | |
3164 | return val | |
3165 | } | |
3166 | ||
3167 | Buffer.prototype.readUInt16LE = function (offset, noAssert) { | |
3168 | return readUInt16(this, offset, true, noAssert) | |
3169 | } | |
3170 | ||
3171 | Buffer.prototype.readUInt16BE = function (offset, noAssert) { | |
3172 | return readUInt16(this, offset, false, noAssert) | |
3173 | } | |
3174 | ||
3175 | function readUInt32 (buf, offset, littleEndian, noAssert) { | |
3176 | if (!noAssert) { | |
3177 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3178 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3179 | assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') | |
3180 | } | |
3181 | ||
3182 | var len = buf.length | |
3183 | if (offset >= len) | |
3184 | return | |
3185 | ||
3186 | var val | |
3187 | if (littleEndian) { | |
3188 | if (offset + 2 < len) | |
3189 | val = buf[offset + 2] << 16 | |
3190 | if (offset + 1 < len) | |
3191 | val |= buf[offset + 1] << 8 | |
3192 | val |= buf[offset] | |
3193 | if (offset + 3 < len) | |
3194 | val = val + (buf[offset + 3] << 24 >>> 0) | |
3195 | } else { | |
3196 | if (offset + 1 < len) | |
3197 | val = buf[offset + 1] << 16 | |
3198 | if (offset + 2 < len) | |
3199 | val |= buf[offset + 2] << 8 | |
3200 | if (offset + 3 < len) | |
3201 | val |= buf[offset + 3] | |
3202 | val = val + (buf[offset] << 24 >>> 0) | |
3203 | } | |
3204 | return val | |
3205 | } | |
3206 | ||
3207 | Buffer.prototype.readUInt32LE = function (offset, noAssert) { | |
3208 | return readUInt32(this, offset, true, noAssert) | |
3209 | } | |
3210 | ||
3211 | Buffer.prototype.readUInt32BE = function (offset, noAssert) { | |
3212 | return readUInt32(this, offset, false, noAssert) | |
3213 | } | |
3214 | ||
3215 | Buffer.prototype.readInt8 = function (offset, noAssert) { | |
3216 | if (!noAssert) { | |
3217 | assert(offset !== undefined && offset !== null, | |
3218 | 'missing offset') | |
3219 | assert(offset < this.length, 'Trying to read beyond buffer length') | |
3220 | } | |
3221 | ||
3222 | if (offset >= this.length) | |
3223 | return | |
3224 | ||
3225 | var neg = this[offset] & 0x80 | |
3226 | if (neg) | |
3227 | return (0xff - this[offset] + 1) * -1 | |
3228 | else | |
3229 | return this[offset] | |
3230 | } | |
3231 | ||
3232 | function readInt16 (buf, offset, littleEndian, noAssert) { | |
3233 | if (!noAssert) { | |
3234 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3235 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3236 | assert(offset + 1 < buf.length, 'Trying to read beyond buffer length') | |
3237 | } | |
3238 | ||
3239 | var len = buf.length | |
3240 | if (offset >= len) | |
3241 | return | |
3242 | ||
3243 | var val = readUInt16(buf, offset, littleEndian, true) | |
3244 | var neg = val & 0x8000 | |
3245 | if (neg) | |
3246 | return (0xffff - val + 1) * -1 | |
3247 | else | |
3248 | return val | |
3249 | } | |
3250 | ||
3251 | Buffer.prototype.readInt16LE = function (offset, noAssert) { | |
3252 | return readInt16(this, offset, true, noAssert) | |
3253 | } | |
3254 | ||
3255 | Buffer.prototype.readInt16BE = function (offset, noAssert) { | |
3256 | return readInt16(this, offset, false, noAssert) | |
3257 | } | |
3258 | ||
3259 | function readInt32 (buf, offset, littleEndian, noAssert) { | |
3260 | if (!noAssert) { | |
3261 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3262 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3263 | assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') | |
3264 | } | |
3265 | ||
3266 | var len = buf.length | |
3267 | if (offset >= len) | |
3268 | return | |
3269 | ||
3270 | var val = readUInt32(buf, offset, littleEndian, true) | |
3271 | var neg = val & 0x80000000 | |
3272 | if (neg) | |
3273 | return (0xffffffff - val + 1) * -1 | |
3274 | else | |
3275 | return val | |
3276 | } | |
3277 | ||
3278 | Buffer.prototype.readInt32LE = function (offset, noAssert) { | |
3279 | return readInt32(this, offset, true, noAssert) | |
3280 | } | |
3281 | ||
3282 | Buffer.prototype.readInt32BE = function (offset, noAssert) { | |
3283 | return readInt32(this, offset, false, noAssert) | |
3284 | } | |
3285 | ||
3286 | function readFloat (buf, offset, littleEndian, noAssert) { | |
3287 | if (!noAssert) { | |
3288 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3289 | assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') | |
3290 | } | |
3291 | ||
3292 | return ieee754.read(buf, offset, littleEndian, 23, 4) | |
3293 | } | |
3294 | ||
3295 | Buffer.prototype.readFloatLE = function (offset, noAssert) { | |
3296 | return readFloat(this, offset, true, noAssert) | |
3297 | } | |
3298 | ||
3299 | Buffer.prototype.readFloatBE = function (offset, noAssert) { | |
3300 | return readFloat(this, offset, false, noAssert) | |
3301 | } | |
3302 | ||
3303 | function readDouble (buf, offset, littleEndian, noAssert) { | |
3304 | if (!noAssert) { | |
3305 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3306 | assert(offset + 7 < buf.length, 'Trying to read beyond buffer length') | |
3307 | } | |
3308 | ||
3309 | return ieee754.read(buf, offset, littleEndian, 52, 8) | |
3310 | } | |
3311 | ||
3312 | Buffer.prototype.readDoubleLE = function (offset, noAssert) { | |
3313 | return readDouble(this, offset, true, noAssert) | |
3314 | } | |
3315 | ||
3316 | Buffer.prototype.readDoubleBE = function (offset, noAssert) { | |
3317 | return readDouble(this, offset, false, noAssert) | |
3318 | } | |
3319 | ||
3320 | Buffer.prototype.writeUInt8 = function (value, offset, noAssert) { | |
3321 | if (!noAssert) { | |
3322 | assert(value !== undefined && value !== null, 'missing value') | |
3323 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3324 | assert(offset < this.length, 'trying to write beyond buffer length') | |
3325 | verifuint(value, 0xff) | |
3326 | } | |
3327 | ||
3328 | if (offset >= this.length) return | |
3329 | ||
3330 | this[offset] = value | |
3331 | return offset + 1 | |
3332 | } | |
3333 | ||
3334 | function writeUInt16 (buf, value, offset, littleEndian, noAssert) { | |
3335 | if (!noAssert) { | |
3336 | assert(value !== undefined && value !== null, 'missing value') | |
3337 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3338 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3339 | assert(offset + 1 < buf.length, 'trying to write beyond buffer length') | |
3340 | verifuint(value, 0xffff) | |
3341 | } | |
3342 | ||
3343 | var len = buf.length | |
3344 | if (offset >= len) | |
3345 | return | |
3346 | ||
3347 | for (var i = 0, j = Math.min(len - offset, 2); i < j; i++) { | |
3348 | buf[offset + i] = | |
3349 | (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> | |
3350 | (littleEndian ? i : 1 - i) * 8 | |
3351 | } | |
3352 | return offset + 2 | |
3353 | } | |
3354 | ||
3355 | Buffer.prototype.writeUInt16LE = function (value, offset, noAssert) { | |
3356 | return writeUInt16(this, value, offset, true, noAssert) | |
3357 | } | |
3358 | ||
3359 | Buffer.prototype.writeUInt16BE = function (value, offset, noAssert) { | |
3360 | return writeUInt16(this, value, offset, false, noAssert) | |
3361 | } | |
3362 | ||
3363 | function writeUInt32 (buf, value, offset, littleEndian, noAssert) { | |
3364 | if (!noAssert) { | |
3365 | assert(value !== undefined && value !== null, 'missing value') | |
3366 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3367 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3368 | assert(offset + 3 < buf.length, 'trying to write beyond buffer length') | |
3369 | verifuint(value, 0xffffffff) | |
3370 | } | |
3371 | ||
3372 | var len = buf.length | |
3373 | if (offset >= len) | |
3374 | return | |
3375 | ||
3376 | for (var i = 0, j = Math.min(len - offset, 4); i < j; i++) { | |
3377 | buf[offset + i] = | |
3378 | (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff | |
3379 | } | |
3380 | return offset + 4 | |
3381 | } | |
3382 | ||
3383 | Buffer.prototype.writeUInt32LE = function (value, offset, noAssert) { | |
3384 | return writeUInt32(this, value, offset, true, noAssert) | |
3385 | } | |
3386 | ||
3387 | Buffer.prototype.writeUInt32BE = function (value, offset, noAssert) { | |
3388 | return writeUInt32(this, value, offset, false, noAssert) | |
3389 | } | |
3390 | ||
3391 | Buffer.prototype.writeInt8 = function (value, offset, noAssert) { | |
3392 | if (!noAssert) { | |
3393 | assert(value !== undefined && value !== null, 'missing value') | |
3394 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3395 | assert(offset < this.length, 'Trying to write beyond buffer length') | |
3396 | verifsint(value, 0x7f, -0x80) | |
3397 | } | |
3398 | ||
3399 | if (offset >= this.length) | |
3400 | return | |
3401 | ||
3402 | if (value >= 0) | |
3403 | this.writeUInt8(value, offset, noAssert) | |
3404 | else | |
3405 | this.writeUInt8(0xff + value + 1, offset, noAssert) | |
3406 | return offset + 1 | |
3407 | } | |
3408 | ||
3409 | function writeInt16 (buf, value, offset, littleEndian, noAssert) { | |
3410 | if (!noAssert) { | |
3411 | assert(value !== undefined && value !== null, 'missing value') | |
3412 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3413 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3414 | assert(offset + 1 < buf.length, 'Trying to write beyond buffer length') | |
3415 | verifsint(value, 0x7fff, -0x8000) | |
3416 | } | |
3417 | ||
3418 | var len = buf.length | |
3419 | if (offset >= len) | |
3420 | return | |
3421 | ||
3422 | if (value >= 0) | |
3423 | writeUInt16(buf, value, offset, littleEndian, noAssert) | |
3424 | else | |
3425 | writeUInt16(buf, 0xffff + value + 1, offset, littleEndian, noAssert) | |
3426 | return offset + 2 | |
3427 | } | |
3428 | ||
3429 | Buffer.prototype.writeInt16LE = function (value, offset, noAssert) { | |
3430 | return writeInt16(this, value, offset, true, noAssert) | |
3431 | } | |
3432 | ||
3433 | Buffer.prototype.writeInt16BE = function (value, offset, noAssert) { | |
3434 | return writeInt16(this, value, offset, false, noAssert) | |
3435 | } | |
3436 | ||
3437 | function writeInt32 (buf, value, offset, littleEndian, noAssert) { | |
3438 | if (!noAssert) { | |
3439 | assert(value !== undefined && value !== null, 'missing value') | |
3440 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3441 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3442 | assert(offset + 3 < buf.length, 'Trying to write beyond buffer length') | |
3443 | verifsint(value, 0x7fffffff, -0x80000000) | |
3444 | } | |
3445 | ||
3446 | var len = buf.length | |
3447 | if (offset >= len) | |
3448 | return | |
3449 | ||
3450 | if (value >= 0) | |
3451 | writeUInt32(buf, value, offset, littleEndian, noAssert) | |
3452 | else | |
3453 | writeUInt32(buf, 0xffffffff + value + 1, offset, littleEndian, noAssert) | |
3454 | return offset + 4 | |
3455 | } | |
3456 | ||
3457 | Buffer.prototype.writeInt32LE = function (value, offset, noAssert) { | |
3458 | return writeInt32(this, value, offset, true, noAssert) | |
3459 | } | |
3460 | ||
3461 | Buffer.prototype.writeInt32BE = function (value, offset, noAssert) { | |
3462 | return writeInt32(this, value, offset, false, noAssert) | |
3463 | } | |
3464 | ||
3465 | function writeFloat (buf, value, offset, littleEndian, noAssert) { | |
3466 | if (!noAssert) { | |
3467 | assert(value !== undefined && value !== null, 'missing value') | |
3468 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3469 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3470 | assert(offset + 3 < buf.length, 'Trying to write beyond buffer length') | |
3471 | verifIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38) | |
3472 | } | |
3473 | ||
3474 | var len = buf.length | |
3475 | if (offset >= len) | |
3476 | return | |
3477 | ||
3478 | ieee754.write(buf, value, offset, littleEndian, 23, 4) | |
3479 | return offset + 4 | |
3480 | } | |
3481 | ||
3482 | Buffer.prototype.writeFloatLE = function (value, offset, noAssert) { | |
3483 | return writeFloat(this, value, offset, true, noAssert) | |
3484 | } | |
3485 | ||
3486 | Buffer.prototype.writeFloatBE = function (value, offset, noAssert) { | |
3487 | return writeFloat(this, value, offset, false, noAssert) | |
3488 | } | |
3489 | ||
3490 | function writeDouble (buf, value, offset, littleEndian, noAssert) { | |
3491 | if (!noAssert) { | |
3492 | assert(value !== undefined && value !== null, 'missing value') | |
3493 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
3494 | assert(offset !== undefined && offset !== null, 'missing offset') | |
3495 | assert(offset + 7 < buf.length, | |
3496 | 'Trying to write beyond buffer length') | |
3497 | verifIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308) | |
3498 | } | |
3499 | ||
3500 | var len = buf.length | |
3501 | if (offset >= len) | |
3502 | return | |
3503 | ||
3504 | ieee754.write(buf, value, offset, littleEndian, 52, 8) | |
3505 | return offset + 8 | |
3506 | } | |
3507 | ||
3508 | Buffer.prototype.writeDoubleLE = function (value, offset, noAssert) { | |
3509 | return writeDouble(this, value, offset, true, noAssert) | |
3510 | } | |
3511 | ||
3512 | Buffer.prototype.writeDoubleBE = function (value, offset, noAssert) { | |
3513 | return writeDouble(this, value, offset, false, noAssert) | |
3514 | } | |
3515 | ||
3516 | // fill(value, start=0, end=buffer.length) | |
3517 | Buffer.prototype.fill = function (value, start, end) { | |
3518 | if (!value) value = 0 | |
3519 | if (!start) start = 0 | |
3520 | if (!end) end = this.length | |
3521 | ||
3522 | assert(end >= start, 'end < start') | |
3523 | ||
3524 | // Fill 0 bytes; we're done | |
3525 | if (end === start) return | |
3526 | if (this.length === 0) return | |
3527 | ||
3528 | assert(start >= 0 && start < this.length, 'start out of bounds') | |
3529 | assert(end >= 0 && end <= this.length, 'end out of bounds') | |
3530 | ||
3531 | var i | |
3532 | if (typeof value === 'number') { | |
3533 | for (i = start; i < end; i++) { | |
3534 | this[i] = value | |
3535 | } | |
3536 | } else { | |
3537 | var bytes = utf8ToBytes(value.toString()) | |
3538 | var len = bytes.length | |
3539 | for (i = start; i < end; i++) { | |
3540 | this[i] = bytes[i % len] | |
3541 | } | |
3542 | } | |
3543 | ||
3544 | return this | |
3545 | } | |
3546 | ||
3547 | Buffer.prototype.inspect = function () { | |
3548 | var out = [] | |
3549 | var len = this.length | |
3550 | for (var i = 0; i < len; i++) { | |
3551 | out[i] = toHex(this[i]) | |
3552 | if (i === exports.INSPECT_MAX_BYTES) { | |
3553 | out[i + 1] = '...' | |
3554 | break | |
3555 | } | |
3556 | } | |
3557 | return '<Buffer ' + out.join(' ') + '>' | |
3558 | } | |
3559 | ||
3560 | /** | |
3561 | * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance. | |
3562 | * Added in Node 0.12. Only available in browsers that support ArrayBuffer. | |
3563 | */ | |
3564 | Buffer.prototype.toArrayBuffer = function () { | |
3565 | if (typeof Uint8Array !== 'undefined') { | |
3566 | if (Buffer._useTypedArrays) { | |
3567 | return (new Buffer(this)).buffer | |
3568 | } else { | |
3569 | var buf = new Uint8Array(this.length) | |
3570 | for (var i = 0, len = buf.length; i < len; i += 1) { | |
3571 | buf[i] = this[i] | |
3572 | } | |
3573 | return buf.buffer | |
3574 | } | |
3575 | } else { | |
3576 | throw new Error('Buffer.toArrayBuffer not supported in this browser') | |
3577 | } | |
3578 | } | |
3579 | ||
3580 | // HELPER FUNCTIONS | |
3581 | // ================ | |
3582 | ||
3583 | var BP = Buffer.prototype | |
3584 | ||
3585 | /** | |
3586 | * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods | |
3587 | */ | |
3588 | Buffer._augment = function (arr) { | |
3589 | arr._isBuffer = true | |
3590 | ||
3591 | // save reference to original Uint8Array get/set methods before overwriting | |
3592 | arr._get = arr.get | |
3593 | arr._set = arr.set | |
3594 | ||
3595 | // deprecated, will be removed in node 0.13+ | |
3596 | arr.get = BP.get | |
3597 | arr.set = BP.set | |
3598 | ||
3599 | arr.write = BP.write | |
3600 | arr.toString = BP.toString | |
3601 | arr.toLocaleString = BP.toString | |
3602 | arr.toJSON = BP.toJSON | |
3603 | arr.equals = BP.equals | |
3604 | arr.compare = BP.compare | |
3605 | arr.copy = BP.copy | |
3606 | arr.slice = BP.slice | |
3607 | arr.readUInt8 = BP.readUInt8 | |
3608 | arr.readUInt16LE = BP.readUInt16LE | |
3609 | arr.readUInt16BE = BP.readUInt16BE | |
3610 | arr.readUInt32LE = BP.readUInt32LE | |
3611 | arr.readUInt32BE = BP.readUInt32BE | |
3612 | arr.readInt8 = BP.readInt8 | |
3613 | arr.readInt16LE = BP.readInt16LE | |
3614 | arr.readInt16BE = BP.readInt16BE | |
3615 | arr.readInt32LE = BP.readInt32LE | |
3616 | arr.readInt32BE = BP.readInt32BE | |
3617 | arr.readFloatLE = BP.readFloatLE | |
3618 | arr.readFloatBE = BP.readFloatBE | |
3619 | arr.readDoubleLE = BP.readDoubleLE | |
3620 | arr.readDoubleBE = BP.readDoubleBE | |
3621 | arr.writeUInt8 = BP.writeUInt8 | |
3622 | arr.writeUInt16LE = BP.writeUInt16LE | |
3623 | arr.writeUInt16BE = BP.writeUInt16BE | |
3624 | arr.writeUInt32LE = BP.writeUInt32LE | |
3625 | arr.writeUInt32BE = BP.writeUInt32BE | |
3626 | arr.writeInt8 = BP.writeInt8 | |
3627 | arr.writeInt16LE = BP.writeInt16LE | |
3628 | arr.writeInt16BE = BP.writeInt16BE | |
3629 | arr.writeInt32LE = BP.writeInt32LE | |
3630 | arr.writeInt32BE = BP.writeInt32BE | |
3631 | arr.writeFloatLE = BP.writeFloatLE | |
3632 | arr.writeFloatBE = BP.writeFloatBE | |
3633 | arr.writeDoubleLE = BP.writeDoubleLE | |
3634 | arr.writeDoubleBE = BP.writeDoubleBE | |
3635 | arr.fill = BP.fill | |
3636 | arr.inspect = BP.inspect | |
3637 | arr.toArrayBuffer = BP.toArrayBuffer | |
3638 | ||
3639 | return arr | |
3640 | } | |
3641 | ||
3642 | var INVALID_BASE64_RE = /[^+\/0-9A-z]/g | |
3643 | ||
3644 | function base64clean (str) { | |
3645 | // Node strips out invalid characters like \n and \t from the string, base64-js does not | |
3646 | str = stringtrim(str).replace(INVALID_BASE64_RE, '') | |
3647 | // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not | |
3648 | while (str.length % 4 !== 0) { | |
3649 | str = str + '=' | |
3650 | } | |
3651 | return str | |
3652 | } | |
3653 | ||
3654 | function stringtrim (str) { | |
3655 | if (str.trim) return str.trim() | |
3656 | return str.replace(/^\s+|\s+$/g, '') | |
3657 | } | |
3658 | ||
3659 | // slice(start, end) | |
3660 | function clamp (index, len, defaultValue) { | |
3661 | if (typeof index !== 'number') return defaultValue | |
3662 | index = ~~index; // Coerce to integer. | |
3663 | if (index >= len) return len | |
3664 | if (index >= 0) return index | |
3665 | index += len | |
3666 | if (index >= 0) return index | |
3667 | return 0 | |
3668 | } | |
3669 | ||
3670 | function coerce (length) { | |
3671 | // Coerce length to a number (possibly NaN), round up | |
3672 | // in case it's fractional (e.g. 123.456) then do a | |
3673 | // double negate to coerce a NaN to 0. Easy, right? | |
3674 | length = ~~Math.ceil(+length) | |
3675 | return length < 0 ? 0 : length | |
3676 | } | |
3677 | ||
3678 | function isArray (subject) { | |
3679 | return (Array.isArray || function (subject) { | |
3680 | return Object.prototype.toString.call(subject) === '[object Array]' | |
3681 | })(subject) | |
3682 | } | |
3683 | ||
3684 | function isArrayish (subject) { | |
3685 | return isArray(subject) || Buffer.isBuffer(subject) || | |
3686 | subject && typeof subject === 'object' && | |
3687 | typeof subject.length === 'number' | |
3688 | } | |
3689 | ||
3690 | function toHex (n) { | |
3691 | if (n < 16) return '0' + n.toString(16) | |
3692 | return n.toString(16) | |
3693 | } | |
3694 | ||
3695 | function utf8ToBytes (str) { | |
3696 | var byteArray = [] | |
3697 | for (var i = 0; i < str.length; i++) { | |
3698 | var b = str.charCodeAt(i) | |
3699 | if (b <= 0x7F) { | |
3700 | byteArray.push(b) | |
3701 | } else { | |
3702 | var start = i | |
3703 | if (b >= 0xD800 && b <= 0xDFFF) i++ | |
3704 | var h = encodeURIComponent(str.slice(start, i+1)).substr(1).split('%') | |
3705 | for (var j = 0; j < h.length; j++) { | |
3706 | byteArray.push(parseInt(h[j], 16)) | |
3707 | } | |
3708 | } | |
3709 | } | |
3710 | return byteArray | |
3711 | } | |
3712 | ||
3713 | function asciiToBytes (str) { | |
3714 | var byteArray = [] | |
3715 | for (var i = 0; i < str.length; i++) { | |
3716 | // Node's code seems to be doing this and not & 0x7F.. | |
3717 | byteArray.push(str.charCodeAt(i) & 0xFF) | |
3718 | } | |
3719 | return byteArray | |
3720 | } | |
3721 | ||
3722 | function utf16leToBytes (str) { | |
3723 | var c, hi, lo | |
3724 | var byteArray = [] | |
3725 | for (var i = 0; i < str.length; i++) { | |
3726 | c = str.charCodeAt(i) | |
3727 | hi = c >> 8 | |
3728 | lo = c % 256 | |
3729 | byteArray.push(lo) | |
3730 | byteArray.push(hi) | |
3731 | } | |
3732 | ||
3733 | return byteArray | |
3734 | } | |
3735 | ||
3736 | function base64ToBytes (str) { | |
3737 | return base64.toByteArray(str) | |
3738 | } | |
3739 | ||
3740 | function blitBuffer (src, dst, offset, length) { | |
3741 | for (var i = 0; i < length; i++) { | |
3742 | if ((i + offset >= dst.length) || (i >= src.length)) | |
3743 | break | |
3744 | dst[i + offset] = src[i] | |
3745 | } | |
3746 | return i | |
3747 | } | |
3748 | ||
3749 | function decodeUtf8Char (str) { | |
3750 | try { | |
3751 | return decodeURIComponent(str) | |
3752 | } catch (err) { | |
3753 | return String.fromCharCode(0xFFFD) // UTF 8 invalid char | |
3754 | } | |
3755 | } | |
3756 | ||
3757 | /* | |
3758 | * We have to make sure that the value is a valid integer. This means that it | |
3759 | * is non-negative. It has no fractional component and that it does not | |
3760 | * exceed the maximum allowed value. | |
3761 | */ | |
3762 | function verifuint (value, max) { | |
3763 | assert(typeof value === 'number', 'cannot write a non-number as a number') | |
3764 | assert(value >= 0, 'specified a negative value for writing an unsigned value') | |
3765 | assert(value <= max, 'value is larger than maximum value for type') | |
3766 | assert(Math.floor(value) === value, 'value has a fractional component') | |
3767 | } | |
3768 | ||
3769 | function verifsint (value, max, min) { | |
3770 | assert(typeof value === 'number', 'cannot write a non-number as a number') | |
3771 | assert(value <= max, 'value larger than maximum allowed value') | |
3772 | assert(value >= min, 'value smaller than minimum allowed value') | |
3773 | assert(Math.floor(value) === value, 'value has a fractional component') | |
3774 | } | |
3775 | ||
3776 | function verifIEEE754 (value, max, min) { | |
3777 | assert(typeof value === 'number', 'cannot write a non-number as a number') | |
3778 | assert(value <= max, 'value larger than maximum allowed value') | |
3779 | assert(value >= min, 'value smaller than minimum allowed value') | |
3780 | } | |
3781 | ||
3782 | function assert (test, message) { | |
3783 | if (!test) throw new Error(message || 'Failed assertion') | |
3784 | } | |
3785 | ||
3786 | },{"base64-js":9,"ieee754":10}],9:[function(_dereq_,module,exports){ | |
3787 | var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; | |
3788 | ||
3789 | ;(function (exports) { | |
3790 | 'use strict'; | |
3791 | ||
3792 | var Arr = (typeof Uint8Array !== 'undefined') | |
3793 | ? Uint8Array | |
3794 | : Array | |
3795 | ||
3796 | var PLUS = '+'.charCodeAt(0) | |
3797 | var SLASH = '/'.charCodeAt(0) | |
3798 | var NUMBER = '0'.charCodeAt(0) | |
3799 | var LOWER = 'a'.charCodeAt(0) | |
3800 | var UPPER = 'A'.charCodeAt(0) | |
3801 | ||
3802 | function decode (elt) { | |
3803 | var code = elt.charCodeAt(0) | |
3804 | if (code === PLUS) | |
3805 | return 62 // '+' | |
3806 | if (code === SLASH) | |
3807 | return 63 // '/' | |
3808 | if (code < NUMBER) | |
3809 | return -1 //no match | |
3810 | if (code < NUMBER + 10) | |
3811 | return code - NUMBER + 26 + 26 | |
3812 | if (code < UPPER + 26) | |
3813 | return code - UPPER | |
3814 | if (code < LOWER + 26) | |
3815 | return code - LOWER + 26 | |
3816 | } | |
3817 | ||
3818 | function b64ToByteArray (b64) { | |
3819 | var i, j, l, tmp, placeHolders, arr | |
3820 | ||
3821 | if (b64.length % 4 > 0) { | |
3822 | throw new Error('Invalid string. Length must be a multiple of 4') | |
3823 | } | |
3824 | ||
3825 | // the number of equal signs (place holders) | |
3826 | // if there are two placeholders, than the two characters before it | |
3827 | // represent one byte | |
3828 | // if there is only one, then the three characters before it represent 2 bytes | |
3829 | // this is just a cheap hack to not do indexOf twice | |
3830 | var len = b64.length | |
3831 | placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0 | |
3832 | ||
3833 | // base64 is 4/3 + up to two characters of the original data | |
3834 | arr = new Arr(b64.length * 3 / 4 - placeHolders) | |
3835 | ||
3836 | // if there are placeholders, only get up to the last complete 4 chars | |
3837 | l = placeHolders > 0 ? b64.length - 4 : b64.length | |
3838 | ||
3839 | var L = 0 | |
3840 | ||
3841 | function push (v) { | |
3842 | arr[L++] = v | |
3843 | } | |
3844 | ||
3845 | for (i = 0, j = 0; i < l; i += 4, j += 3) { | |
3846 | tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3)) | |
3847 | push((tmp & 0xFF0000) >> 16) | |
3848 | push((tmp & 0xFF00) >> 8) | |
3849 | push(tmp & 0xFF) | |
3850 | } | |
3851 | ||
3852 | if (placeHolders === 2) { | |
3853 | tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4) | |
3854 | push(tmp & 0xFF) | |
3855 | } else if (placeHolders === 1) { | |
3856 | tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2) | |
3857 | push((tmp >> 8) & 0xFF) | |
3858 | push(tmp & 0xFF) | |
3859 | } | |
3860 | ||
3861 | return arr | |
3862 | } | |
3863 | ||
3864 | function uint8ToBase64 (uint8) { | |
3865 | var i, | |
3866 | extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes | |
3867 | output = "", | |
3868 | temp, length | |
3869 | ||
3870 | function encode (num) { | |
3871 | return lookup.charAt(num) | |
3872 | } | |
3873 | ||
3874 | function tripletToBase64 (num) { | |
3875 | return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F) | |
3876 | } | |
3877 | ||
3878 | // go through the array every three bytes, we'll deal with trailing stuff later | |
3879 | for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) { | |
3880 | temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) | |
3881 | output += tripletToBase64(temp) | |
3882 | } | |
3883 | ||
3884 | // pad the end with zeros, but make sure to not forget the extra bytes | |
3885 | switch (extraBytes) { | |
3886 | case 1: | |
3887 | temp = uint8[uint8.length - 1] | |
3888 | output += encode(temp >> 2) | |
3889 | output += encode((temp << 4) & 0x3F) | |
3890 | output += '==' | |
3891 | break | |
3892 | case 2: | |
3893 | temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1]) | |
3894 | output += encode(temp >> 10) | |
3895 | output += encode((temp >> 4) & 0x3F) | |
3896 | output += encode((temp << 2) & 0x3F) | |
3897 | output += '=' | |
3898 | break | |
3899 | } | |
3900 | ||
3901 | return output | |
3902 | } | |
3903 | ||
3904 | exports.toByteArray = b64ToByteArray | |
3905 | exports.fromByteArray = uint8ToBase64 | |
3906 | }(typeof exports === 'undefined' ? (this.base64js = {}) : exports)) | |
3907 | ||
3908 | },{}],10:[function(_dereq_,module,exports){ | |
3909 | exports.read = function(buffer, offset, isLE, mLen, nBytes) { | |
3910 | var e, m, | |
3911 | eLen = nBytes * 8 - mLen - 1, | |
3912 | eMax = (1 << eLen) - 1, | |
3913 | eBias = eMax >> 1, | |
3914 | nBits = -7, | |
3915 | i = isLE ? (nBytes - 1) : 0, | |
3916 | d = isLE ? -1 : 1, | |
3917 | s = buffer[offset + i]; | |
3918 | ||
3919 | i += d; | |
3920 | ||
3921 | e = s & ((1 << (-nBits)) - 1); | |
3922 | s >>= (-nBits); | |
3923 | nBits += eLen; | |
3924 | for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8){}; | |
3925 | ||
3926 | m = e & ((1 << (-nBits)) - 1); | |
3927 | e >>= (-nBits); | |
3928 | nBits += mLen; | |
3929 | for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8){}; | |
3930 | ||
3931 | if (e === 0) { | |
3932 | e = 1 - eBias; | |
3933 | } else if (e === eMax) { | |
3934 | return m ? NaN : ((s ? -1 : 1) * Infinity); | |
3935 | } else { | |
3936 | m = m + Math.pow(2, mLen); | |
3937 | e = e - eBias; | |
3938 | } | |
3939 | return (s ? -1 : 1) * m * Math.pow(2, e - mLen); | |
3940 | }; | |
3941 | ||
3942 | exports.write = function(buffer, value, offset, isLE, mLen, nBytes) { | |
3943 | var e, m, c, | |
3944 | eLen = nBytes * 8 - mLen - 1, | |
3945 | eMax = (1 << eLen) - 1, | |
3946 | eBias = eMax >> 1, | |
3947 | rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0), | |
3948 | i = isLE ? 0 : (nBytes - 1), | |
3949 | d = isLE ? 1 : -1, | |
3950 | s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; | |
3951 | ||
3952 | value = Math.abs(value); | |
3953 | ||
3954 | if (isNaN(value) || value === Infinity) { | |
3955 | m = isNaN(value) ? 1 : 0; | |
3956 | e = eMax; | |
3957 | } else { | |
3958 | e = Math.floor(Math.log(value) / Math.LN2); | |
3959 | if (value * (c = Math.pow(2, -e)) < 1) { | |
3960 | e--; | |
3961 | c *= 2; | |
3962 | } | |
3963 | if (e + eBias >= 1) { | |
3964 | value += rt / c; | |
3965 | } else { | |
3966 | value += rt * Math.pow(2, 1 - eBias); | |
3967 | } | |
3968 | if (value * c >= 2) { | |
3969 | e++; | |
3970 | c /= 2; | |
3971 | } | |
3972 | ||
3973 | if (e + eBias >= eMax) { | |
3974 | m = 0; | |
3975 | e = eMax; | |
3976 | } else if (e + eBias >= 1) { | |
3977 | m = (value * c - 1) * Math.pow(2, mLen); | |
3978 | e = e + eBias; | |
3979 | } else { | |
3980 | m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); | |
3981 | e = 0; | |
3982 | } | |
3983 | } | |
3984 | ||
3985 | for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8){}; | |
3986 | ||
3987 | e = (e << mLen) | m; | |
3988 | eLen += mLen; | |
3989 | for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8){}; | |
3990 | ||
3991 | buffer[offset + i - d] |= s * 128; | |
3992 | }; | |
3993 | ||
3994 | },{}],11:[function(_dereq_,module,exports){ | |
3995 | if (typeof Object.create === 'function') { | |
3996 | // implementation from standard node.js 'util' module | |
3997 | module.exports = function inherits(ctor, superCtor) { | |
3998 | ctor.super_ = superCtor | |
3999 | ctor.prototype = Object.create(superCtor.prototype, { | |
4000 | constructor: { | |
4001 | value: ctor, | |
4002 | enumerable: false, | |
4003 | writable: true, | |
4004 | configurable: true | |
4005 | } | |
4006 | }); | |
4007 | }; | |
4008 | } else { | |
4009 | // old school shim for old browsers | |
4010 | module.exports = function inherits(ctor, superCtor) { | |
4011 | ctor.super_ = superCtor | |
4012 | var TempCtor = function () {} | |
4013 | TempCtor.prototype = superCtor.prototype | |
4014 | ctor.prototype = new TempCtor() | |
4015 | ctor.prototype.constructor = ctor | |
4016 | } | |
4017 | } | |
4018 | ||
4019 | },{}],12:[function(_dereq_,module,exports){ | |
4020 | // shim for using process in browser | |
4021 | ||
4022 | var process = module.exports = {}; | |
4023 | ||
4024 | process.nextTick = (function () { | |
4025 | var canSetImmediate = typeof window !== 'undefined' | |
4026 | && window.setImmediate; | |
4027 | var canPost = typeof window !== 'undefined' | |
4028 | && window.postMessage && window.addEventListener | |
4029 | ; | |
4030 | ||
4031 | if (canSetImmediate) { | |
4032 | return function (f) { return window.setImmediate(f) }; | |
4033 | } | |
4034 | ||
4035 | if (canPost) { | |
4036 | var queue = []; | |
4037 | window.addEventListener('message', function (ev) { | |
4038 | var source = ev.source; | |
4039 | if ((source === window || source === null) && ev.data === 'process-tick') { | |
4040 | ev.stopPropagation(); | |
4041 | if (queue.length > 0) { | |
4042 | var fn = queue.shift(); | |
4043 | fn(); | |
4044 | } | |
4045 | } | |
4046 | }, true); | |
4047 | ||
4048 | return function nextTick(fn) { | |
4049 | queue.push(fn); | |
4050 | window.postMessage('process-tick', '*'); | |
4051 | }; | |
4052 | } | |
4053 | ||
4054 | return function nextTick(fn) { | |
4055 | setTimeout(fn, 0); | |
4056 | }; | |
4057 | })(); | |
4058 | ||
4059 | process.title = 'browser'; | |
4060 | process.browser = true; | |
4061 | process.env = {}; | |
4062 | process.argv = []; | |
4063 | ||
4064 | function noop() {} | |
4065 | ||
4066 | process.on = noop; | |
4067 | process.addListener = noop; | |
4068 | process.once = noop; | |
4069 | process.off = noop; | |
4070 | process.removeListener = noop; | |
4071 | process.removeAllListeners = noop; | |
4072 | process.emit = noop; | |
4073 | ||
4074 | process.binding = function (name) { | |
4075 | throw new Error('process.binding is not supported'); | |
4076 | } | |
4077 | ||
4078 | // TODO(shtylman) | |
4079 | process.cwd = function () { return '/' }; | |
4080 | process.chdir = function (dir) { | |
4081 | throw new Error('process.chdir is not supported'); | |
4082 | }; | |
4083 | ||
4084 | },{}],13:[function(_dereq_,module,exports){ | |
4085 | module.exports=_dereq_(5) | |
4086 | },{}],14:[function(_dereq_,module,exports){ | |
4087 | module.exports=_dereq_(6) | |
4088 | },{"./support/isBuffer":13,"FWaASH":12,"inherits":11}],15:[function(_dereq_,module,exports){ | |
4089 | (function (Buffer){ | |
4090 | // Base58 encoding/decoding | |
4091 | // Originally written by Mike Hearn for BitcoinJ | |
4092 | // Copyright (c) 2011 Google Inc | |
4093 | // Ported to JavaScript by Stefan Thomas | |
4094 | // Merged Buffer refactorings from base58-native by Stephen Pair | |
4095 | // Copyright (c) 2013 BitPay Inc | |
4096 | ||
4097 | var assert = _dereq_('assert') | |
4098 | var BigInteger = _dereq_('bigi') | |
4099 | ||
4100 | var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' | |
4101 | var ALPHABET_BUF = new Buffer(ALPHABET, 'ascii') | |
4102 | var ALPHABET_MAP = {} | |
4103 | for(var i = 0; i < ALPHABET.length; i++) { | |
4104 | ALPHABET_MAP[ALPHABET.charAt(i)] = BigInteger.valueOf(i) | |
4105 | } | |
4106 | var BASE = new BigInteger('58') | |
4107 | ||
4108 | function encode(buffer) { | |
4109 | var bi = BigInteger.fromBuffer(buffer) | |
4110 | var result = new Buffer(buffer.length << 1) | |
4111 | ||
4112 | var i = result.length - 1 | |
4113 | while (bi.signum() > 0) { | |
4114 | var remainder = bi.mod(BASE) | |
4115 | bi = bi.divide(BASE) | |
4116 | ||
4117 | result[i] = ALPHABET_BUF[remainder.intValue()] | |
4118 | i-- | |
4119 | } | |
4120 | ||
4121 | // deal with leading zeros | |
4122 | var j = 0 | |
4123 | while (buffer[j] === 0) { | |
4124 | result[i] = ALPHABET_BUF[0] | |
4125 | j++ | |
4126 | i-- | |
4127 | } | |
4128 | ||
4129 | return result.slice(i + 1, result.length).toString('ascii') | |
4130 | } | |
4131 | ||
4132 | function decode(string) { | |
4133 | if (string.length === 0) return new Buffer(0) | |
4134 | ||
4135 | var num = BigInteger.ZERO | |
4136 | ||
4137 | for (var i = 0; i < string.length; i++) { | |
4138 | num = num.multiply(BASE) | |
4139 | ||
4140 | var figure = ALPHABET_MAP[string.charAt(i)] | |
4141 | assert.notEqual(figure, undefined, 'Non-base58 character') | |
4142 | ||
4143 | num = num.add(figure) | |
4144 | } | |
4145 | ||
4146 | // deal with leading zeros | |
4147 | var j = 0 | |
4148 | while ((j < string.length) && (string[j] === ALPHABET[0])) { | |
4149 | j++ | |
4150 | } | |
4151 | ||
4152 | var buffer = num.toBuffer() | |
4153 | var leadingZeros = new Buffer(j) | |
4154 | leadingZeros.fill(0) | |
4155 | ||
4156 | return Buffer.concat([leadingZeros, buffer]) | |
4157 | } | |
4158 | ||
4159 | module.exports = { | |
4160 | encode: encode, | |
4161 | decode: decode | |
4162 | } | |
4163 | ||
4164 | }).call(this,_dereq_("buffer").Buffer) | |
4165 | },{"assert":4,"bigi":3,"buffer":8}],16:[function(_dereq_,module,exports){ | |
4166 | (function (Buffer){ | |
4167 | var createHash = _dereq_('sha.js') | |
4168 | ||
4169 | var md5 = toConstructor(_dereq_('./md5')) | |
4170 | var rmd160 = toConstructor(_dereq_('ripemd160')) | |
4171 | ||
4172 | function toConstructor (fn) { | |
4173 | return function () { | |
4174 | var buffers = [] | |
4175 | var m= { | |
4176 | update: function (data, enc) { | |
4177 | if(!Buffer.isBuffer(data)) data = new Buffer(data, enc) | |
4178 | buffers.push(data) | |
4179 | return this | |
4180 | }, | |
4181 | digest: function (enc) { | |
4182 | var buf = Buffer.concat(buffers) | |
4183 | var r = fn(buf) | |
4184 | buffers = null | |
4185 | return enc ? r.toString(enc) : r | |
4186 | } | |
4187 | } | |
4188 | return m | |
4189 | } | |
4190 | } | |
4191 | ||
4192 | module.exports = function (alg) { | |
4193 | if('md5' === alg) return new md5() | |
4194 | if('rmd160' === alg) return new rmd160() | |
4195 | return createHash(alg) | |
4196 | } | |
4197 | ||
4198 | }).call(this,_dereq_("buffer").Buffer) | |
4199 | },{"./md5":20,"buffer":8,"ripemd160":21,"sha.js":23}],17:[function(_dereq_,module,exports){ | |
4200 | (function (Buffer){ | |
4201 | var createHash = _dereq_('./create-hash') | |
4202 | ||
4203 | var blocksize = 64 | |
4204 | var zeroBuffer = new Buffer(blocksize); zeroBuffer.fill(0) | |
4205 | ||
4206 | module.exports = Hmac | |
4207 | ||
4208 | function Hmac (alg, key) { | |
4209 | if(!(this instanceof Hmac)) return new Hmac(alg, key) | |
4210 | this._opad = opad | |
4211 | this._alg = alg | |
4212 | ||
4213 | key = this._key = !Buffer.isBuffer(key) ? new Buffer(key) : key | |
4214 | ||
4215 | if(key.length > blocksize) { | |
4216 | key = createHash(alg).update(key).digest() | |
4217 | } else if(key.length < blocksize) { | |
4218 | key = Buffer.concat([key, zeroBuffer], blocksize) | |
4219 | } | |
4220 | ||
4221 | var ipad = this._ipad = new Buffer(blocksize) | |
4222 | var opad = this._opad = new Buffer(blocksize) | |
4223 | ||
4224 | for(var i = 0; i < blocksize; i++) { | |
4225 | ipad[i] = key[i] ^ 0x36 | |
4226 | opad[i] = key[i] ^ 0x5C | |
4227 | } | |
4228 | ||
4229 | this._hash = createHash(alg).update(ipad) | |
4230 | } | |
4231 | ||
4232 | Hmac.prototype.update = function (data, enc) { | |
4233 | this._hash.update(data, enc) | |
4234 | return this | |
4235 | } | |
4236 | ||
4237 | Hmac.prototype.digest = function (enc) { | |
4238 | var h = this._hash.digest() | |
4239 | return createHash(this._alg).update(this._opad).update(h).digest(enc) | |
4240 | } | |
4241 | ||
4242 | ||
4243 | }).call(this,_dereq_("buffer").Buffer) | |
4244 | },{"./create-hash":16,"buffer":8}],18:[function(_dereq_,module,exports){ | |
4245 | (function (Buffer){ | |
4246 | var intSize = 4; | |
4247 | var zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0); | |
4248 | var chrsz = 8; | |
4249 | ||
4250 | function toArray(buf, bigEndian) { | |
4251 | if ((buf.length % intSize) !== 0) { | |
4252 | var len = buf.length + (intSize - (buf.length % intSize)); | |
4253 | buf = Buffer.concat([buf, zeroBuffer], len); | |
4254 | } | |
4255 | ||
4256 | var arr = []; | |
4257 | var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE; | |
4258 | for (var i = 0; i < buf.length; i += intSize) { | |
4259 | arr.push(fn.call(buf, i)); | |
4260 | } | |
4261 | return arr; | |
4262 | } | |
4263 | ||
4264 | function toBuffer(arr, size, bigEndian) { | |
4265 | var buf = new Buffer(size); | |
4266 | var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE; | |
4267 | for (var i = 0; i < arr.length; i++) { | |
4268 | fn.call(buf, arr[i], i * 4, true); | |
4269 | } | |
4270 | return buf; | |
4271 | } | |
4272 | ||
4273 | function hash(buf, fn, hashSize, bigEndian) { | |
4274 | if (!Buffer.isBuffer(buf)) buf = new Buffer(buf); | |
4275 | var arr = fn(toArray(buf, bigEndian), buf.length * chrsz); | |
4276 | return toBuffer(arr, hashSize, bigEndian); | |
4277 | } | |
4278 | ||
4279 | module.exports = { hash: hash }; | |
4280 | ||
4281 | }).call(this,_dereq_("buffer").Buffer) | |
4282 | },{"buffer":8}],19:[function(_dereq_,module,exports){ | |
4283 | (function (Buffer){ | |
4284 | var rng = _dereq_('./rng') | |
4285 | ||
4286 | function error () { | |
4287 | var m = [].slice.call(arguments).join(' ') | |
4288 | throw new Error([ | |
4289 | m, | |
4290 | 'we accept pull requests', | |
4291 | 'http://github.com/dominictarr/crypto-browserify' | |
4292 | ].join('\n')) | |
4293 | } | |
4294 | ||
4295 | exports.createHash = _dereq_('./create-hash') | |
4296 | ||
4297 | exports.createHmac = _dereq_('./create-hmac') | |
4298 | ||
4299 | exports.randomBytes = function(size, callback) { | |
4300 | if (callback && callback.call) { | |
4301 | try { | |
4302 | callback.call(this, undefined, new Buffer(rng(size))) | |
4303 | } catch (err) { callback(err) } | |
4304 | } else { | |
4305 | return new Buffer(rng(size)) | |
4306 | } | |
4307 | } | |
4308 | ||
4309 | function each(a, f) { | |
4310 | for(var i in a) | |
4311 | f(a[i], i) | |
4312 | } | |
4313 | ||
4314 | exports.getHashes = function () { | |
4315 | return ['sha1', 'sha256', 'md5', 'rmd160'] | |
4316 | ||
4317 | } | |
4318 | ||
4319 | var p = _dereq_('./pbkdf2')(exports.createHmac) | |
4320 | exports.pbkdf2 = p.pbkdf2 | |
4321 | exports.pbkdf2Sync = p.pbkdf2Sync | |
4322 | ||
4323 | ||
4324 | // the least I can do is make error messages for the rest of the node.js/crypto api. | |
4325 | each(['createCredentials' | |
4326 | , 'createCipher' | |
4327 | , 'createCipheriv' | |
4328 | , 'createDecipher' | |
4329 | , 'createDecipheriv' | |
4330 | , 'createSign' | |
4331 | , 'createVerify' | |
4332 | , 'createDiffieHellman' | |
4333 | ], function (name) { | |
4334 | exports[name] = function () { | |
4335 | error('sorry,', name, 'is not implemented yet') | |
4336 | } | |
4337 | }) | |
4338 | ||
4339 | }).call(this,_dereq_("buffer").Buffer) | |
4340 | },{"./create-hash":16,"./create-hmac":17,"./pbkdf2":27,"./rng":28,"buffer":8}],20:[function(_dereq_,module,exports){ | |
4341 | /* | |
4342 | * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message | |
4343 | * Digest Algorithm, as defined in RFC 1321. | |
4344 | * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. | |
4345 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet | |
4346 | * Distributed under the BSD License | |
4347 | * See http://pajhome.org.uk/crypt/md5 for more info. | |
4348 | */ | |
4349 | ||
4350 | var helpers = _dereq_('./helpers'); | |
4351 | ||
4352 | /* | |
4353 | * Calculate the MD5 of an array of little-endian words, and a bit length | |
4354 | */ | |
4355 | function core_md5(x, len) | |
4356 | { | |
4357 | /* append padding */ | |
4358 | x[len >> 5] |= 0x80 << ((len) % 32); | |
4359 | x[(((len + 64) >>> 9) << 4) + 14] = len; | |
4360 | ||
4361 | var a = 1732584193; | |
4362 | var b = -271733879; | |
4363 | var c = -1732584194; | |
4364 | var d = 271733878; | |
4365 | ||
4366 | for(var i = 0; i < x.length; i += 16) | |
4367 | { | |
4368 | var olda = a; | |
4369 | var oldb = b; | |
4370 | var oldc = c; | |
4371 | var oldd = d; | |
4372 | ||
4373 | a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); | |
4374 | d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); | |
4375 | c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); | |
4376 | b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); | |
4377 | a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); | |
4378 | d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); | |
4379 | c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); | |
4380 | b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); | |
4381 | a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); | |
4382 | d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); | |
4383 | c = md5_ff(c, d, a, b, x[i+10], 17, -42063); | |
4384 | b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); | |
4385 | a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); | |
4386 | d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); | |
4387 | c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); | |
4388 | b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); | |
4389 | ||
4390 | a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); | |
4391 | d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); | |
4392 | c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); | |
4393 | b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); | |
4394 | a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); | |
4395 | d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); | |
4396 | c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); | |
4397 | b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); | |
4398 | a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); | |
4399 | d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); | |
4400 | c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); | |
4401 | b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); | |
4402 | a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); | |
4403 | d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); | |
4404 | c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); | |
4405 | b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); | |
4406 | ||
4407 | a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); | |
4408 | d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); | |
4409 | c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); | |
4410 | b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); | |
4411 | a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); | |
4412 | d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); | |
4413 | c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); | |
4414 | b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); | |
4415 | a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); | |
4416 | d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); | |
4417 | c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); | |
4418 | b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); | |
4419 | a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); | |
4420 | d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); | |
4421 | c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); | |
4422 | b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); | |
4423 | ||
4424 | a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); | |
4425 | d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); | |
4426 | c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); | |
4427 | b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); | |
4428 | a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); | |
4429 | d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); | |
4430 | c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); | |
4431 | b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); | |
4432 | a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); | |
4433 | d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); | |
4434 | c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); | |
4435 | b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); | |
4436 | a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); | |
4437 | d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); | |
4438 | c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); | |
4439 | b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); | |
4440 | ||
4441 | a = safe_add(a, olda); | |
4442 | b = safe_add(b, oldb); | |
4443 | c = safe_add(c, oldc); | |
4444 | d = safe_add(d, oldd); | |
4445 | } | |
4446 | return Array(a, b, c, d); | |
4447 | ||
4448 | } | |
4449 | ||
4450 | /* | |
4451 | * These functions implement the four basic operations the algorithm uses. | |
4452 | */ | |
4453 | function md5_cmn(q, a, b, x, s, t) | |
4454 | { | |
4455 | return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); | |
4456 | } | |
4457 | function md5_ff(a, b, c, d, x, s, t) | |
4458 | { | |
4459 | return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); | |
4460 | } | |
4461 | function md5_gg(a, b, c, d, x, s, t) | |
4462 | { | |
4463 | return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); | |
4464 | } | |
4465 | function md5_hh(a, b, c, d, x, s, t) | |
4466 | { | |
4467 | return md5_cmn(b ^ c ^ d, a, b, x, s, t); | |
4468 | } | |
4469 | function md5_ii(a, b, c, d, x, s, t) | |
4470 | { | |
4471 | return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); | |
4472 | } | |
4473 | ||
4474 | /* | |
4475 | * Add integers, wrapping at 2^32. This uses 16-bit operations internally | |
4476 | * to work around bugs in some JS interpreters. | |
4477 | */ | |
4478 | function safe_add(x, y) | |
4479 | { | |
4480 | var lsw = (x & 0xFFFF) + (y & 0xFFFF); | |
4481 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16); | |
4482 | return (msw << 16) | (lsw & 0xFFFF); | |
4483 | } | |
4484 | ||
4485 | /* | |
4486 | * Bitwise rotate a 32-bit number to the left. | |
4487 | */ | |
4488 | function bit_rol(num, cnt) | |
4489 | { | |
4490 | return (num << cnt) | (num >>> (32 - cnt)); | |
4491 | } | |
4492 | ||
4493 | module.exports = function md5(buf) { | |
4494 | return helpers.hash(buf, core_md5, 16); | |
4495 | }; | |
4496 | ||
4497 | },{"./helpers":18}],21:[function(_dereq_,module,exports){ | |
4498 | (function (Buffer){ | |
4499 | ||
4500 | module.exports = ripemd160 | |
4501 | ||
4502 | ||
4503 | ||
4504 | /* | |
4505 | CryptoJS v3.1.2 | |
4506 | code.google.com/p/crypto-js | |
4507 | (c) 2009-2013 by Jeff Mott. All rights reserved. | |
4508 | code.google.com/p/crypto-js/wiki/License | |
4509 | */ | |
4510 | /** @preserve | |
4511 | (c) 2012 by Cédric Mesnil. All rights reserved. | |
4512 | ||
4513 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |
4514 | ||
4515 | - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |
4516 | - 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. | |
4517 | ||
4518 | 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. | |
4519 | */ | |
4520 | ||
4521 | // Constants table | |
4522 | var zl = [ | |
4523 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | |
4524 | 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, | |
4525 | 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, | |
4526 | 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, | |
4527 | 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]; | |
4528 | var zr = [ | |
4529 | 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, | |
4530 | 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, | |
4531 | 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, | |
4532 | 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, | |
4533 | 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]; | |
4534 | var sl = [ | |
4535 | 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, | |
4536 | 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, | |
4537 | 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, | |
4538 | 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, | |
4539 | 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]; | |
4540 | var sr = [ | |
4541 | 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, | |
4542 | 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, | |
4543 | 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, | |
4544 | 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, | |
4545 | 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]; | |
4546 | ||
4547 | var hl = [ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]; | |
4548 | var hr = [ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]; | |
4549 | ||
4550 | var bytesToWords = function (bytes) { | |
4551 | var words = []; | |
4552 | for (var i = 0, b = 0; i < bytes.length; i++, b += 8) { | |
4553 | words[b >>> 5] |= bytes[i] << (24 - b % 32); | |
4554 | } | |
4555 | return words; | |
4556 | }; | |
4557 | ||
4558 | var wordsToBytes = function (words) { | |
4559 | var bytes = []; | |
4560 | for (var b = 0; b < words.length * 32; b += 8) { | |
4561 | bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF); | |
4562 | } | |
4563 | return bytes; | |
4564 | }; | |
4565 | ||
4566 | var processBlock = function (H, M, offset) { | |
4567 | ||
4568 | // Swap endian | |
4569 | for (var i = 0; i < 16; i++) { | |
4570 | var offset_i = offset + i; | |
4571 | var M_offset_i = M[offset_i]; | |
4572 | ||
4573 | // Swap | |
4574 | M[offset_i] = ( | |
4575 | (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | | |
4576 | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) | |
4577 | ); | |
4578 | } | |
4579 | ||
4580 | // Working variables | |
4581 | var al, bl, cl, dl, el; | |
4582 | var ar, br, cr, dr, er; | |
4583 | ||
4584 | ar = al = H[0]; | |
4585 | br = bl = H[1]; | |
4586 | cr = cl = H[2]; | |
4587 | dr = dl = H[3]; | |
4588 | er = el = H[4]; | |
4589 | // Computation | |
4590 | var t; | |
4591 | for (var i = 0; i < 80; i += 1) { | |
4592 | t = (al + M[offset+zl[i]])|0; | |
4593 | if (i<16){ | |
4594 | t += f1(bl,cl,dl) + hl[0]; | |
4595 | } else if (i<32) { | |
4596 | t += f2(bl,cl,dl) + hl[1]; | |
4597 | } else if (i<48) { | |
4598 | t += f3(bl,cl,dl) + hl[2]; | |
4599 | } else if (i<64) { | |
4600 | t += f4(bl,cl,dl) + hl[3]; | |
4601 | } else {// if (i<80) { | |
4602 | t += f5(bl,cl,dl) + hl[4]; | |
4603 | } | |
4604 | t = t|0; | |
4605 | t = rotl(t,sl[i]); | |
4606 | t = (t+el)|0; | |
4607 | al = el; | |
4608 | el = dl; | |
4609 | dl = rotl(cl, 10); | |
4610 | cl = bl; | |
4611 | bl = t; | |
4612 | ||
4613 | t = (ar + M[offset+zr[i]])|0; | |
4614 | if (i<16){ | |
4615 | t += f5(br,cr,dr) + hr[0]; | |
4616 | } else if (i<32) { | |
4617 | t += f4(br,cr,dr) + hr[1]; | |
4618 | } else if (i<48) { | |
4619 | t += f3(br,cr,dr) + hr[2]; | |
4620 | } else if (i<64) { | |
4621 | t += f2(br,cr,dr) + hr[3]; | |
4622 | } else {// if (i<80) { | |
4623 | t += f1(br,cr,dr) + hr[4]; | |
4624 | } | |
4625 | t = t|0; | |
4626 | t = rotl(t,sr[i]) ; | |
4627 | t = (t+er)|0; | |
4628 | ar = er; | |
4629 | er = dr; | |
4630 | dr = rotl(cr, 10); | |
4631 | cr = br; | |
4632 | br = t; | |
4633 | } | |
4634 | // Intermediate hash value | |
4635 | t = (H[1] + cl + dr)|0; | |
4636 | H[1] = (H[2] + dl + er)|0; | |
4637 | H[2] = (H[3] + el + ar)|0; | |
4638 | H[3] = (H[4] + al + br)|0; | |
4639 | H[4] = (H[0] + bl + cr)|0; | |
4640 | H[0] = t; | |
4641 | }; | |
4642 | ||
4643 | function f1(x, y, z) { | |
4644 | return ((x) ^ (y) ^ (z)); | |
4645 | } | |
4646 | ||
4647 | function f2(x, y, z) { | |
4648 | return (((x)&(y)) | ((~x)&(z))); | |
4649 | } | |
4650 | ||
4651 | function f3(x, y, z) { | |
4652 | return (((x) | (~(y))) ^ (z)); | |
4653 | } | |
4654 | ||
4655 | function f4(x, y, z) { | |
4656 | return (((x) & (z)) | ((y)&(~(z)))); | |
4657 | } | |
4658 | ||
4659 | function f5(x, y, z) { | |
4660 | return ((x) ^ ((y) |(~(z)))); | |
4661 | } | |
4662 | ||
4663 | function rotl(x,n) { | |
4664 | return (x<<n) | (x>>>(32-n)); | |
4665 | } | |
4666 | ||
4667 | function ripemd160(message) { | |
4668 | var H = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]; | |
4669 | ||
4670 | if (typeof message == 'string') | |
4671 | message = new Buffer(message, 'utf8'); | |
4672 | ||
4673 | var m = bytesToWords(message); | |
4674 | ||
4675 | var nBitsLeft = message.length * 8; | |
4676 | var nBitsTotal = message.length * 8; | |
4677 | ||
4678 | // Add padding | |
4679 | m[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); | |
4680 | m[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( | |
4681 | (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | | |
4682 | (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) | |
4683 | ); | |
4684 | ||
4685 | for (var i=0 ; i<m.length; i += 16) { | |
4686 | processBlock(H, m, i); | |
4687 | } | |
4688 | ||
4689 | // Swap endian | |
4690 | for (var i = 0; i < 5; i++) { | |
4691 | // Shortcut | |
4692 | var H_i = H[i]; | |
4693 | ||
4694 | // Swap | |
4695 | H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | | |
4696 | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); | |
4697 | } | |
4698 | ||
4699 | var digestbytes = wordsToBytes(H); | |
4700 | return new Buffer(digestbytes); | |
4701 | } | |
4702 | ||
4703 | ||
4704 | ||
4705 | }).call(this,_dereq_("buffer").Buffer) | |
4706 | },{"buffer":8}],22:[function(_dereq_,module,exports){ | |
4707 | var u = _dereq_('./util') | |
4708 | var write = u.write | |
4709 | var fill = u.zeroFill | |
4710 | ||
4711 | module.exports = function (Buffer) { | |
4712 | ||
4713 | //prototype class for hash functions | |
4714 | function Hash (blockSize, finalSize) { | |
4715 | this._block = new Buffer(blockSize) //new Uint32Array(blockSize/4) | |
4716 | this._finalSize = finalSize | |
4717 | this._blockSize = blockSize | |
4718 | this._len = 0 | |
4719 | this._s = 0 | |
4720 | } | |
4721 | ||
4722 | Hash.prototype.init = function () { | |
4723 | this._s = 0 | |
4724 | this._len = 0 | |
4725 | } | |
4726 | ||
4727 | function lengthOf(data, enc) { | |
4728 | if(enc == null) return data.byteLength || data.length | |
4729 | if(enc == 'ascii' || enc == 'binary') return data.length | |
4730 | if(enc == 'hex') return data.length/2 | |
4731 | if(enc == 'base64') return data.length/3 | |
4732 | } | |
4733 | ||
4734 | Hash.prototype.update = function (data, enc) { | |
4735 | var bl = this._blockSize | |
4736 | ||
4737 | //I'd rather do this with a streaming encoder, like the opposite of | |
4738 | //http://nodejs.org/api/string_decoder.html | |
4739 | var length | |
4740 | if(!enc && 'string' === typeof data) | |
4741 | enc = 'utf8' | |
4742 | ||
4743 | if(enc) { | |
4744 | if(enc === 'utf-8') | |
4745 | enc = 'utf8' | |
4746 | ||
4747 | if(enc === 'base64' || enc === 'utf8') | |
4748 | data = new Buffer(data, enc), enc = null | |
4749 | ||
4750 | length = lengthOf(data, enc) | |
4751 | } else | |
4752 | length = data.byteLength || data.length | |
4753 | ||
4754 | var l = this._len += length | |
4755 | var s = this._s = (this._s || 0) | |
4756 | var f = 0 | |
4757 | var buffer = this._block | |
4758 | while(s < l) { | |
4759 | var t = Math.min(length, f + bl) | |
4760 | write(buffer, data, enc, s%bl, f, t) | |
4761 | var ch = (t - f); | |
4762 | s += ch; f += ch | |
4763 | ||
4764 | if(!(s%bl)) | |
4765 | this._update(buffer) | |
4766 | } | |
4767 | this._s = s | |
4768 | ||
4769 | return this | |
4770 | ||
4771 | } | |
4772 | ||
4773 | Hash.prototype.digest = function (enc) { | |
4774 | var bl = this._blockSize | |
4775 | var fl = this._finalSize | |
4776 | var len = this._len*8 | |
4777 | ||
4778 | var x = this._block | |
4779 | ||
4780 | var bits = len % (bl*8) | |
4781 | ||
4782 | //add end marker, so that appending 0's creats a different hash. | |
4783 | x[this._len % bl] = 0x80 | |
4784 | fill(this._block, this._len % bl + 1) | |
4785 | ||
4786 | if(bits >= fl*8) { | |
4787 | this._update(this._block) | |
4788 | u.zeroFill(this._block, 0) | |
4789 | } | |
4790 | ||
4791 | //TODO: handle case where the bit length is > Math.pow(2, 29) | |
4792 | x.writeInt32BE(len, fl + 4) //big endian | |
4793 | ||
4794 | var hash = this._update(this._block) || this._hash() | |
4795 | if(enc == null) return hash | |
4796 | return hash.toString(enc) | |
4797 | } | |
4798 | ||
4799 | Hash.prototype._update = function () { | |
4800 | throw new Error('_update must be implemented by subclass') | |
4801 | } | |
4802 | ||
4803 | return Hash | |
4804 | } | |
4805 | ||
4806 | },{"./util":26}],23:[function(_dereq_,module,exports){ | |
4807 | var exports = module.exports = function (alg) { | |
4808 | var Alg = exports[alg] | |
4809 | if(!Alg) throw new Error(alg + ' is not supported (we accept pull requests)') | |
4810 | return new Alg() | |
4811 | } | |
4812 | ||
4813 | var Buffer = _dereq_('buffer').Buffer | |
4814 | var Hash = _dereq_('./hash')(Buffer) | |
4815 | ||
4816 | exports.sha = | |
4817 | exports.sha1 = _dereq_('./sha1')(Buffer, Hash) | |
4818 | exports.sha256 = _dereq_('./sha256')(Buffer, Hash) | |
4819 | ||
4820 | },{"./hash":22,"./sha1":24,"./sha256":25,"buffer":8}],24:[function(_dereq_,module,exports){ | |
4821 | /* | |
4822 | * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined | |
4823 | * in FIPS PUB 180-1 | |
4824 | * Version 2.1a Copyright Paul Johnston 2000 - 2002. | |
4825 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet | |
4826 | * Distributed under the BSD License | |
4827 | * See http://pajhome.org.uk/crypt/md5 for details. | |
4828 | */ | |
4829 | module.exports = function (Buffer, Hash) { | |
4830 | ||
4831 | var inherits = _dereq_('util').inherits | |
4832 | ||
4833 | inherits(Sha1, Hash) | |
4834 | ||
4835 | var A = 0|0 | |
4836 | var B = 4|0 | |
4837 | var C = 8|0 | |
4838 | var D = 12|0 | |
4839 | var E = 16|0 | |
4840 | ||
4841 | var BE = false | |
4842 | var LE = true | |
4843 | ||
4844 | var W = new Int32Array(80) | |
4845 | ||
4846 | var POOL = [] | |
4847 | ||
4848 | function Sha1 () { | |
4849 | if(POOL.length) | |
4850 | return POOL.pop().init() | |
4851 | ||
4852 | if(!(this instanceof Sha1)) return new Sha1() | |
4853 | this._w = W | |
4854 | Hash.call(this, 16*4, 14*4) | |
4855 | ||
4856 | this._h = null | |
4857 | this.init() | |
4858 | } | |
4859 | ||
4860 | Sha1.prototype.init = function () { | |
4861 | this._a = 0x67452301 | |
4862 | this._b = 0xefcdab89 | |
4863 | this._c = 0x98badcfe | |
4864 | this._d = 0x10325476 | |
4865 | this._e = 0xc3d2e1f0 | |
4866 | ||
4867 | Hash.prototype.init.call(this) | |
4868 | return this | |
4869 | } | |
4870 | ||
4871 | Sha1.prototype._POOL = POOL | |
4872 | ||
4873 | // assume that array is a Uint32Array with length=16, | |
4874 | // and that if it is the last block, it already has the length and the 1 bit appended. | |
4875 | ||
4876 | ||
4877 | var isDV = new Buffer(1) instanceof DataView | |
4878 | function readInt32BE (X, i) { | |
4879 | return isDV | |
4880 | ? X.getInt32(i, false) | |
4881 | : X.readInt32BE(i) | |
4882 | } | |
4883 | ||
4884 | Sha1.prototype._update = function (array) { | |
4885 | ||
4886 | var X = this._block | |
4887 | var h = this._h | |
4888 | var a, b, c, d, e, _a, _b, _c, _d, _e | |
4889 | ||
4890 | a = _a = this._a | |
4891 | b = _b = this._b | |
4892 | c = _c = this._c | |
4893 | d = _d = this._d | |
4894 | e = _e = this._e | |
4895 | ||
4896 | var w = this._w | |
4897 | ||
4898 | for(var j = 0; j < 80; j++) { | |
4899 | var W = w[j] | |
4900 | = j < 16 | |
4901 | //? X.getInt32(j*4, false) | |
4902 | //? readInt32BE(X, j*4) //*/ X.readInt32BE(j*4) //*/ | |
4903 | ? X.readInt32BE(j*4) | |
4904 | : rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1) | |
4905 | ||
4906 | var t = | |
4907 | add( | |
4908 | add(rol(a, 5), sha1_ft(j, b, c, d)), | |
4909 | add(add(e, W), sha1_kt(j)) | |
4910 | ); | |
4911 | ||
4912 | e = d | |
4913 | d = c | |
4914 | c = rol(b, 30) | |
4915 | b = a | |
4916 | a = t | |
4917 | } | |
4918 | ||
4919 | this._a = add(a, _a) | |
4920 | this._b = add(b, _b) | |
4921 | this._c = add(c, _c) | |
4922 | this._d = add(d, _d) | |
4923 | this._e = add(e, _e) | |
4924 | } | |
4925 | ||
4926 | Sha1.prototype._hash = function () { | |
4927 | if(POOL.length < 100) POOL.push(this) | |
4928 | var H = new Buffer(20) | |
4929 | //console.log(this._a|0, this._b|0, this._c|0, this._d|0, this._e|0) | |
4930 | H.writeInt32BE(this._a|0, A) | |
4931 | H.writeInt32BE(this._b|0, B) | |
4932 | H.writeInt32BE(this._c|0, C) | |
4933 | H.writeInt32BE(this._d|0, D) | |
4934 | H.writeInt32BE(this._e|0, E) | |
4935 | return H | |
4936 | } | |
4937 | ||
4938 | /* | |
4939 | * Perform the appropriate triplet combination function for the current | |
4940 | * iteration | |
4941 | */ | |
4942 | function sha1_ft(t, b, c, d) { | |
4943 | if(t < 20) return (b & c) | ((~b) & d); | |
4944 | if(t < 40) return b ^ c ^ d; | |
4945 | if(t < 60) return (b & c) | (b & d) | (c & d); | |
4946 | return b ^ c ^ d; | |
4947 | } | |
4948 | ||
4949 | /* | |
4950 | * Determine the appropriate additive constant for the current iteration | |
4951 | */ | |
4952 | function sha1_kt(t) { | |
4953 | return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : | |
4954 | (t < 60) ? -1894007588 : -899497514; | |
4955 | } | |
4956 | ||
4957 | /* | |
4958 | * Add integers, wrapping at 2^32. This uses 16-bit operations internally | |
4959 | * to work around bugs in some JS interpreters. | |
4960 | * //dominictarr: this is 10 years old, so maybe this can be dropped?) | |
4961 | * | |
4962 | */ | |
4963 | function add(x, y) { | |
4964 | return (x + y ) | 0 | |
4965 | //lets see how this goes on testling. | |
4966 | // var lsw = (x & 0xFFFF) + (y & 0xFFFF); | |
4967 | // var msw = (x >> 16) + (y >> 16) + (lsw >> 16); | |
4968 | // return (msw << 16) | (lsw & 0xFFFF); | |
4969 | } | |
4970 | ||
4971 | /* | |
4972 | * Bitwise rotate a 32-bit number to the left. | |
4973 | */ | |
4974 | function rol(num, cnt) { | |
4975 | return (num << cnt) | (num >>> (32 - cnt)); | |
4976 | } | |
4977 | ||
4978 | return Sha1 | |
4979 | } | |
4980 | ||
4981 | },{"util":14}],25:[function(_dereq_,module,exports){ | |
4982 | ||
4983 | /** | |
4984 | * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined | |
4985 | * in FIPS 180-2 | |
4986 | * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. | |
4987 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet | |
4988 | * | |
4989 | */ | |
4990 | ||
4991 | var inherits = _dereq_('util').inherits | |
4992 | var BE = false | |
4993 | var LE = true | |
4994 | var u = _dereq_('./util') | |
4995 | ||
4996 | module.exports = function (Buffer, Hash) { | |
4997 | ||
4998 | var K = [ | |
4999 | 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, | |
5000 | 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, | |
5001 | 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, | |
5002 | 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, | |
5003 | 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, | |
5004 | 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, | |
5005 | 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, | |
5006 | 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, | |
5007 | 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, | |
5008 | 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, | |
5009 | 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, | |
5010 | 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, | |
5011 | 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, | |
5012 | 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, | |
5013 | 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, | |
5014 | 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 | |
5015 | ] | |
5016 | ||
5017 | inherits(Sha256, Hash) | |
5018 | var W = new Array(64) | |
5019 | var POOL = [] | |
5020 | function Sha256() { | |
5021 | // Closure compiler warning - this code lacks side effects - thus commented out | |
5022 | // if(POOL.length) { | |
5023 | // return POOL.shift().init() | |
5024 | // } | |
5025 | //this._data = new Buffer(32) | |
5026 | ||
5027 | this.init() | |
5028 | ||
5029 | this._w = W //new Array(64) | |
5030 | ||
5031 | Hash.call(this, 16*4, 14*4) | |
5032 | }; | |
5033 | ||
5034 | Sha256.prototype.init = function () { | |
5035 | ||
5036 | this._a = 0x6a09e667|0 | |
5037 | this._b = 0xbb67ae85|0 | |
5038 | this._c = 0x3c6ef372|0 | |
5039 | this._d = 0xa54ff53a|0 | |
5040 | this._e = 0x510e527f|0 | |
5041 | this._f = 0x9b05688c|0 | |
5042 | this._g = 0x1f83d9ab|0 | |
5043 | this._h = 0x5be0cd19|0 | |
5044 | ||
5045 | this._len = this._s = 0 | |
5046 | ||
5047 | return this | |
5048 | } | |
5049 | ||
5050 | var safe_add = function(x, y) { | |
5051 | var lsw = (x & 0xFFFF) + (y & 0xFFFF); | |
5052 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16); | |
5053 | return (msw << 16) | (lsw & 0xFFFF); | |
5054 | } | |
5055 | ||
5056 | function S (X, n) { | |
5057 | return (X >>> n) | (X << (32 - n)); | |
5058 | } | |
5059 | ||
5060 | function R (X, n) { | |
5061 | return (X >>> n); | |
5062 | } | |
5063 | ||
5064 | function Ch (x, y, z) { | |
5065 | return ((x & y) ^ ((~x) & z)); | |
5066 | } | |
5067 | ||
5068 | function Maj (x, y, z) { | |
5069 | return ((x & y) ^ (x & z) ^ (y & z)); | |
5070 | } | |
5071 | ||
5072 | function Sigma0256 (x) { | |
5073 | return (S(x, 2) ^ S(x, 13) ^ S(x, 22)); | |
5074 | } | |
5075 | ||
5076 | function Sigma1256 (x) { | |
5077 | return (S(x, 6) ^ S(x, 11) ^ S(x, 25)); | |
5078 | } | |
5079 | ||
5080 | function Gamma0256 (x) { | |
5081 | return (S(x, 7) ^ S(x, 18) ^ R(x, 3)); | |
5082 | } | |
5083 | ||
5084 | function Gamma1256 (x) { | |
5085 | return (S(x, 17) ^ S(x, 19) ^ R(x, 10)); | |
5086 | } | |
5087 | ||
5088 | Sha256.prototype._update = function(m) { | |
5089 | var M = this._block | |
5090 | var W = this._w | |
5091 | var a, b, c, d, e, f, g, h | |
5092 | var T1, T2 | |
5093 | ||
5094 | a = this._a | 0 | |
5095 | b = this._b | 0 | |
5096 | c = this._c | 0 | |
5097 | d = this._d | 0 | |
5098 | e = this._e | 0 | |
5099 | f = this._f | 0 | |
5100 | g = this._g | 0 | |
5101 | h = this._h | 0 | |
5102 | ||
5103 | for (var j = 0; j < 64; j++) { | |
5104 | var w = W[j] = j < 16 | |
5105 | ? M.readInt32BE(j * 4) | |
5106 | : Gamma1256(W[j - 2]) + W[j - 7] + Gamma0256(W[j - 15]) + W[j - 16] | |
5107 | ||
5108 | T1 = h + Sigma1256(e) + Ch(e, f, g) + K[j] + w | |
5109 | ||
5110 | T2 = Sigma0256(a) + Maj(a, b, c); | |
5111 | h = g; g = f; f = e; e = d + T1; d = c; c = b; b = a; a = T1 + T2; | |
5112 | } | |
5113 | ||
5114 | this._a = (a + this._a) | 0 | |
5115 | this._b = (b + this._b) | 0 | |
5116 | this._c = (c + this._c) | 0 | |
5117 | this._d = (d + this._d) | 0 | |
5118 | this._e = (e + this._e) | 0 | |
5119 | this._f = (f + this._f) | 0 | |
5120 | this._g = (g + this._g) | 0 | |
5121 | this._h = (h + this._h) | 0 | |
5122 | ||
5123 | }; | |
5124 | ||
5125 | Sha256.prototype._hash = function () { | |
5126 | if(POOL.length < 10) | |
5127 | POOL.push(this) | |
5128 | ||
5129 | var H = new Buffer(32) | |
5130 | ||
5131 | H.writeInt32BE(this._a, 0) | |
5132 | H.writeInt32BE(this._b, 4) | |
5133 | H.writeInt32BE(this._c, 8) | |
5134 | H.writeInt32BE(this._d, 12) | |
5135 | H.writeInt32BE(this._e, 16) | |
5136 | H.writeInt32BE(this._f, 20) | |
5137 | H.writeInt32BE(this._g, 24) | |
5138 | H.writeInt32BE(this._h, 28) | |
5139 | ||
5140 | return H | |
5141 | } | |
5142 | ||
5143 | return Sha256 | |
5144 | ||
5145 | } | |
5146 | ||
5147 | },{"./util":26,"util":14}],26:[function(_dereq_,module,exports){ | |
5148 | exports.write = write | |
5149 | exports.zeroFill = zeroFill | |
5150 | ||
5151 | exports.toString = toString | |
5152 | ||
5153 | function write (buffer, string, enc, start, from, to, LE) { | |
5154 | var l = (to - from) | |
5155 | if(enc === 'ascii' || enc === 'binary') { | |
5156 | for( var i = 0; i < l; i++) { | |
5157 | buffer[start + i] = string.charCodeAt(i + from) | |
5158 | } | |
5159 | } | |
5160 | else if(enc == null) { | |
5161 | for( var i = 0; i < l; i++) { | |
5162 | buffer[start + i] = string[i + from] | |
5163 | } | |
5164 | } | |
5165 | else if(enc === 'hex') { | |
5166 | for(var i = 0; i < l; i++) { | |
5167 | var j = from + i | |
5168 | buffer[start + i] = parseInt(string[j*2] + string[(j*2)+1], 16) | |
5169 | } | |
5170 | } | |
5171 | else if(enc === 'base64') { | |
5172 | throw new Error('base64 encoding not yet supported') | |
5173 | } | |
5174 | else | |
5175 | throw new Error(enc +' encoding not yet supported') | |
5176 | } | |
5177 | ||
5178 | //always fill to the end! | |
5179 | function zeroFill(buf, from) { | |
5180 | for(var i = from; i < buf.length; i++) | |
5181 | buf[i] = 0 | |
5182 | } | |
5183 | ||
5184 | ||
5185 | },{}],27:[function(_dereq_,module,exports){ | |
5186 | (function (Buffer){ | |
5187 | // JavaScript PBKDF2 Implementation | |
5188 | // Based on http://git.io/qsv2zw | |
5189 | // Licensed under LGPL v3 | |
5190 | // Copyright (c) 2013 jduncanator | |
5191 | ||
5192 | var blocksize = 64 | |
5193 | var zeroBuffer = new Buffer(blocksize); zeroBuffer.fill(0) | |
5194 | ||
5195 | module.exports = function (createHmac, exports) { | |
5196 | exports = exports || {} | |
5197 | ||
5198 | exports.pbkdf2 = function(password, salt, iterations, keylen, cb) { | |
5199 | if('function' !== typeof cb) | |
5200 | throw new Error('No callback provided to pbkdf2'); | |
5201 | setTimeout(function () { | |
5202 | cb(null, exports.pbkdf2Sync(password, salt, iterations, keylen)) | |
5203 | }) | |
5204 | } | |
5205 | ||
5206 | exports.pbkdf2Sync = function(key, salt, iterations, keylen) { | |
5207 | if('number' !== typeof iterations) | |
5208 | throw new TypeError('Iterations not a number') | |
5209 | if(iterations < 0) | |
5210 | throw new TypeError('Bad iterations') | |
5211 | if('number' !== typeof keylen) | |
5212 | throw new TypeError('Key length not a number') | |
5213 | if(keylen < 0) | |
5214 | throw new TypeError('Bad key length') | |
5215 | ||
5216 | //stretch key to the correct length that hmac wants it, | |
5217 | //otherwise this will happen every time hmac is called | |
5218 | //twice per iteration. | |
5219 | var key = !Buffer.isBuffer(key) ? new Buffer(key) : key | |
5220 | ||
5221 | if(key.length > blocksize) { | |
5222 | key = createHash(alg).update(key).digest() | |
5223 | } else if(key.length < blocksize) { | |
5224 | key = Buffer.concat([key, zeroBuffer], blocksize) | |
5225 | } | |
5226 | ||
5227 | var HMAC; | |
5228 | var cplen, p = 0, i = 1, itmp = new Buffer(4), digtmp; | |
5229 | var out = new Buffer(keylen); | |
5230 | out.fill(0); | |
5231 | while(keylen) { | |
5232 | if(keylen > 20) | |
5233 | cplen = 20; | |
5234 | else | |
5235 | cplen = keylen; | |
5236 | ||
5237 | /* We are unlikely to ever use more than 256 blocks (5120 bits!) | |
5238 | * but just in case... | |
5239 | */ | |
5240 | itmp[0] = (i >> 24) & 0xff; | |
5241 | itmp[1] = (i >> 16) & 0xff; | |
5242 | itmp[2] = (i >> 8) & 0xff; | |
5243 | itmp[3] = i & 0xff; | |
5244 | ||
5245 | HMAC = createHmac('sha1', key); | |
5246 | HMAC.update(salt) | |
5247 | HMAC.update(itmp); | |
5248 | digtmp = HMAC.digest(); | |
5249 | digtmp.copy(out, p, 0, cplen); | |
5250 | ||
5251 | for(var j = 1; j < iterations; j++) { | |
5252 | HMAC = createHmac('sha1', key); | |
5253 | HMAC.update(digtmp); | |
5254 | digtmp = HMAC.digest(); | |
5255 | for(var k = 0; k < cplen; k++) { | |
5256 | out[k] ^= digtmp[k]; | |
5257 | } | |
5258 | } | |
5259 | keylen -= cplen; | |
5260 | i++; | |
5261 | p += cplen; | |
5262 | } | |
5263 | ||
5264 | return out; | |
5265 | } | |
5266 | ||
5267 | return exports | |
5268 | } | |
5269 | ||
5270 | }).call(this,_dereq_("buffer").Buffer) | |
5271 | },{"buffer":8}],28:[function(_dereq_,module,exports){ | |
5272 | (function (Buffer){ | |
5273 | // Original code adapted from Robert Kieffer. | |
5274 | // details at https://github.com/broofa/node-uuid | |
5275 | ||
5276 | ||
5277 | (function() { | |
5278 | var _global = this; | |
5279 | ||
5280 | var mathRNG, whatwgRNG; | |
5281 | ||
5282 | // NOTE: Math.random() does not guarantee "cryptographic quality" | |
5283 | mathRNG = function(size) { | |
5284 | var bytes = new Buffer(size); | |
5285 | var r; | |
5286 | ||
5287 | for (var i = 0, r; i < size; i++) { | |
5288 | if ((i & 0x03) == 0) r = Math.random() * 0x100000000; | |
5289 | bytes[i] = r >>> ((i & 0x03) << 3) & 0xff; | |
5290 | } | |
5291 | ||
5292 | return bytes; | |
5293 | } | |
5294 | ||
5295 | if (_global.crypto && crypto.getRandomValues) { | |
5296 | whatwgRNG = function(size) { | |
5297 | var bytes = new Buffer(size); //in browserify, this is an extended Uint8Array | |
5298 | crypto.getRandomValues(bytes); | |
5299 | return bytes; | |
5300 | } | |
5301 | } | |
5302 | ||
5303 | module.exports = whatwgRNG || mathRNG; | |
5304 | ||
5305 | }()) | |
5306 | ||
5307 | }).call(this,_dereq_("buffer").Buffer) | |
5308 | },{"buffer":8}],29:[function(_dereq_,module,exports){ | |
5309 | ;(function (root, factory, undef) { | |
5310 | if (typeof exports === "object") { | |
5311 | // CommonJS | |
5312 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); | |
5313 | } | |
5314 | else if (typeof define === "function" && define.amd) { | |
5315 | // AMD | |
5316 | define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); | |
5317 | } | |
5318 | else { | |
5319 | // Global (browser) | |
5320 | factory(root.CryptoJS); | |
5321 | } | |
5322 | }(this, function (CryptoJS) { | |
5323 | ||
5324 | (function () { | |
5325 | // Shortcuts | |
5326 | var C = CryptoJS; | |
5327 | var C_lib = C.lib; | |
5328 | var BlockCipher = C_lib.BlockCipher; | |
5329 | var C_algo = C.algo; | |
5330 | ||
5331 | // Lookup tables | |
5332 | var SBOX = []; | |
5333 | var INV_SBOX = []; | |
5334 | var SUB_MIX_0 = []; | |
5335 | var SUB_MIX_1 = []; | |
5336 | var SUB_MIX_2 = []; | |
5337 | var SUB_MIX_3 = []; | |
5338 | var INV_SUB_MIX_0 = []; | |
5339 | var INV_SUB_MIX_1 = []; | |
5340 | var INV_SUB_MIX_2 = []; | |
5341 | var INV_SUB_MIX_3 = []; | |
5342 | ||
5343 | // Compute lookup tables | |
5344 | (function () { | |
5345 | // Compute double table | |
5346 | var d = []; | |
5347 | for (var i = 0; i < 256; i++) { | |
5348 | if (i < 128) { | |
5349 | d[i] = i << 1; | |
5350 | } else { | |
5351 | d[i] = (i << 1) ^ 0x11b; | |
5352 | } | |
5353 | } | |
5354 | ||
5355 | // Walk GF(2^8) | |
5356 | var x = 0; | |
5357 | var xi = 0; | |
5358 | for (var i = 0; i < 256; i++) { | |
5359 | // Compute sbox | |
5360 | var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4); | |
5361 | sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63; | |
5362 | SBOX[x] = sx; | |
5363 | INV_SBOX[sx] = x; | |
5364 | ||
5365 | // Compute multiplication | |
5366 | var x2 = d[x]; | |
5367 | var x4 = d[x2]; | |
5368 | var x8 = d[x4]; | |
5369 | ||
5370 | // Compute sub bytes, mix columns tables | |
5371 | var t = (d[sx] * 0x101) ^ (sx * 0x1010100); | |
5372 | SUB_MIX_0[x] = (t << 24) | (t >>> 8); | |
5373 | SUB_MIX_1[x] = (t << 16) | (t >>> 16); | |
5374 | SUB_MIX_2[x] = (t << 8) | (t >>> 24); | |
5375 | SUB_MIX_3[x] = t; | |
5376 | ||
5377 | // Compute inv sub bytes, inv mix columns tables | |
5378 | var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100); | |
5379 | INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8); | |
5380 | INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16); | |
5381 | INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24); | |
5382 | INV_SUB_MIX_3[sx] = t; | |
5383 | ||
5384 | // Compute next counter | |
5385 | if (!x) { | |
5386 | x = xi = 1; | |
5387 | } else { | |
5388 | x = x2 ^ d[d[d[x8 ^ x2]]]; | |
5389 | xi ^= d[d[xi]]; | |
5390 | } | |
5391 | } | |
5392 | }()); | |
5393 | ||
5394 | // Precomputed Rcon lookup | |
5395 | var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; | |
5396 | ||
5397 | /** | |
5398 | * AES block cipher algorithm. | |
5399 | */ | |
5400 | var AES = C_algo.AES = BlockCipher.extend({ | |
5401 | _doReset: function () { | |
5402 | // Shortcuts | |
5403 | var key = this._key; | |
5404 | var keyWords = key.words; | |
5405 | var keySize = key.sigBytes / 4; | |
5406 | ||
5407 | // Compute number of rounds | |
5408 | var nRounds = this._nRounds = keySize + 6 | |
5409 | ||
5410 | // Compute number of key schedule rows | |
5411 | var ksRows = (nRounds + 1) * 4; | |
5412 | ||
5413 | // Compute key schedule | |
5414 | var keySchedule = this._keySchedule = []; | |
5415 | for (var ksRow = 0; ksRow < ksRows; ksRow++) { | |
5416 | if (ksRow < keySize) { | |
5417 | keySchedule[ksRow] = keyWords[ksRow]; | |
5418 | } else { | |
5419 | var t = keySchedule[ksRow - 1]; | |
5420 | ||
5421 | if (!(ksRow % keySize)) { | |
5422 | // Rot word | |
5423 | t = (t << 8) | (t >>> 24); | |
5424 | ||
5425 | // Sub word | |
5426 | t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; | |
5427 | ||
5428 | // Mix Rcon | |
5429 | t ^= RCON[(ksRow / keySize) | 0] << 24; | |
5430 | } else if (keySize > 6 && ksRow % keySize == 4) { | |
5431 | // Sub word | |
5432 | t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; | |
5433 | } | |
5434 | ||
5435 | keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; | |
5436 | } | |
5437 | } | |
5438 | ||
5439 | // Compute inv key schedule | |
5440 | var invKeySchedule = this._invKeySchedule = []; | |
5441 | for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { | |
5442 | var ksRow = ksRows - invKsRow; | |
5443 | ||
5444 | if (invKsRow % 4) { | |
5445 | var t = keySchedule[ksRow]; | |
5446 | } else { | |
5447 | var t = keySchedule[ksRow - 4]; | |
5448 | } | |
5449 | ||
5450 | if (invKsRow < 4 || ksRow <= 4) { | |
5451 | invKeySchedule[invKsRow] = t; | |
5452 | } else { | |
5453 | invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^ | |
5454 | INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; | |
5455 | } | |
5456 | } | |
5457 | }, | |
5458 | ||
5459 | encryptBlock: function (M, offset) { | |
5460 | this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); | |
5461 | }, | |
5462 | ||
5463 | decryptBlock: function (M, offset) { | |
5464 | // Swap 2nd and 4th rows | |
5465 | var t = M[offset + 1]; | |
5466 | M[offset + 1] = M[offset + 3]; | |
5467 | M[offset + 3] = t; | |
5468 | ||
5469 | this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); | |
5470 | ||
5471 | // Inv swap 2nd and 4th rows | |
5472 | var t = M[offset + 1]; | |
5473 | M[offset + 1] = M[offset + 3]; | |
5474 | M[offset + 3] = t; | |
5475 | }, | |
5476 | ||
5477 | _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { | |
5478 | // Shortcut | |
5479 | var nRounds = this._nRounds; | |
5480 | ||
5481 | // Get input, add round key | |
5482 | var s0 = M[offset] ^ keySchedule[0]; | |
5483 | var s1 = M[offset + 1] ^ keySchedule[1]; | |
5484 | var s2 = M[offset + 2] ^ keySchedule[2]; | |
5485 | var s3 = M[offset + 3] ^ keySchedule[3]; | |
5486 | ||
5487 | // Key schedule row counter | |
5488 | var ksRow = 4; | |
5489 | ||
5490 | // Rounds | |
5491 | for (var round = 1; round < nRounds; round++) { | |
5492 | // Shift rows, sub bytes, mix columns, add round key | |
5493 | 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++]; | |
5494 | 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++]; | |
5495 | 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++]; | |
5496 | 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++]; | |
5497 | ||
5498 | // Update state | |
5499 | s0 = t0; | |
5500 | s1 = t1; | |
5501 | s2 = t2; | |
5502 | s3 = t3; | |
5503 | } | |
5504 | ||
5505 | // Shift rows, sub bytes, add round key | |
5506 | var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; | |
5507 | var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; | |
5508 | var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; | |
5509 | var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; | |
5510 | ||
5511 | // Set output | |
5512 | M[offset] = t0; | |
5513 | M[offset + 1] = t1; | |
5514 | M[offset + 2] = t2; | |
5515 | M[offset + 3] = t3; | |
5516 | }, | |
5517 | ||
5518 | keySize: 256/32 | |
5519 | }); | |
5520 | ||
5521 | /** | |
5522 | * Shortcut functions to the cipher's object interface. | |
5523 | * | |
5524 | * @example | |
5525 | * | |
5526 | * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); | |
5527 | * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); | |
5528 | */ | |
5529 | C.AES = BlockCipher._createHelper(AES); | |
5530 | }()); | |
5531 | ||
5532 | ||
5533 | return CryptoJS.AES; | |
5534 | ||
5535 | })); | |
5536 | },{"./cipher-core":30,"./core":31,"./enc-base64":32,"./evpkdf":34,"./md5":39}],30:[function(_dereq_,module,exports){ | |
5537 | ;(function (root, factory) { | |
5538 | if (typeof exports === "object") { | |
5539 | // CommonJS | |
5540 | module.exports = exports = factory(_dereq_("./core")); | |
5541 | } | |
5542 | else if (typeof define === "function" && define.amd) { | |
5543 | // AMD | |
5544 | define(["./core"], factory); | |
5545 | } | |
5546 | else { | |
5547 | // Global (browser) | |
5548 | factory(root.CryptoJS); | |
5549 | } | |
5550 | }(this, function (CryptoJS) { | |
5551 | ||
5552 | /** | |
5553 | * Cipher core components. | |
5554 | */ | |
5555 | CryptoJS.lib.Cipher || (function (undefined) { | |
5556 | // Shortcuts | |
5557 | var C = CryptoJS; | |
5558 | var C_lib = C.lib; | |
5559 | var Base = C_lib.Base; | |
5560 | var WordArray = C_lib.WordArray; | |
5561 | var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; | |
5562 | var C_enc = C.enc; | |
5563 | var Utf8 = C_enc.Utf8; | |
5564 | var Base64 = C_enc.Base64; | |
5565 | var C_algo = C.algo; | |
5566 | var EvpKDF = C_algo.EvpKDF; | |
5567 | ||
5568 | /** | |
5569 | * Abstract base cipher template. | |
5570 | * | |
5571 | * @property {number} keySize This cipher's key size. Default: 4 (128 bits) | |
5572 | * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) | |
5573 | * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. | |
5574 | * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. | |
5575 | */ | |
5576 | var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ | |
5577 | /** | |
5578 | * Configuration options. | |
5579 | * | |
5580 | * @property {WordArray} iv The IV to use for this operation. | |
5581 | */ | |
5582 | cfg: Base.extend(), | |
5583 | ||
5584 | /** | |
5585 | * Creates this cipher in encryption mode. | |
5586 | * | |
5587 | * @param {WordArray} key The key. | |
5588 | * @param {Object} cfg (Optional) The configuration options to use for this operation. | |
5589 | * | |
5590 | * @return {Cipher} A cipher instance. | |
5591 | * | |
5592 | * @static | |
5593 | * | |
5594 | * @example | |
5595 | * | |
5596 | * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); | |
5597 | */ | |
5598 | createEncryptor: function (key, cfg) { | |
5599 | return this.create(this._ENC_XFORM_MODE, key, cfg); | |
5600 | }, | |
5601 | ||
5602 | /** | |
5603 | * Creates this cipher in decryption mode. | |
5604 | * | |
5605 | * @param {WordArray} key The key. | |
5606 | * @param {Object} cfg (Optional) The configuration options to use for this operation. | |
5607 | * | |
5608 | * @return {Cipher} A cipher instance. | |
5609 | * | |
5610 | * @static | |
5611 | * | |
5612 | * @example | |
5613 | * | |
5614 | * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); | |
5615 | */ | |
5616 | createDecryptor: function (key, cfg) { | |
5617 | return this.create(this._DEC_XFORM_MODE, key, cfg); | |
5618 | }, | |
5619 | ||
5620 | /** | |
5621 | * Initializes a newly created cipher. | |
5622 | * | |
5623 | * @param {number} xformMode Either the encryption or decryption transormation mode constant. | |
5624 | * @param {WordArray} key The key. | |
5625 | * @param {Object} cfg (Optional) The configuration options to use for this operation. | |
5626 | * | |
5627 | * @example | |
5628 | * | |
5629 | * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); | |
5630 | */ | |
5631 | init: function (xformMode, key, cfg) { | |
5632 | // Apply config defaults | |
5633 | this.cfg = this.cfg.extend(cfg); | |
5634 | ||
5635 | // Store transform mode and key | |
5636 | this._xformMode = xformMode; | |
5637 | this._key = key; | |
5638 | ||
5639 | // Set initial values | |
5640 | this.reset(); | |
5641 | }, | |
5642 | ||
5643 | /** | |
5644 | * Resets this cipher to its initial state. | |
5645 | * | |
5646 | * @example | |
5647 | * | |
5648 | * cipher.reset(); | |
5649 | */ | |
5650 | reset: function () { | |
5651 | // Reset data buffer | |
5652 | BufferedBlockAlgorithm.reset.call(this); | |
5653 | ||
5654 | // Perform concrete-cipher logic | |
5655 | this._doReset(); | |
5656 | }, | |
5657 | ||
5658 | /** | |
5659 | * Adds data to be encrypted or decrypted. | |
5660 | * | |
5661 | * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. | |
5662 | * | |
5663 | * @return {WordArray} The data after processing. | |
5664 | * | |
5665 | * @example | |
5666 | * | |
5667 | * var encrypted = cipher.process('data'); | |
5668 | * var encrypted = cipher.process(wordArray); | |
5669 | */ | |
5670 | process: function (dataUpdate) { | |
5671 | // Append | |
5672 | this._append(dataUpdate); | |
5673 | ||
5674 | // Process available blocks | |
5675 | return this._process(); | |
5676 | }, | |
5677 | ||
5678 | /** | |
5679 | * Finalizes the encryption or decryption process. | |
5680 | * Note that the finalize operation is effectively a destructive, read-once operation. | |
5681 | * | |
5682 | * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. | |
5683 | * | |
5684 | * @return {WordArray} The data after final processing. | |
5685 | * | |
5686 | * @example | |
5687 | * | |
5688 | * var encrypted = cipher.finalize(); | |
5689 | * var encrypted = cipher.finalize('data'); | |
5690 | * var encrypted = cipher.finalize(wordArray); | |
5691 | */ | |
5692 | finalize: function (dataUpdate) { | |
5693 | // Final data update | |
5694 | if (dataUpdate) { | |
5695 | this._append(dataUpdate); | |
5696 | } | |
5697 | ||
5698 | // Perform concrete-cipher logic | |
5699 | var finalProcessedData = this._doFinalize(); | |
5700 | ||
5701 | return finalProcessedData; | |
5702 | }, | |
5703 | ||
5704 | keySize: 128/32, | |
5705 | ||
5706 | ivSize: 128/32, | |
5707 | ||
5708 | _ENC_XFORM_MODE: 1, | |
5709 | ||
5710 | _DEC_XFORM_MODE: 2, | |
5711 | ||
5712 | /** | |
5713 | * Creates shortcut functions to a cipher's object interface. | |
5714 | * | |
5715 | * @param {Cipher} cipher The cipher to create a helper for. | |
5716 | * | |
5717 | * @return {Object} An object with encrypt and decrypt shortcut functions. | |
5718 | * | |
5719 | * @static | |
5720 | * | |
5721 | * @example | |
5722 | * | |
5723 | * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); | |
5724 | */ | |
5725 | _createHelper: (function () { | |
5726 | function selectCipherStrategy(key) { | |
5727 | if (typeof key == 'string') { | |
5728 | return PasswordBasedCipher; | |
5729 | } else { | |
5730 | return SerializableCipher; | |
5731 | } | |
5732 | } | |
5733 | ||
5734 | return function (cipher) { | |
5735 | return { | |
5736 | encrypt: function (message, key, cfg) { | |
5737 | return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); | |
5738 | }, | |
5739 | ||
5740 | decrypt: function (ciphertext, key, cfg) { | |
5741 | return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); | |
5742 | } | |
5743 | }; | |
5744 | }; | |
5745 | }()) | |
5746 | }); | |
5747 | ||
5748 | /** | |
5749 | * Abstract base stream cipher template. | |
5750 | * | |
5751 | * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) | |
5752 | */ | |
5753 | var StreamCipher = C_lib.StreamCipher = Cipher.extend({ | |
5754 | _doFinalize: function () { | |
5755 | // Process partial blocks | |
5756 | var finalProcessedBlocks = this._process(!!'flush'); | |
5757 | ||
5758 | return finalProcessedBlocks; | |
5759 | }, | |
5760 | ||
5761 | blockSize: 1 | |
5762 | }); | |
5763 | ||
5764 | /** | |
5765 | * Mode namespace. | |
5766 | */ | |
5767 | var C_mode = C.mode = {}; | |
5768 | ||
5769 | /** | |
5770 | * Abstract base block cipher mode template. | |
5771 | */ | |
5772 | var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ | |
5773 | /** | |
5774 | * Creates this mode for encryption. | |
5775 | * | |
5776 | * @param {Cipher} cipher A block cipher instance. | |
5777 | * @param {Array} iv The IV words. | |
5778 | * | |
5779 | * @static | |
5780 | * | |
5781 | * @example | |
5782 | * | |
5783 | * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); | |
5784 | */ | |
5785 | createEncryptor: function (cipher, iv) { | |
5786 | return this.Encryptor.create(cipher, iv); | |
5787 | }, | |
5788 | ||
5789 | /** | |
5790 | * Creates this mode for decryption. | |
5791 | * | |
5792 | * @param {Cipher} cipher A block cipher instance. | |
5793 | * @param {Array} iv The IV words. | |
5794 | * | |
5795 | * @static | |
5796 | * | |
5797 | * @example | |
5798 | * | |
5799 | * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); | |
5800 | */ | |
5801 | createDecryptor: function (cipher, iv) { | |
5802 | return this.Decryptor.create(cipher, iv); | |
5803 | }, | |
5804 | ||
5805 | /** | |
5806 | * Initializes a newly created mode. | |
5807 | * | |
5808 | * @param {Cipher} cipher A block cipher instance. | |
5809 | * @param {Array} iv The IV words. | |
5810 | * | |
5811 | * @example | |
5812 | * | |
5813 | * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); | |
5814 | */ | |
5815 | init: function (cipher, iv) { | |
5816 | this._cipher = cipher; | |
5817 | this._iv = iv; | |
5818 | } | |
5819 | }); | |
5820 | ||
5821 | /** | |
5822 | * Cipher Block Chaining mode. | |
5823 | */ | |
5824 | var CBC = C_mode.CBC = (function () { | |
5825 | /** | |
5826 | * Abstract base CBC mode. | |
5827 | */ | |
5828 | var CBC = BlockCipherMode.extend(); | |
5829 | ||
5830 | /** | |
5831 | * CBC encryptor. | |
5832 | */ | |
5833 | CBC.Encryptor = CBC.extend({ | |
5834 | /** | |
5835 | * Processes the data block at offset. | |
5836 | * | |
5837 | * @param {Array} words The data words to operate on. | |
5838 | * @param {number} offset The offset where the block starts. | |
5839 | * | |
5840 | * @example | |
5841 | * | |
5842 | * mode.processBlock(data.words, offset); | |
5843 | */ | |
5844 | processBlock: function (words, offset) { | |
5845 | // Shortcuts | |
5846 | var cipher = this._cipher; | |
5847 | var blockSize = cipher.blockSize; | |
5848 | ||
5849 | // XOR and encrypt | |
5850 | xorBlock.call(this, words, offset, blockSize); | |
5851 | cipher.encryptBlock(words, offset); | |
5852 | ||
5853 | // Remember this block to use with next block | |
5854 | this._prevBlock = words.slice(offset, offset + blockSize); | |
5855 | } | |
5856 | }); | |
5857 | ||
5858 | /** | |
5859 | * CBC decryptor. | |
5860 | */ | |
5861 | CBC.Decryptor = CBC.extend({ | |
5862 | /** | |
5863 | * Processes the data block at offset. | |
5864 | * | |
5865 | * @param {Array} words The data words to operate on. | |
5866 | * @param {number} offset The offset where the block starts. | |
5867 | * | |
5868 | * @example | |
5869 | * | |
5870 | * mode.processBlock(data.words, offset); | |
5871 | */ | |
5872 | processBlock: function (words, offset) { | |
5873 | // Shortcuts | |
5874 | var cipher = this._cipher; | |
5875 | var blockSize = cipher.blockSize; | |
5876 | ||
5877 | // Remember this block to use with next block | |
5878 | var thisBlock = words.slice(offset, offset + blockSize); | |
5879 | ||
5880 | // Decrypt and XOR | |
5881 | cipher.decryptBlock(words, offset); | |
5882 | xorBlock.call(this, words, offset, blockSize); | |
5883 | ||
5884 | // This block becomes the previous block | |
5885 | this._prevBlock = thisBlock; | |
5886 | } | |
5887 | }); | |
5888 | ||
5889 | function xorBlock(words, offset, blockSize) { | |
5890 | // Shortcut | |
5891 | var iv = this._iv; | |
5892 | ||
5893 | // Choose mixing block | |
5894 | if (iv) { | |
5895 | var block = iv; | |
5896 | ||
5897 | // Remove IV for subsequent blocks | |
5898 | this._iv = undefined; | |
5899 | } else { | |
5900 | var block = this._prevBlock; | |
5901 | } | |
5902 | ||
5903 | // XOR blocks | |
5904 | for (var i = 0; i < blockSize; i++) { | |
5905 | words[offset + i] ^= block[i]; | |
5906 | } | |
5907 | } | |
5908 | ||
5909 | return CBC; | |
5910 | }()); | |
5911 | ||
5912 | /** | |
5913 | * Padding namespace. | |
5914 | */ | |
5915 | var C_pad = C.pad = {}; | |
5916 | ||
5917 | /** | |
5918 | * PKCS #5/7 padding strategy. | |
5919 | */ | |
5920 | var Pkcs7 = C_pad.Pkcs7 = { | |
5921 | /** | |
5922 | * Pads data using the algorithm defined in PKCS #5/7. | |
5923 | * | |
5924 | * @param {WordArray} data The data to pad. | |
5925 | * @param {number} blockSize The multiple that the data should be padded to. | |
5926 | * | |
5927 | * @static | |
5928 | * | |
5929 | * @example | |
5930 | * | |
5931 | * CryptoJS.pad.Pkcs7.pad(wordArray, 4); | |
5932 | */ | |
5933 | pad: function (data, blockSize) { | |
5934 | // Shortcut | |
5935 | var blockSizeBytes = blockSize * 4; | |
5936 | ||
5937 | // Count padding bytes | |
5938 | var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; | |
5939 | ||
5940 | // Create padding word | |
5941 | var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes; | |
5942 | ||
5943 | // Create padding | |
5944 | var paddingWords = []; | |
5945 | for (var i = 0; i < nPaddingBytes; i += 4) { | |
5946 | paddingWords.push(paddingWord); | |
5947 | } | |
5948 | var padding = WordArray.create(paddingWords, nPaddingBytes); | |
5949 | ||
5950 | // Add padding | |
5951 | data.concat(padding); | |
5952 | }, | |
5953 | ||
5954 | /** | |
5955 | * Unpads data that had been padded using the algorithm defined in PKCS #5/7. | |
5956 | * | |
5957 | * @param {WordArray} data The data to unpad. | |
5958 | * | |
5959 | * @static | |
5960 | * | |
5961 | * @example | |
5962 | * | |
5963 | * CryptoJS.pad.Pkcs7.unpad(wordArray); | |
5964 | */ | |
5965 | unpad: function (data) { | |
5966 | // Get number of padding bytes from last byte | |
5967 | var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; | |
5968 | ||
5969 | // Remove padding | |
5970 | data.sigBytes -= nPaddingBytes; | |
5971 | } | |
5972 | }; | |
5973 | ||
5974 | /** | |
5975 | * Abstract base block cipher template. | |
5976 | * | |
5977 | * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) | |
5978 | */ | |
5979 | var BlockCipher = C_lib.BlockCipher = Cipher.extend({ | |
5980 | /** | |
5981 | * Configuration options. | |
5982 | * | |
5983 | * @property {Mode} mode The block mode to use. Default: CBC | |
5984 | * @property {Padding} padding The padding strategy to use. Default: Pkcs7 | |
5985 | */ | |
5986 | cfg: Cipher.cfg.extend({ | |
5987 | mode: CBC, | |
5988 | padding: Pkcs7 | |
5989 | }), | |
5990 | ||
5991 | reset: function () { | |
5992 | // Reset cipher | |
5993 | Cipher.reset.call(this); | |
5994 | ||
5995 | // Shortcuts | |
5996 | var cfg = this.cfg; | |
5997 | var iv = cfg.iv; | |
5998 | var mode = cfg.mode; | |
5999 | ||
6000 | // Reset block mode | |
6001 | if (this._xformMode == this._ENC_XFORM_MODE) { | |
6002 | var modeCreator = mode.createEncryptor; | |
6003 | } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { | |
6004 | var modeCreator = mode.createDecryptor; | |
6005 | ||
6006 | // Keep at least one block in the buffer for unpadding | |
6007 | this._minBufferSize = 1; | |
6008 | } | |
6009 | this._mode = modeCreator.call(mode, this, iv && iv.words); | |
6010 | }, | |
6011 | ||
6012 | _doProcessBlock: function (words, offset) { | |
6013 | this._mode.processBlock(words, offset); | |
6014 | }, | |
6015 | ||
6016 | _doFinalize: function () { | |
6017 | // Shortcut | |
6018 | var padding = this.cfg.padding; | |
6019 | ||
6020 | // Finalize | |
6021 | if (this._xformMode == this._ENC_XFORM_MODE) { | |
6022 | // Pad data | |
6023 | padding.pad(this._data, this.blockSize); | |
6024 | ||
6025 | // Process final blocks | |
6026 | var finalProcessedBlocks = this._process(!!'flush'); | |
6027 | } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { | |
6028 | // Process final blocks | |
6029 | var finalProcessedBlocks = this._process(!!'flush'); | |
6030 | ||
6031 | // Unpad data | |
6032 | padding.unpad(finalProcessedBlocks); | |
6033 | } | |
6034 | ||
6035 | return finalProcessedBlocks; | |
6036 | }, | |
6037 | ||
6038 | blockSize: 128/32 | |
6039 | }); | |
6040 | ||
6041 | /** | |
6042 | * A collection of cipher parameters. | |
6043 | * | |
6044 | * @property {WordArray} ciphertext The raw ciphertext. | |
6045 | * @property {WordArray} key The key to this ciphertext. | |
6046 | * @property {WordArray} iv The IV used in the ciphering operation. | |
6047 | * @property {WordArray} salt The salt used with a key derivation function. | |
6048 | * @property {Cipher} algorithm The cipher algorithm. | |
6049 | * @property {Mode} mode The block mode used in the ciphering operation. | |
6050 | * @property {Padding} padding The padding scheme used in the ciphering operation. | |
6051 | * @property {number} blockSize The block size of the cipher. | |
6052 | * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. | |
6053 | */ | |
6054 | var CipherParams = C_lib.CipherParams = Base.extend({ | |
6055 | /** | |
6056 | * Initializes a newly created cipher params object. | |
6057 | * | |
6058 | * @param {Object} cipherParams An object with any of the possible cipher parameters. | |
6059 | * | |
6060 | * @example | |
6061 | * | |
6062 | * var cipherParams = CryptoJS.lib.CipherParams.create({ | |
6063 | * ciphertext: ciphertextWordArray, | |
6064 | * key: keyWordArray, | |
6065 | * iv: ivWordArray, | |
6066 | * salt: saltWordArray, | |
6067 | * algorithm: CryptoJS.algo.AES, | |
6068 | * mode: CryptoJS.mode.CBC, | |
6069 | * padding: CryptoJS.pad.PKCS7, | |
6070 | * blockSize: 4, | |
6071 | * formatter: CryptoJS.format.OpenSSL | |
6072 | * }); | |
6073 | */ | |
6074 | init: function (cipherParams) { | |
6075 | this.mixIn(cipherParams); | |
6076 | }, | |
6077 | ||
6078 | /** | |
6079 | * Converts this cipher params object to a string. | |
6080 | * | |
6081 | * @param {Format} formatter (Optional) The formatting strategy to use. | |
6082 | * | |
6083 | * @return {string} The stringified cipher params. | |
6084 | * | |
6085 | * @throws Error If neither the formatter nor the default formatter is set. | |
6086 | * | |
6087 | * @example | |
6088 | * | |
6089 | * var string = cipherParams + ''; | |
6090 | * var string = cipherParams.toString(); | |
6091 | * var string = cipherParams.toString(CryptoJS.format.OpenSSL); | |
6092 | */ | |
6093 | toString: function (formatter) { | |
6094 | return (formatter || this.formatter).stringify(this); | |
6095 | } | |
6096 | }); | |
6097 | ||
6098 | /** | |
6099 | * Format namespace. | |
6100 | */ | |
6101 | var C_format = C.format = {}; | |
6102 | ||
6103 | /** | |
6104 | * OpenSSL formatting strategy. | |
6105 | */ | |
6106 | var OpenSSLFormatter = C_format.OpenSSL = { | |
6107 | /** | |
6108 | * Converts a cipher params object to an OpenSSL-compatible string. | |
6109 | * | |
6110 | * @param {CipherParams} cipherParams The cipher params object. | |
6111 | * | |
6112 | * @return {string} The OpenSSL-compatible string. | |
6113 | * | |
6114 | * @static | |
6115 | * | |
6116 | * @example | |
6117 | * | |
6118 | * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); | |
6119 | */ | |
6120 | stringify: function (cipherParams) { | |
6121 | // Shortcuts | |
6122 | var ciphertext = cipherParams.ciphertext; | |
6123 | var salt = cipherParams.salt; | |
6124 | ||
6125 | // Format | |
6126 | if (salt) { | |
6127 | var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); | |
6128 | } else { | |
6129 | var wordArray = ciphertext; | |
6130 | } | |
6131 | ||
6132 | return wordArray.toString(Base64); | |
6133 | }, | |
6134 | ||
6135 | /** | |
6136 | * Converts an OpenSSL-compatible string to a cipher params object. | |
6137 | * | |
6138 | * @param {string} openSSLStr The OpenSSL-compatible string. | |
6139 | * | |
6140 | * @return {CipherParams} The cipher params object. | |
6141 | * | |
6142 | * @static | |
6143 | * | |
6144 | * @example | |
6145 | * | |
6146 | * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); | |
6147 | */ | |
6148 | parse: function (openSSLStr) { | |
6149 | // Parse base64 | |
6150 | var ciphertext = Base64.parse(openSSLStr); | |
6151 | ||
6152 | // Shortcut | |
6153 | var ciphertextWords = ciphertext.words; | |
6154 | ||
6155 | // Test for salt | |
6156 | if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { | |
6157 | // Extract salt | |
6158 | var salt = WordArray.create(ciphertextWords.slice(2, 4)); | |
6159 | ||
6160 | // Remove salt from ciphertext | |
6161 | ciphertextWords.splice(0, 4); | |
6162 | ciphertext.sigBytes -= 16; | |
6163 | } | |
6164 | ||
6165 | return CipherParams.create({ ciphertext: ciphertext, salt: salt }); | |
6166 | } | |
6167 | }; | |
6168 | ||
6169 | /** | |
6170 | * A cipher wrapper that returns ciphertext as a serializable cipher params object. | |
6171 | */ | |
6172 | var SerializableCipher = C_lib.SerializableCipher = Base.extend({ | |
6173 | /** | |
6174 | * Configuration options. | |
6175 | * | |
6176 | * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL | |
6177 | */ | |
6178 | cfg: Base.extend({ | |
6179 | format: OpenSSLFormatter | |
6180 | }), | |
6181 | ||
6182 | /** | |
6183 | * Encrypts a message. | |
6184 | * | |
6185 | * @param {Cipher} cipher The cipher algorithm to use. | |
6186 | * @param {WordArray|string} message The message to encrypt. | |
6187 | * @param {WordArray} key The key. | |
6188 | * @param {Object} cfg (Optional) The configuration options to use for this operation. | |
6189 | * | |
6190 | * @return {CipherParams} A cipher params object. | |
6191 | * | |
6192 | * @static | |
6193 | * | |
6194 | * @example | |
6195 | * | |
6196 | * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); | |
6197 | * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); | |
6198 | * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); | |
6199 | */ | |
6200 | encrypt: function (cipher, message, key, cfg) { | |
6201 | // Apply config defaults | |
6202 | cfg = this.cfg.extend(cfg); | |
6203 | ||
6204 | // Encrypt | |
6205 | var encryptor = cipher.createEncryptor(key, cfg); | |
6206 | var ciphertext = encryptor.finalize(message); | |
6207 | ||
6208 | // Shortcut | |
6209 | var cipherCfg = encryptor.cfg; | |
6210 | ||
6211 | // Create and return serializable cipher params | |
6212 | return CipherParams.create({ | |
6213 | ciphertext: ciphertext, | |
6214 | key: key, | |
6215 | iv: cipherCfg.iv, | |
6216 | algorithm: cipher, | |
6217 | mode: cipherCfg.mode, | |
6218 | padding: cipherCfg.padding, | |
6219 | blockSize: cipher.blockSize, | |
6220 | formatter: cfg.format | |
6221 | }); | |
6222 | }, | |
6223 | ||
6224 | /** | |
6225 | * Decrypts serialized ciphertext. | |
6226 | * | |
6227 | * @param {Cipher} cipher The cipher algorithm to use. | |
6228 | * @param {CipherParams|string} ciphertext The ciphertext to decrypt. | |
6229 | * @param {WordArray} key The key. | |
6230 | * @param {Object} cfg (Optional) The configuration options to use for this operation. | |
6231 | * | |
6232 | * @return {WordArray} The plaintext. | |
6233 | * | |
6234 | * @static | |
6235 | * | |
6236 | * @example | |
6237 | * | |
6238 | * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); | |
6239 | * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); | |
6240 | */ | |
6241 | decrypt: function (cipher, ciphertext, key, cfg) { | |
6242 | // Apply config defaults | |
6243 | cfg = this.cfg.extend(cfg); | |
6244 | ||
6245 | // Convert string to CipherParams | |
6246 | ciphertext = this._parse(ciphertext, cfg.format); | |
6247 | ||
6248 | // Decrypt | |
6249 | var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); | |
6250 | ||
6251 | return plaintext; | |
6252 | }, | |
6253 | ||
6254 | /** | |
6255 | * Converts serialized ciphertext to CipherParams, | |
6256 | * else assumed CipherParams already and returns ciphertext unchanged. | |
6257 | * | |
6258 | * @param {CipherParams|string} ciphertext The ciphertext. | |
6259 | * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. | |
6260 | * | |
6261 | * @return {CipherParams} The unserialized ciphertext. | |
6262 | * | |
6263 | * @static | |
6264 | * | |
6265 | * @example | |
6266 | * | |
6267 | * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); | |
6268 | */ | |
6269 | _parse: function (ciphertext, format) { | |
6270 | if (typeof ciphertext == 'string') { | |
6271 | return format.parse(ciphertext, this); | |
6272 | } else { | |
6273 | return ciphertext; | |
6274 | } | |
6275 | } | |
6276 | }); | |
6277 | ||
6278 | /** | |
6279 | * Key derivation function namespace. | |
6280 | */ | |
6281 | var C_kdf = C.kdf = {}; | |
6282 | ||
6283 | /** | |
6284 | * OpenSSL key derivation function. | |
6285 | */ | |
6286 | var OpenSSLKdf = C_kdf.OpenSSL = { | |
6287 | /** | |
6288 | * Derives a key and IV from a password. | |
6289 | * | |
6290 | * @param {string} password The password to derive from. | |
6291 | * @param {number} keySize The size in words of the key to generate. | |
6292 | * @param {number} ivSize The size in words of the IV to generate. | |
6293 | * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. | |
6294 | * | |
6295 | * @return {CipherParams} A cipher params object with the key, IV, and salt. | |
6296 | * | |
6297 | * @static | |
6298 | * | |
6299 | * @example | |
6300 | * | |
6301 | * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); | |
6302 | * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); | |
6303 | */ | |
6304 | execute: function (password, keySize, ivSize, salt) { | |
6305 | // Generate random salt | |
6306 | if (!salt) { | |
6307 | salt = WordArray.random(64/8); | |
6308 | } | |
6309 | ||
6310 | // Derive key and IV | |
6311 | var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt); | |
6312 | ||
6313 | // Separate key and IV | |
6314 | var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); | |
6315 | key.sigBytes = keySize * 4; | |
6316 | ||
6317 | // Return params | |
6318 | return CipherParams.create({ key: key, iv: iv, salt: salt }); | |
6319 | } | |
6320 | }; | |
6321 | ||
6322 | /** | |
6323 | * A serializable cipher wrapper that derives the key from a password, | |
6324 | * and returns ciphertext as a serializable cipher params object. | |
6325 | */ | |
6326 | var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ | |
6327 | /** | |
6328 | * Configuration options. | |
6329 | * | |
6330 | * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL | |
6331 | */ | |
6332 | cfg: SerializableCipher.cfg.extend({ | |
6333 | kdf: OpenSSLKdf | |
6334 | }), | |
6335 | ||
6336 | /** | |
6337 | * Encrypts a message using a password. | |
6338 | * | |
6339 | * @param {Cipher} cipher The cipher algorithm to use. | |
6340 | * @param {WordArray|string} message The message to encrypt. | |
6341 | * @param {string} password The password. | |
6342 | * @param {Object} cfg (Optional) The configuration options to use for this operation. | |
6343 | * | |
6344 | * @return {CipherParams} A cipher params object. | |
6345 | * | |
6346 | * @static | |
6347 | * | |
6348 | * @example | |
6349 | * | |
6350 | * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); | |
6351 | * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); | |
6352 | */ | |
6353 | encrypt: function (cipher, message, password, cfg) { | |
6354 | // Apply config defaults | |
6355 | cfg = this.cfg.extend(cfg); | |
6356 | ||
6357 | // Derive key and other params | |
6358 | var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); | |
6359 | ||
6360 | // Add IV to config | |
6361 | cfg.iv = derivedParams.iv; | |
6362 | ||
6363 | // Encrypt | |
6364 | var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); | |
6365 | ||
6366 | // Mix in derived params | |
6367 | ciphertext.mixIn(derivedParams); | |
6368 | ||
6369 | return ciphertext; | |
6370 | }, | |
6371 | ||
6372 | /** | |
6373 | * Decrypts serialized ciphertext using a password. | |
6374 | * | |
6375 | * @param {Cipher} cipher The cipher algorithm to use. | |
6376 | * @param {CipherParams|string} ciphertext The ciphertext to decrypt. | |
6377 | * @param {string} password The password. | |
6378 | * @param {Object} cfg (Optional) The configuration options to use for this operation. | |
6379 | * | |
6380 | * @return {WordArray} The plaintext. | |
6381 | * | |
6382 | * @static | |
6383 | * | |
6384 | * @example | |
6385 | * | |
6386 | * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); | |
6387 | * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); | |
6388 | */ | |
6389 | decrypt: function (cipher, ciphertext, password, cfg) { | |
6390 | // Apply config defaults | |
6391 | cfg = this.cfg.extend(cfg); | |
6392 | ||
6393 | // Convert string to CipherParams | |
6394 | ciphertext = this._parse(ciphertext, cfg.format); | |
6395 | ||
6396 | // Derive key and other params | |
6397 | var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); | |
6398 | ||
6399 | // Add IV to config | |
6400 | cfg.iv = derivedParams.iv; | |
6401 | ||
6402 | // Decrypt | |
6403 | var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); | |
6404 | ||
6405 | return plaintext; | |
6406 | } | |
6407 | }); | |
6408 | }()); | |
6409 | ||
6410 | ||
6411 | })); | |
6412 | },{"./core":31}],31:[function(_dereq_,module,exports){ | |
6413 | ;(function (root, factory) { | |
6414 | if (typeof exports === "object") { | |
6415 | // CommonJS | |
6416 | module.exports = exports = factory(); | |
6417 | } | |
6418 | else if (typeof define === "function" && define.amd) { | |
6419 | // AMD | |
6420 | define([], factory); | |
6421 | } | |
6422 | else { | |
6423 | // Global (browser) | |
6424 | root.CryptoJS = factory(); | |
6425 | } | |
6426 | }(this, function () { | |
6427 | ||
6428 | /** | |
6429 | * CryptoJS core components. | |
6430 | */ | |
6431 | var CryptoJS = CryptoJS || (function (Math, undefined) { | |
6432 | /** | |
6433 | * CryptoJS namespace. | |
6434 | */ | |
6435 | var C = {}; | |
6436 | ||
6437 | /** | |
6438 | * Library namespace. | |
6439 | */ | |
6440 | var C_lib = C.lib = {}; | |
6441 | ||
6442 | /** | |
6443 | * Base object for prototypal inheritance. | |
6444 | */ | |
6445 | var Base = C_lib.Base = (function () { | |
6446 | function F() {} | |
6447 | ||
6448 | return { | |
6449 | /** | |
6450 | * Creates a new object that inherits from this object. | |
6451 | * | |
6452 | * @param {Object} overrides Properties to copy into the new object. | |
6453 | * | |
6454 | * @return {Object} The new object. | |
6455 | * | |
6456 | * @static | |
6457 | * | |
6458 | * @example | |
6459 | * | |
6460 | * var MyType = CryptoJS.lib.Base.extend({ | |
6461 | * field: 'value', | |
6462 | * | |
6463 | * method: function () { | |
6464 | * } | |
6465 | * }); | |
6466 | */ | |
6467 | extend: function (overrides) { | |
6468 | // Spawn | |
6469 | F.prototype = this; | |
6470 | var subtype = new F(); | |
6471 | ||
6472 | // Augment | |
6473 | if (overrides) { | |
6474 | subtype.mixIn(overrides); | |
6475 | } | |
6476 | ||
6477 | // Create default initializer | |
6478 | if (!subtype.hasOwnProperty('init')) { | |
6479 | subtype.init = function () { | |
6480 | subtype.$super.init.apply(this, arguments); | |
6481 | }; | |
6482 | } | |
6483 | ||
6484 | // Initializer's prototype is the subtype object | |
6485 | subtype.init.prototype = subtype; | |
6486 | ||
6487 | // Reference supertype | |
6488 | subtype.$super = this; | |
6489 | ||
6490 | return subtype; | |
6491 | }, | |
6492 | ||
6493 | /** | |
6494 | * Extends this object and runs the init method. | |
6495 | * Arguments to create() will be passed to init(). | |
6496 | * | |
6497 | * @return {Object} The new object. | |
6498 | * | |
6499 | * @static | |
6500 | * | |
6501 | * @example | |
6502 | * | |
6503 | * var instance = MyType.create(); | |
6504 | */ | |
6505 | create: function () { | |
6506 | var instance = this.extend(); | |
6507 | instance.init.apply(instance, arguments); | |
6508 | ||
6509 | return instance; | |
6510 | }, | |
6511 | ||
6512 | /** | |
6513 | * Initializes a newly created object. | |
6514 | * Override this method to add some logic when your objects are created. | |
6515 | * | |
6516 | * @example | |
6517 | * | |
6518 | * var MyType = CryptoJS.lib.Base.extend({ | |
6519 | * init: function () { | |
6520 | * // ... | |
6521 | * } | |
6522 | * }); | |
6523 | */ | |
6524 | init: function () { | |
6525 | }, | |
6526 | ||
6527 | /** | |
6528 | * Copies properties into this object. | |
6529 | * | |
6530 | * @param {Object} properties The properties to mix in. | |
6531 | * | |
6532 | * @example | |
6533 | * | |
6534 | * MyType.mixIn({ | |
6535 | * field: 'value' | |
6536 | * }); | |
6537 | */ | |
6538 | mixIn: function (properties) { | |
6539 | for (var propertyName in properties) { | |
6540 | if (properties.hasOwnProperty(propertyName)) { | |
6541 | this[propertyName] = properties[propertyName]; | |
6542 | } | |
6543 | } | |
6544 | ||
6545 | // IE won't copy toString using the loop above | |
6546 | if (properties.hasOwnProperty('toString')) { | |
6547 | this.toString = properties.toString; | |
6548 | } | |
6549 | }, | |
6550 | ||
6551 | /** | |
6552 | * Creates a copy of this object. | |
6553 | * | |
6554 | * @return {Object} The clone. | |
6555 | * | |
6556 | * @example | |
6557 | * | |
6558 | * var clone = instance.clone(); | |
6559 | */ | |
6560 | clone: function () { | |
6561 | return this.init.prototype.extend(this); | |
6562 | } | |
6563 | }; | |
6564 | }()); | |
6565 | ||
6566 | /** | |
6567 | * An array of 32-bit words. | |
6568 | * | |
6569 | * @property {Array} words The array of 32-bit words. | |
6570 | * @property {number} sigBytes The number of significant bytes in this word array. | |
6571 | */ | |
6572 | var WordArray = C_lib.WordArray = Base.extend({ | |
6573 | /** | |
6574 | * Initializes a newly created word array. | |
6575 | * | |
6576 | * @param {Array} words (Optional) An array of 32-bit words. | |
6577 | * @param {number} sigBytes (Optional) The number of significant bytes in the words. | |
6578 | * | |
6579 | * @example | |
6580 | * | |
6581 | * var wordArray = CryptoJS.lib.WordArray.create(); | |
6582 | * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); | |
6583 | * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); | |
6584 | */ | |
6585 | init: function (words, sigBytes) { | |
6586 | words = this.words = words || []; | |
6587 | ||
6588 | if (sigBytes != undefined) { | |
6589 | this.sigBytes = sigBytes; | |
6590 | } else { | |
6591 | this.sigBytes = words.length * 4; | |
6592 | } | |
6593 | }, | |
6594 | ||
6595 | /** | |
6596 | * Converts this word array to a string. | |
6597 | * | |
6598 | * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex | |
6599 | * | |
6600 | * @return {string} The stringified word array. | |
6601 | * | |
6602 | * @example | |
6603 | * | |
6604 | * var string = wordArray + ''; | |
6605 | * var string = wordArray.toString(); | |
6606 | * var string = wordArray.toString(CryptoJS.enc.Utf8); | |
6607 | */ | |
6608 | toString: function (encoder) { | |
6609 | return (encoder || Hex).stringify(this); | |
6610 | }, | |
6611 | ||
6612 | /** | |
6613 | * Concatenates a word array to this word array. | |
6614 | * | |
6615 | * @param {WordArray} wordArray The word array to append. | |
6616 | * | |
6617 | * @return {WordArray} This word array. | |
6618 | * | |
6619 | * @example | |
6620 | * | |
6621 | * wordArray1.concat(wordArray2); | |
6622 | */ | |
6623 | concat: function (wordArray) { | |
6624 | // Shortcuts | |
6625 | var thisWords = this.words; | |
6626 | var thatWords = wordArray.words; | |
6627 | var thisSigBytes = this.sigBytes; | |
6628 | var thatSigBytes = wordArray.sigBytes; | |
6629 | ||
6630 | // Clamp excess bits | |
6631 | this.clamp(); | |
6632 | ||
6633 | // Concat | |
6634 | if (thisSigBytes % 4) { | |
6635 | // Copy one byte at a time | |
6636 | for (var i = 0; i < thatSigBytes; i++) { | |
6637 | var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; | |
6638 | thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); | |
6639 | } | |
6640 | } else if (thatWords.length > 0xffff) { | |
6641 | // Copy one word at a time | |
6642 | for (var i = 0; i < thatSigBytes; i += 4) { | |
6643 | thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2]; | |
6644 | } | |
6645 | } else { | |
6646 | // Copy all words at once | |
6647 | thisWords.push.apply(thisWords, thatWords); | |
6648 | } | |
6649 | this.sigBytes += thatSigBytes; | |
6650 | ||
6651 | // Chainable | |
6652 | return this; | |
6653 | }, | |
6654 | ||
6655 | /** | |
6656 | * Removes insignificant bits. | |
6657 | * | |
6658 | * @example | |
6659 | * | |
6660 | * wordArray.clamp(); | |
6661 | */ | |
6662 | clamp: function () { | |
6663 | // Shortcuts | |
6664 | var words = this.words; | |
6665 | var sigBytes = this.sigBytes; | |
6666 | ||
6667 | // Clamp | |
6668 | words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); | |
6669 | words.length = Math.ceil(sigBytes / 4); | |
6670 | }, | |
6671 | ||
6672 | /** | |
6673 | * Creates a copy of this word array. | |
6674 | * | |
6675 | * @return {WordArray} The clone. | |
6676 | * | |
6677 | * @example | |
6678 | * | |
6679 | * var clone = wordArray.clone(); | |
6680 | */ | |
6681 | clone: function () { | |
6682 | var clone = Base.clone.call(this); | |
6683 | clone.words = this.words.slice(0); | |
6684 | ||
6685 | return clone; | |
6686 | }, | |
6687 | ||
6688 | /** | |
6689 | * Creates a word array filled with random bytes. | |
6690 | * | |
6691 | * @param {number} nBytes The number of random bytes to generate. | |
6692 | * | |
6693 | * @return {WordArray} The random word array. | |
6694 | * | |
6695 | * @static | |
6696 | * | |
6697 | * @example | |
6698 | * | |
6699 | * var wordArray = CryptoJS.lib.WordArray.random(16); | |
6700 | */ | |
6701 | random: function (nBytes) { | |
6702 | var words = []; | |
6703 | for (var i = 0; i < nBytes; i += 4) { | |
6704 | words.push((Math.random() * 0x100000000) | 0); | |
6705 | } | |
6706 | ||
6707 | return new WordArray.init(words, nBytes); | |
6708 | } | |
6709 | }); | |
6710 | ||
6711 | /** | |
6712 | * Encoder namespace. | |
6713 | */ | |
6714 | var C_enc = C.enc = {}; | |
6715 | ||
6716 | /** | |
6717 | * Hex encoding strategy. | |
6718 | */ | |
6719 | var Hex = C_enc.Hex = { | |
6720 | /** | |
6721 | * Converts a word array to a hex string. | |
6722 | * | |
6723 | * @param {WordArray} wordArray The word array. | |
6724 | * | |
6725 | * @return {string} The hex string. | |
6726 | * | |
6727 | * @static | |
6728 | * | |
6729 | * @example | |
6730 | * | |
6731 | * var hexString = CryptoJS.enc.Hex.stringify(wordArray); | |
6732 | */ | |
6733 | stringify: function (wordArray) { | |
6734 | // Shortcuts | |
6735 | var words = wordArray.words; | |
6736 | var sigBytes = wordArray.sigBytes; | |
6737 | ||
6738 | // Convert | |
6739 | var hexChars = []; | |
6740 | for (var i = 0; i < sigBytes; i++) { | |
6741 | var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; | |
6742 | hexChars.push((bite >>> 4).toString(16)); | |
6743 | hexChars.push((bite & 0x0f).toString(16)); | |
6744 | } | |
6745 | ||
6746 | return hexChars.join(''); | |
6747 | }, | |
6748 | ||
6749 | /** | |
6750 | * Converts a hex string to a word array. | |
6751 | * | |
6752 | * @param {string} hexStr The hex string. | |
6753 | * | |
6754 | * @return {WordArray} The word array. | |
6755 | * | |
6756 | * @static | |
6757 | * | |
6758 | * @example | |
6759 | * | |
6760 | * var wordArray = CryptoJS.enc.Hex.parse(hexString); | |
6761 | */ | |
6762 | parse: function (hexStr) { | |
6763 | // Shortcut | |
6764 | var hexStrLength = hexStr.length; | |
6765 | ||
6766 | // Convert | |
6767 | var words = []; | |
6768 | for (var i = 0; i < hexStrLength; i += 2) { | |
6769 | words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); | |
6770 | } | |
6771 | ||
6772 | return new WordArray.init(words, hexStrLength / 2); | |
6773 | } | |
6774 | }; | |
6775 | ||
6776 | /** | |
6777 | * Latin1 encoding strategy. | |
6778 | */ | |
6779 | var Latin1 = C_enc.Latin1 = { | |
6780 | /** | |
6781 | * Converts a word array to a Latin1 string. | |
6782 | * | |
6783 | * @param {WordArray} wordArray The word array. | |
6784 | * | |
6785 | * @return {string} The Latin1 string. | |
6786 | * | |
6787 | * @static | |
6788 | * | |
6789 | * @example | |
6790 | * | |
6791 | * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); | |
6792 | */ | |
6793 | stringify: function (wordArray) { | |
6794 | // Shortcuts | |
6795 | var words = wordArray.words; | |
6796 | var sigBytes = wordArray.sigBytes; | |
6797 | ||
6798 | // Convert | |
6799 | var latin1Chars = []; | |
6800 | for (var i = 0; i < sigBytes; i++) { | |
6801 | var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; | |
6802 | latin1Chars.push(String.fromCharCode(bite)); | |
6803 | } | |
6804 | ||
6805 | return latin1Chars.join(''); | |
6806 | }, | |
6807 | ||
6808 | /** | |
6809 | * Converts a Latin1 string to a word array. | |
6810 | * | |
6811 | * @param {string} latin1Str The Latin1 string. | |
6812 | * | |
6813 | * @return {WordArray} The word array. | |
6814 | * | |
6815 | * @static | |
6816 | * | |
6817 | * @example | |
6818 | * | |
6819 | * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); | |
6820 | */ | |
6821 | parse: function (latin1Str) { | |
6822 | // Shortcut | |
6823 | var latin1StrLength = latin1Str.length; | |
6824 | ||
6825 | // Convert | |
6826 | var words = []; | |
6827 | for (var i = 0; i < latin1StrLength; i++) { | |
6828 | words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); | |
6829 | } | |
6830 | ||
6831 | return new WordArray.init(words, latin1StrLength); | |
6832 | } | |
6833 | }; | |
6834 | ||
6835 | /** | |
6836 | * UTF-8 encoding strategy. | |
6837 | */ | |
6838 | var Utf8 = C_enc.Utf8 = { | |
6839 | /** | |
6840 | * Converts a word array to a UTF-8 string. | |
6841 | * | |
6842 | * @param {WordArray} wordArray The word array. | |
6843 | * | |
6844 | * @return {string} The UTF-8 string. | |
6845 | * | |
6846 | * @static | |
6847 | * | |
6848 | * @example | |
6849 | * | |
6850 | * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); | |
6851 | */ | |
6852 | stringify: function (wordArray) { | |
6853 | try { | |
6854 | return decodeURIComponent(escape(Latin1.stringify(wordArray))); | |
6855 | } catch (e) { | |
6856 | throw new Error('Malformed UTF-8 data'); | |
6857 | } | |
6858 | }, | |
6859 | ||
6860 | /** | |
6861 | * Converts a UTF-8 string to a word array. | |
6862 | * | |
6863 | * @param {string} utf8Str The UTF-8 string. | |
6864 | * | |
6865 | * @return {WordArray} The word array. | |
6866 | * | |
6867 | * @static | |
6868 | * | |
6869 | * @example | |
6870 | * | |
6871 | * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); | |
6872 | */ | |
6873 | parse: function (utf8Str) { | |
6874 | return Latin1.parse(unescape(encodeURIComponent(utf8Str))); | |
6875 | } | |
6876 | }; | |
6877 | ||
6878 | /** | |
6879 | * Abstract buffered block algorithm template. | |
6880 | * | |
6881 | * The property blockSize must be implemented in a concrete subtype. | |
6882 | * | |
6883 | * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 | |
6884 | */ | |
6885 | var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ | |
6886 | /** | |
6887 | * Resets this block algorithm's data buffer to its initial state. | |
6888 | * | |
6889 | * @example | |
6890 | * | |
6891 | * bufferedBlockAlgorithm.reset(); | |
6892 | */ | |
6893 | reset: function () { | |
6894 | // Initial values | |
6895 | this._data = new WordArray.init(); | |
6896 | this._nDataBytes = 0; | |
6897 | }, | |
6898 | ||
6899 | /** | |
6900 | * Adds new data to this block algorithm's buffer. | |
6901 | * | |
6902 | * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. | |
6903 | * | |
6904 | * @example | |
6905 | * | |
6906 | * bufferedBlockAlgorithm._append('data'); | |
6907 | * bufferedBlockAlgorithm._append(wordArray); | |
6908 | */ | |
6909 | _append: function (data) { | |
6910 | // Convert string to WordArray, else assume WordArray already | |
6911 | if (typeof data == 'string') { | |
6912 | data = Utf8.parse(data); | |
6913 | } | |
6914 | ||
6915 | // Append | |
6916 | this._data.concat(data); | |
6917 | this._nDataBytes += data.sigBytes; | |
6918 | }, | |
6919 | ||
6920 | /** | |
6921 | * Processes available data blocks. | |
6922 | * | |
6923 | * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. | |
6924 | * | |
6925 | * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. | |
6926 | * | |
6927 | * @return {WordArray} The processed data. | |
6928 | * | |
6929 | * @example | |
6930 | * | |
6931 | * var processedData = bufferedBlockAlgorithm._process(); | |
6932 | * var processedData = bufferedBlockAlgorithm._process(!!'flush'); | |
6933 | */ | |
6934 | _process: function (doFlush) { | |
6935 | // Shortcuts | |
6936 | var data = this._data; | |
6937 | var dataWords = data.words; | |
6938 | var dataSigBytes = data.sigBytes; | |
6939 | var blockSize = this.blockSize; | |
6940 | var blockSizeBytes = blockSize * 4; | |
6941 | ||
6942 | // Count blocks ready | |
6943 | var nBlocksReady = dataSigBytes / blockSizeBytes; | |
6944 | if (doFlush) { | |
6945 | // Round up to include partial blocks | |
6946 | nBlocksReady = Math.ceil(nBlocksReady); | |
6947 | } else { | |
6948 | // Round down to include only full blocks, | |
6949 | // less the number of blocks that must remain in the buffer | |
6950 | nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); | |
6951 | } | |
6952 | ||
6953 | // Count words ready | |
6954 | var nWordsReady = nBlocksReady * blockSize; | |
6955 | ||
6956 | // Count bytes ready | |
6957 | var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); | |
6958 | ||
6959 | // Process blocks | |
6960 | if (nWordsReady) { | |
6961 | for (var offset = 0; offset < nWordsReady; offset += blockSize) { | |
6962 | // Perform concrete-algorithm logic | |
6963 | this._doProcessBlock(dataWords, offset); | |
6964 | } | |
6965 | ||
6966 | // Remove processed words | |
6967 | var processedWords = dataWords.splice(0, nWordsReady); | |
6968 | data.sigBytes -= nBytesReady; | |
6969 | } | |
6970 | ||
6971 | // Return processed words | |
6972 | return new WordArray.init(processedWords, nBytesReady); | |
6973 | }, | |
6974 | ||
6975 | /** | |
6976 | * Creates a copy of this object. | |
6977 | * | |
6978 | * @return {Object} The clone. | |
6979 | * | |
6980 | * @example | |
6981 | * | |
6982 | * var clone = bufferedBlockAlgorithm.clone(); | |
6983 | */ | |
6984 | clone: function () { | |
6985 | var clone = Base.clone.call(this); | |
6986 | clone._data = this._data.clone(); | |
6987 | ||
6988 | return clone; | |
6989 | }, | |
6990 | ||
6991 | _minBufferSize: 0 | |
6992 | }); | |
6993 | ||
6994 | /** | |
6995 | * Abstract hasher template. | |
6996 | * | |
6997 | * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) | |
6998 | */ | |
6999 | var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ | |
7000 | /** | |
7001 | * Configuration options. | |
7002 | */ | |
7003 | cfg: Base.extend(), | |
7004 | ||
7005 | /** | |
7006 | * Initializes a newly created hasher. | |
7007 | * | |
7008 | * @param {Object} cfg (Optional) The configuration options to use for this hash computation. | |
7009 | * | |
7010 | * @example | |
7011 | * | |
7012 | * var hasher = CryptoJS.algo.SHA256.create(); | |
7013 | */ | |
7014 | init: function (cfg) { | |
7015 | // Apply config defaults | |
7016 | this.cfg = this.cfg.extend(cfg); | |
7017 | ||
7018 | // Set initial values | |
7019 | this.reset(); | |
7020 | }, | |
7021 | ||
7022 | /** | |
7023 | * Resets this hasher to its initial state. | |
7024 | * | |
7025 | * @example | |
7026 | * | |
7027 | * hasher.reset(); | |
7028 | */ | |
7029 | reset: function () { | |
7030 | // Reset data buffer | |
7031 | BufferedBlockAlgorithm.reset.call(this); | |
7032 | ||
7033 | // Perform concrete-hasher logic | |
7034 | this._doReset(); | |
7035 | }, | |
7036 | ||
7037 | /** | |
7038 | * Updates this hasher with a message. | |
7039 | * | |
7040 | * @param {WordArray|string} messageUpdate The message to append. | |
7041 | * | |
7042 | * @return {Hasher} This hasher. | |
7043 | * | |
7044 | * @example | |
7045 | * | |
7046 | * hasher.update('message'); | |
7047 | * hasher.update(wordArray); | |
7048 | */ | |
7049 | update: function (messageUpdate) { | |
7050 | // Append | |
7051 | this._append(messageUpdate); | |
7052 | ||
7053 | // Update the hash | |
7054 | this._process(); | |
7055 | ||
7056 | // Chainable | |
7057 | return this; | |
7058 | }, | |
7059 | ||
7060 | /** | |
7061 | * Finalizes the hash computation. | |
7062 | * Note that the finalize operation is effectively a destructive, read-once operation. | |
7063 | * | |
7064 | * @param {WordArray|string} messageUpdate (Optional) A final message update. | |
7065 | * | |
7066 | * @return {WordArray} The hash. | |
7067 | * | |
7068 | * @example | |
7069 | * | |
7070 | * var hash = hasher.finalize(); | |
7071 | * var hash = hasher.finalize('message'); | |
7072 | * var hash = hasher.finalize(wordArray); | |
7073 | */ | |
7074 | finalize: function (messageUpdate) { | |
7075 | // Final message update | |
7076 | if (messageUpdate) { | |
7077 | this._append(messageUpdate); | |
7078 | } | |
7079 | ||
7080 | // Perform concrete-hasher logic | |
7081 | var hash = this._doFinalize(); | |
7082 | ||
7083 | return hash; | |
7084 | }, | |
7085 | ||
7086 | blockSize: 512/32, | |
7087 | ||
7088 | /** | |
7089 | * Creates a shortcut function to a hasher's object interface. | |
7090 | * | |
7091 | * @param {Hasher} hasher The hasher to create a helper for. | |
7092 | * | |
7093 | * @return {Function} The shortcut function. | |
7094 | * | |
7095 | * @static | |
7096 | * | |
7097 | * @example | |
7098 | * | |
7099 | * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); | |
7100 | */ | |
7101 | _createHelper: function (hasher) { | |
7102 | return function (message, cfg) { | |
7103 | return new hasher.init(cfg).finalize(message); | |
7104 | }; | |
7105 | }, | |
7106 | ||
7107 | /** | |
7108 | * Creates a shortcut function to the HMAC's object interface. | |
7109 | * | |
7110 | * @param {Hasher} hasher The hasher to use in this HMAC helper. | |
7111 | * | |
7112 | * @return {Function} The shortcut function. | |
7113 | * | |
7114 | * @static | |
7115 | * | |
7116 | * @example | |
7117 | * | |
7118 | * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); | |
7119 | */ | |
7120 | _createHmacHelper: function (hasher) { | |
7121 | return function (message, key) { | |
7122 | return new C_algo.HMAC.init(hasher, key).finalize(message); | |
7123 | }; | |
7124 | } | |
7125 | }); | |
7126 | ||
7127 | /** | |
7128 | * Algorithm namespace. | |
7129 | */ | |
7130 | var C_algo = C.algo = {}; | |
7131 | ||
7132 | return C; | |
7133 | }(Math)); | |
7134 | ||
7135 | ||
7136 | return CryptoJS; | |
7137 | ||
7138 | })); | |
7139 | },{}],32:[function(_dereq_,module,exports){ | |
7140 | ;(function (root, factory) { | |
7141 | if (typeof exports === "object") { | |
7142 | // CommonJS | |
7143 | module.exports = exports = factory(_dereq_("./core")); | |
7144 | } | |
7145 | else if (typeof define === "function" && define.amd) { | |
7146 | // AMD | |
7147 | define(["./core"], factory); | |
7148 | } | |
7149 | else { | |
7150 | // Global (browser) | |
7151 | factory(root.CryptoJS); | |
7152 | } | |
7153 | }(this, function (CryptoJS) { | |
7154 | ||
7155 | (function () { | |
7156 | // Shortcuts | |
7157 | var C = CryptoJS; | |
7158 | var C_lib = C.lib; | |
7159 | var WordArray = C_lib.WordArray; | |
7160 | var C_enc = C.enc; | |
7161 | ||
7162 | /** | |
7163 | * Base64 encoding strategy. | |
7164 | */ | |
7165 | var Base64 = C_enc.Base64 = { | |
7166 | /** | |
7167 | * Converts a word array to a Base64 string. | |
7168 | * | |
7169 | * @param {WordArray} wordArray The word array. | |
7170 | * | |
7171 | * @return {string} The Base64 string. | |
7172 | * | |
7173 | * @static | |
7174 | * | |
7175 | * @example | |
7176 | * | |
7177 | * var base64String = CryptoJS.enc.Base64.stringify(wordArray); | |
7178 | */ | |
7179 | stringify: function (wordArray) { | |
7180 | // Shortcuts | |
7181 | var words = wordArray.words; | |
7182 | var sigBytes = wordArray.sigBytes; | |
7183 | var map = this._map; | |
7184 | ||
7185 | // Clamp excess bits | |
7186 | wordArray.clamp(); | |
7187 | ||
7188 | // Convert | |
7189 | var base64Chars = []; | |
7190 | for (var i = 0; i < sigBytes; i += 3) { | |
7191 | var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; | |
7192 | var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; | |
7193 | var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; | |
7194 | ||
7195 | var triplet = (byte1 << 16) | (byte2 << 8) | byte3; | |
7196 | ||
7197 | for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { | |
7198 | base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); | |
7199 | } | |
7200 | } | |
7201 | ||
7202 | // Add padding | |
7203 | var paddingChar = map.charAt(64); | |
7204 | if (paddingChar) { | |
7205 | while (base64Chars.length % 4) { | |
7206 | base64Chars.push(paddingChar); | |
7207 | } | |
7208 | } | |
7209 | ||
7210 | return base64Chars.join(''); | |
7211 | }, | |
7212 | ||
7213 | /** | |
7214 | * Converts a Base64 string to a word array. | |
7215 | * | |
7216 | * @param {string} base64Str The Base64 string. | |
7217 | * | |
7218 | * @return {WordArray} The word array. | |
7219 | * | |
7220 | * @static | |
7221 | * | |
7222 | * @example | |
7223 | * | |
7224 | * var wordArray = CryptoJS.enc.Base64.parse(base64String); | |
7225 | */ | |
7226 | parse: function (base64Str) { | |
7227 | // Shortcuts | |
7228 | var base64StrLength = base64Str.length; | |
7229 | var map = this._map; | |
7230 | ||
7231 | // Ignore padding | |
7232 | var paddingChar = map.charAt(64); | |
7233 | if (paddingChar) { | |
7234 | var paddingIndex = base64Str.indexOf(paddingChar); | |
7235 | if (paddingIndex != -1) { | |
7236 | base64StrLength = paddingIndex; | |
7237 | } | |
7238 | } | |
7239 | ||
7240 | // Convert | |
7241 | var words = []; | |
7242 | var nBytes = 0; | |
7243 | for (var i = 0; i < base64StrLength; i++) { | |
7244 | if (i % 4) { | |
7245 | var bits1 = map.indexOf(base64Str.charAt(i - 1)) << ((i % 4) * 2); | |
7246 | var bits2 = map.indexOf(base64Str.charAt(i)) >>> (6 - (i % 4) * 2); | |
7247 | words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8); | |
7248 | nBytes++; | |
7249 | } | |
7250 | } | |
7251 | ||
7252 | return WordArray.create(words, nBytes); | |
7253 | }, | |
7254 | ||
7255 | _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' | |
7256 | }; | |
7257 | }()); | |
7258 | ||
7259 | ||
7260 | return CryptoJS.enc.Base64; | |
7261 | ||
7262 | })); | |
7263 | },{"./core":31}],33:[function(_dereq_,module,exports){ | |
7264 | ;(function (root, factory) { | |
7265 | if (typeof exports === "object") { | |
7266 | // CommonJS | |
7267 | module.exports = exports = factory(_dereq_("./core")); | |
7268 | } | |
7269 | else if (typeof define === "function" && define.amd) { | |
7270 | // AMD | |
7271 | define(["./core"], factory); | |
7272 | } | |
7273 | else { | |
7274 | // Global (browser) | |
7275 | factory(root.CryptoJS); | |
7276 | } | |
7277 | }(this, function (CryptoJS) { | |
7278 | ||
7279 | (function () { | |
7280 | // Shortcuts | |
7281 | var C = CryptoJS; | |
7282 | var C_lib = C.lib; | |
7283 | var WordArray = C_lib.WordArray; | |
7284 | var C_enc = C.enc; | |
7285 | ||
7286 | /** | |
7287 | * UTF-16 BE encoding strategy. | |
7288 | */ | |
7289 | var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = { | |
7290 | /** | |
7291 | * Converts a word array to a UTF-16 BE string. | |
7292 | * | |
7293 | * @param {WordArray} wordArray The word array. | |
7294 | * | |
7295 | * @return {string} The UTF-16 BE string. | |
7296 | * | |
7297 | * @static | |
7298 | * | |
7299 | * @example | |
7300 | * | |
7301 | * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray); | |
7302 | */ | |
7303 | stringify: function (wordArray) { | |
7304 | // Shortcuts | |
7305 | var words = wordArray.words; | |
7306 | var sigBytes = wordArray.sigBytes; | |
7307 | ||
7308 | // Convert | |
7309 | var utf16Chars = []; | |
7310 | for (var i = 0; i < sigBytes; i += 2) { | |
7311 | var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff; | |
7312 | utf16Chars.push(String.fromCharCode(codePoint)); | |
7313 | } | |
7314 | ||
7315 | return utf16Chars.join(''); | |
7316 | }, | |
7317 | ||
7318 | /** | |
7319 | * Converts a UTF-16 BE string to a word array. | |
7320 | * | |
7321 | * @param {string} utf16Str The UTF-16 BE string. | |
7322 | * | |
7323 | * @return {WordArray} The word array. | |
7324 | * | |
7325 | * @static | |
7326 | * | |
7327 | * @example | |
7328 | * | |
7329 | * var wordArray = CryptoJS.enc.Utf16.parse(utf16String); | |
7330 | */ | |
7331 | parse: function (utf16Str) { | |
7332 | // Shortcut | |
7333 | var utf16StrLength = utf16Str.length; | |
7334 | ||
7335 | // Convert | |
7336 | var words = []; | |
7337 | for (var i = 0; i < utf16StrLength; i++) { | |
7338 | words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16); | |
7339 | } | |
7340 | ||
7341 | return WordArray.create(words, utf16StrLength * 2); | |
7342 | } | |
7343 | }; | |
7344 | ||
7345 | /** | |
7346 | * UTF-16 LE encoding strategy. | |
7347 | */ | |
7348 | C_enc.Utf16LE = { | |
7349 | /** | |
7350 | * Converts a word array to a UTF-16 LE string. | |
7351 | * | |
7352 | * @param {WordArray} wordArray The word array. | |
7353 | * | |
7354 | * @return {string} The UTF-16 LE string. | |
7355 | * | |
7356 | * @static | |
7357 | * | |
7358 | * @example | |
7359 | * | |
7360 | * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray); | |
7361 | */ | |
7362 | stringify: function (wordArray) { | |
7363 | // Shortcuts | |
7364 | var words = wordArray.words; | |
7365 | var sigBytes = wordArray.sigBytes; | |
7366 | ||
7367 | // Convert | |
7368 | var utf16Chars = []; | |
7369 | for (var i = 0; i < sigBytes; i += 2) { | |
7370 | var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff); | |
7371 | utf16Chars.push(String.fromCharCode(codePoint)); | |
7372 | } | |
7373 | ||
7374 | return utf16Chars.join(''); | |
7375 | }, | |
7376 | ||
7377 | /** | |
7378 | * Converts a UTF-16 LE string to a word array. | |
7379 | * | |
7380 | * @param {string} utf16Str The UTF-16 LE string. | |
7381 | * | |
7382 | * @return {WordArray} The word array. | |
7383 | * | |
7384 | * @static | |
7385 | * | |
7386 | * @example | |
7387 | * | |
7388 | * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str); | |
7389 | */ | |
7390 | parse: function (utf16Str) { | |
7391 | // Shortcut | |
7392 | var utf16StrLength = utf16Str.length; | |
7393 | ||
7394 | // Convert | |
7395 | var words = []; | |
7396 | for (var i = 0; i < utf16StrLength; i++) { | |
7397 | words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16)); | |
7398 | } | |
7399 | ||
7400 | return WordArray.create(words, utf16StrLength * 2); | |
7401 | } | |
7402 | }; | |
7403 | ||
7404 | function swapEndian(word) { | |
7405 | return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff); | |
7406 | } | |
7407 | }()); | |
7408 | ||
7409 | ||
7410 | return CryptoJS.enc.Utf16; | |
7411 | ||
7412 | })); | |
7413 | },{"./core":31}],34:[function(_dereq_,module,exports){ | |
7414 | ;(function (root, factory, undef) { | |
7415 | if (typeof exports === "object") { | |
7416 | // CommonJS | |
7417 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha1"), _dereq_("./hmac")); | |
7418 | } | |
7419 | else if (typeof define === "function" && define.amd) { | |
7420 | // AMD | |
7421 | define(["./core", "./sha1", "./hmac"], factory); | |
7422 | } | |
7423 | else { | |
7424 | // Global (browser) | |
7425 | factory(root.CryptoJS); | |
7426 | } | |
7427 | }(this, function (CryptoJS) { | |
7428 | ||
7429 | (function () { | |
7430 | // Shortcuts | |
7431 | var C = CryptoJS; | |
7432 | var C_lib = C.lib; | |
7433 | var Base = C_lib.Base; | |
7434 | var WordArray = C_lib.WordArray; | |
7435 | var C_algo = C.algo; | |
7436 | var MD5 = C_algo.MD5; | |
7437 | ||
7438 | /** | |
7439 | * This key derivation function is meant to conform with EVP_BytesToKey. | |
7440 | * www.openssl.org/docs/crypto/EVP_BytesToKey.html | |
7441 | */ | |
7442 | var EvpKDF = C_algo.EvpKDF = Base.extend({ | |
7443 | /** | |
7444 | * Configuration options. | |
7445 | * | |
7446 | * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) | |
7447 | * @property {Hasher} hasher The hash algorithm to use. Default: MD5 | |
7448 | * @property {number} iterations The number of iterations to perform. Default: 1 | |
7449 | */ | |
7450 | cfg: Base.extend({ | |
7451 | keySize: 128/32, | |
7452 | hasher: MD5, | |
7453 | iterations: 1 | |
7454 | }), | |
7455 | ||
7456 | /** | |
7457 | * Initializes a newly created key derivation function. | |
7458 | * | |
7459 | * @param {Object} cfg (Optional) The configuration options to use for the derivation. | |
7460 | * | |
7461 | * @example | |
7462 | * | |
7463 | * var kdf = CryptoJS.algo.EvpKDF.create(); | |
7464 | * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); | |
7465 | * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); | |
7466 | */ | |
7467 | init: function (cfg) { | |
7468 | this.cfg = this.cfg.extend(cfg); | |
7469 | }, | |
7470 | ||
7471 | /** | |
7472 | * Derives a key from a password. | |
7473 | * | |
7474 | * @param {WordArray|string} password The password. | |
7475 | * @param {WordArray|string} salt A salt. | |
7476 | * | |
7477 | * @return {WordArray} The derived key. | |
7478 | * | |
7479 | * @example | |
7480 | * | |
7481 | * var key = kdf.compute(password, salt); | |
7482 | */ | |
7483 | compute: function (password, salt) { | |
7484 | // Shortcut | |
7485 | var cfg = this.cfg; | |
7486 | ||
7487 | // Init hasher | |
7488 | var hasher = cfg.hasher.create(); | |
7489 | ||
7490 | // Initial values | |
7491 | var derivedKey = WordArray.create(); | |
7492 | ||
7493 | // Shortcuts | |
7494 | var derivedKeyWords = derivedKey.words; | |
7495 | var keySize = cfg.keySize; | |
7496 | var iterations = cfg.iterations; | |
7497 | ||
7498 | // Generate key | |
7499 | while (derivedKeyWords.length < keySize) { | |
7500 | if (block) { | |
7501 | hasher.update(block); | |
7502 | } | |
7503 | var block = hasher.update(password).finalize(salt); | |
7504 | hasher.reset(); | |
7505 | ||
7506 | // Iterations | |
7507 | for (var i = 1; i < iterations; i++) { | |
7508 | block = hasher.finalize(block); | |
7509 | hasher.reset(); | |
7510 | } | |
7511 | ||
7512 | derivedKey.concat(block); | |
7513 | } | |
7514 | derivedKey.sigBytes = keySize * 4; | |
7515 | ||
7516 | return derivedKey; | |
7517 | } | |
7518 | }); | |
7519 | ||
7520 | /** | |
7521 | * Derives a key from a password. | |
7522 | * | |
7523 | * @param {WordArray|string} password The password. | |
7524 | * @param {WordArray|string} salt A salt. | |
7525 | * @param {Object} cfg (Optional) The configuration options to use for this computation. | |
7526 | * | |
7527 | * @return {WordArray} The derived key. | |
7528 | * | |
7529 | * @static | |
7530 | * | |
7531 | * @example | |
7532 | * | |
7533 | * var key = CryptoJS.EvpKDF(password, salt); | |
7534 | * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); | |
7535 | * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); | |
7536 | */ | |
7537 | C.EvpKDF = function (password, salt, cfg) { | |
7538 | return EvpKDF.create(cfg).compute(password, salt); | |
7539 | }; | |
7540 | }()); | |
7541 | ||
7542 | ||
7543 | return CryptoJS.EvpKDF; | |
7544 | ||
7545 | })); | |
7546 | },{"./core":31,"./hmac":36,"./sha1":55}],35:[function(_dereq_,module,exports){ | |
7547 | ;(function (root, factory, undef) { | |
7548 | if (typeof exports === "object") { | |
7549 | // CommonJS | |
7550 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
7551 | } | |
7552 | else if (typeof define === "function" && define.amd) { | |
7553 | // AMD | |
7554 | define(["./core", "./cipher-core"], factory); | |
7555 | } | |
7556 | else { | |
7557 | // Global (browser) | |
7558 | factory(root.CryptoJS); | |
7559 | } | |
7560 | }(this, function (CryptoJS) { | |
7561 | ||
7562 | (function (undefined) { | |
7563 | // Shortcuts | |
7564 | var C = CryptoJS; | |
7565 | var C_lib = C.lib; | |
7566 | var CipherParams = C_lib.CipherParams; | |
7567 | var C_enc = C.enc; | |
7568 | var Hex = C_enc.Hex; | |
7569 | var C_format = C.format; | |
7570 | ||
7571 | var HexFormatter = C_format.Hex = { | |
7572 | /** | |
7573 | * Converts the ciphertext of a cipher params object to a hexadecimally encoded string. | |
7574 | * | |
7575 | * @param {CipherParams} cipherParams The cipher params object. | |
7576 | * | |
7577 | * @return {string} The hexadecimally encoded string. | |
7578 | * | |
7579 | * @static | |
7580 | * | |
7581 | * @example | |
7582 | * | |
7583 | * var hexString = CryptoJS.format.Hex.stringify(cipherParams); | |
7584 | */ | |
7585 | stringify: function (cipherParams) { | |
7586 | return cipherParams.ciphertext.toString(Hex); | |
7587 | }, | |
7588 | ||
7589 | /** | |
7590 | * Converts a hexadecimally encoded ciphertext string to a cipher params object. | |
7591 | * | |
7592 | * @param {string} input The hexadecimally encoded string. | |
7593 | * | |
7594 | * @return {CipherParams} The cipher params object. | |
7595 | * | |
7596 | * @static | |
7597 | * | |
7598 | * @example | |
7599 | * | |
7600 | * var cipherParams = CryptoJS.format.Hex.parse(hexString); | |
7601 | */ | |
7602 | parse: function (input) { | |
7603 | var ciphertext = Hex.parse(input); | |
7604 | return CipherParams.create({ ciphertext: ciphertext }); | |
7605 | } | |
7606 | }; | |
7607 | }()); | |
7608 | ||
7609 | ||
7610 | return CryptoJS.format.Hex; | |
7611 | ||
7612 | })); | |
7613 | },{"./cipher-core":30,"./core":31}],36:[function(_dereq_,module,exports){ | |
7614 | ;(function (root, factory) { | |
7615 | if (typeof exports === "object") { | |
7616 | // CommonJS | |
7617 | module.exports = exports = factory(_dereq_("./core")); | |
7618 | } | |
7619 | else if (typeof define === "function" && define.amd) { | |
7620 | // AMD | |
7621 | define(["./core"], factory); | |
7622 | } | |
7623 | else { | |
7624 | // Global (browser) | |
7625 | factory(root.CryptoJS); | |
7626 | } | |
7627 | }(this, function (CryptoJS) { | |
7628 | ||
7629 | (function () { | |
7630 | // Shortcuts | |
7631 | var C = CryptoJS; | |
7632 | var C_lib = C.lib; | |
7633 | var Base = C_lib.Base; | |
7634 | var C_enc = C.enc; | |
7635 | var Utf8 = C_enc.Utf8; | |
7636 | var C_algo = C.algo; | |
7637 | ||
7638 | /** | |
7639 | * HMAC algorithm. | |
7640 | */ | |
7641 | var HMAC = C_algo.HMAC = Base.extend({ | |
7642 | /** | |
7643 | * Initializes a newly created HMAC. | |
7644 | * | |
7645 | * @param {Hasher} hasher The hash algorithm to use. | |
7646 | * @param {WordArray|string} key The secret key. | |
7647 | * | |
7648 | * @example | |
7649 | * | |
7650 | * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); | |
7651 | */ | |
7652 | init: function (hasher, key) { | |
7653 | // Init hasher | |
7654 | hasher = this._hasher = new hasher.init(); | |
7655 | ||
7656 | // Convert string to WordArray, else assume WordArray already | |
7657 | if (typeof key == 'string') { | |
7658 | key = Utf8.parse(key); | |
7659 | } | |
7660 | ||
7661 | // Shortcuts | |
7662 | var hasherBlockSize = hasher.blockSize; | |
7663 | var hasherBlockSizeBytes = hasherBlockSize * 4; | |
7664 | ||
7665 | // Allow arbitrary length keys | |
7666 | if (key.sigBytes > hasherBlockSizeBytes) { | |
7667 | key = hasher.finalize(key); | |
7668 | } | |
7669 | ||
7670 | // Clamp excess bits | |
7671 | key.clamp(); | |
7672 | ||
7673 | // Clone key for inner and outer pads | |
7674 | var oKey = this._oKey = key.clone(); | |
7675 | var iKey = this._iKey = key.clone(); | |
7676 | ||
7677 | // Shortcuts | |
7678 | var oKeyWords = oKey.words; | |
7679 | var iKeyWords = iKey.words; | |
7680 | ||
7681 | // XOR keys with pad constants | |
7682 | for (var i = 0; i < hasherBlockSize; i++) { | |
7683 | oKeyWords[i] ^= 0x5c5c5c5c; | |
7684 | iKeyWords[i] ^= 0x36363636; | |
7685 | } | |
7686 | oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; | |
7687 | ||
7688 | // Set initial values | |
7689 | this.reset(); | |
7690 | }, | |
7691 | ||
7692 | /** | |
7693 | * Resets this HMAC to its initial state. | |
7694 | * | |
7695 | * @example | |
7696 | * | |
7697 | * hmacHasher.reset(); | |
7698 | */ | |
7699 | reset: function () { | |
7700 | // Shortcut | |
7701 | var hasher = this._hasher; | |
7702 | ||
7703 | // Reset | |
7704 | hasher.reset(); | |
7705 | hasher.update(this._iKey); | |
7706 | }, | |
7707 | ||
7708 | /** | |
7709 | * Updates this HMAC with a message. | |
7710 | * | |
7711 | * @param {WordArray|string} messageUpdate The message to append. | |
7712 | * | |
7713 | * @return {HMAC} This HMAC instance. | |
7714 | * | |
7715 | * @example | |
7716 | * | |
7717 | * hmacHasher.update('message'); | |
7718 | * hmacHasher.update(wordArray); | |
7719 | */ | |
7720 | update: function (messageUpdate) { | |
7721 | this._hasher.update(messageUpdate); | |
7722 | ||
7723 | // Chainable | |
7724 | return this; | |
7725 | }, | |
7726 | ||
7727 | /** | |
7728 | * Finalizes the HMAC computation. | |
7729 | * Note that the finalize operation is effectively a destructive, read-once operation. | |
7730 | * | |
7731 | * @param {WordArray|string} messageUpdate (Optional) A final message update. | |
7732 | * | |
7733 | * @return {WordArray} The HMAC. | |
7734 | * | |
7735 | * @example | |
7736 | * | |
7737 | * var hmac = hmacHasher.finalize(); | |
7738 | * var hmac = hmacHasher.finalize('message'); | |
7739 | * var hmac = hmacHasher.finalize(wordArray); | |
7740 | */ | |
7741 | finalize: function (messageUpdate) { | |
7742 | // Shortcut | |
7743 | var hasher = this._hasher; | |
7744 | ||
7745 | // Compute HMAC | |
7746 | var innerHash = hasher.finalize(messageUpdate); | |
7747 | hasher.reset(); | |
7748 | var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); | |
7749 | ||
7750 | return hmac; | |
7751 | } | |
7752 | }); | |
7753 | }()); | |
7754 | ||
7755 | ||
7756 | })); | |
7757 | },{"./core":31}],37:[function(_dereq_,module,exports){ | |
7758 | ;(function (root, factory, undef) { | |
7759 | if (typeof exports === "object") { | |
7760 | // CommonJS | |
7761 | 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")); | |
7762 | } | |
7763 | else if (typeof define === "function" && define.amd) { | |
7764 | // AMD | |
7765 | 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); | |
7766 | } | |
7767 | else { | |
7768 | // Global (browser) | |
7769 | factory(root.CryptoJS); | |
7770 | } | |
7771 | }(this, function (CryptoJS) { | |
7772 | ||
7773 | return CryptoJS; | |
7774 | ||
7775 | })); | |
7776 | },{"./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){ | |
7777 | ;(function (root, factory) { | |
7778 | if (typeof exports === "object") { | |
7779 | // CommonJS | |
7780 | module.exports = exports = factory(_dereq_("./core")); | |
7781 | } | |
7782 | else if (typeof define === "function" && define.amd) { | |
7783 | // AMD | |
7784 | define(["./core"], factory); | |
7785 | } | |
7786 | else { | |
7787 | // Global (browser) | |
7788 | factory(root.CryptoJS); | |
7789 | } | |
7790 | }(this, function (CryptoJS) { | |
7791 | ||
7792 | (function () { | |
7793 | // Check if typed arrays are supported | |
7794 | if (typeof ArrayBuffer != 'function') { | |
7795 | return; | |
7796 | } | |
7797 | ||
7798 | // Shortcuts | |
7799 | var C = CryptoJS; | |
7800 | var C_lib = C.lib; | |
7801 | var WordArray = C_lib.WordArray; | |
7802 | ||
7803 | // Reference original init | |
7804 | var superInit = WordArray.init; | |
7805 | ||
7806 | // Augment WordArray.init to handle typed arrays | |
7807 | var subInit = WordArray.init = function (typedArray) { | |
7808 | // Convert buffers to uint8 | |
7809 | if (typedArray instanceof ArrayBuffer) { | |
7810 | typedArray = new Uint8Array(typedArray); | |
7811 | } | |
7812 | ||
7813 | // Convert other array views to uint8 | |
7814 | if ( | |
7815 | typedArray instanceof Int8Array || | |
7816 | typedArray instanceof Uint8ClampedArray || | |
7817 | typedArray instanceof Int16Array || | |
7818 | typedArray instanceof Uint16Array || | |
7819 | typedArray instanceof Int32Array || | |
7820 | typedArray instanceof Uint32Array || | |
7821 | typedArray instanceof Float32Array || | |
7822 | typedArray instanceof Float64Array | |
7823 | ) { | |
7824 | typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength); | |
7825 | } | |
7826 | ||
7827 | // Handle Uint8Array | |
7828 | if (typedArray instanceof Uint8Array) { | |
7829 | // Shortcut | |
7830 | var typedArrayByteLength = typedArray.byteLength; | |
7831 | ||
7832 | // Extract bytes | |
7833 | var words = []; | |
7834 | for (var i = 0; i < typedArrayByteLength; i++) { | |
7835 | words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8); | |
7836 | } | |
7837 | ||
7838 | // Initialize this word array | |
7839 | superInit.call(this, words, typedArrayByteLength); | |
7840 | } else { | |
7841 | // Else call normal init | |
7842 | superInit.apply(this, arguments); | |
7843 | } | |
7844 | }; | |
7845 | ||
7846 | subInit.prototype = WordArray; | |
7847 | }()); | |
7848 | ||
7849 | ||
7850 | return CryptoJS.lib.WordArray; | |
7851 | ||
7852 | })); | |
7853 | },{"./core":31}],39:[function(_dereq_,module,exports){ | |
7854 | ;(function (root, factory) { | |
7855 | if (typeof exports === "object") { | |
7856 | // CommonJS | |
7857 | module.exports = exports = factory(_dereq_("./core")); | |
7858 | } | |
7859 | else if (typeof define === "function" && define.amd) { | |
7860 | // AMD | |
7861 | define(["./core"], factory); | |
7862 | } | |
7863 | else { | |
7864 | // Global (browser) | |
7865 | factory(root.CryptoJS); | |
7866 | } | |
7867 | }(this, function (CryptoJS) { | |
7868 | ||
7869 | (function (Math) { | |
7870 | // Shortcuts | |
7871 | var C = CryptoJS; | |
7872 | var C_lib = C.lib; | |
7873 | var WordArray = C_lib.WordArray; | |
7874 | var Hasher = C_lib.Hasher; | |
7875 | var C_algo = C.algo; | |
7876 | ||
7877 | // Constants table | |
7878 | var T = []; | |
7879 | ||
7880 | // Compute constants | |
7881 | (function () { | |
7882 | for (var i = 0; i < 64; i++) { | |
7883 | T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0; | |
7884 | } | |
7885 | }()); | |
7886 | ||
7887 | /** | |
7888 | * MD5 hash algorithm. | |
7889 | */ | |
7890 | var MD5 = C_algo.MD5 = Hasher.extend({ | |
7891 | _doReset: function () { | |
7892 | this._hash = new WordArray.init([ | |
7893 | 0x67452301, 0xefcdab89, | |
7894 | 0x98badcfe, 0x10325476 | |
7895 | ]); | |
7896 | }, | |
7897 | ||
7898 | _doProcessBlock: function (M, offset) { | |
7899 | // Swap endian | |
7900 | for (var i = 0; i < 16; i++) { | |
7901 | // Shortcuts | |
7902 | var offset_i = offset + i; | |
7903 | var M_offset_i = M[offset_i]; | |
7904 | ||
7905 | M[offset_i] = ( | |
7906 | (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | | |
7907 | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) | |
7908 | ); | |
7909 | } | |
7910 | ||
7911 | // Shortcuts | |
7912 | var H = this._hash.words; | |
7913 | ||
7914 | var M_offset_0 = M[offset + 0]; | |
7915 | var M_offset_1 = M[offset + 1]; | |
7916 | var M_offset_2 = M[offset + 2]; | |
7917 | var M_offset_3 = M[offset + 3]; | |
7918 | var M_offset_4 = M[offset + 4]; | |
7919 | var M_offset_5 = M[offset + 5]; | |
7920 | var M_offset_6 = M[offset + 6]; | |
7921 | var M_offset_7 = M[offset + 7]; | |
7922 | var M_offset_8 = M[offset + 8]; | |
7923 | var M_offset_9 = M[offset + 9]; | |
7924 | var M_offset_10 = M[offset + 10]; | |
7925 | var M_offset_11 = M[offset + 11]; | |
7926 | var M_offset_12 = M[offset + 12]; | |
7927 | var M_offset_13 = M[offset + 13]; | |
7928 | var M_offset_14 = M[offset + 14]; | |
7929 | var M_offset_15 = M[offset + 15]; | |
7930 | ||
7931 | // Working varialbes | |
7932 | var a = H[0]; | |
7933 | var b = H[1]; | |
7934 | var c = H[2]; | |
7935 | var d = H[3]; | |
7936 | ||
7937 | // Computation | |
7938 | a = FF(a, b, c, d, M_offset_0, 7, T[0]); | |
7939 | d = FF(d, a, b, c, M_offset_1, 12, T[1]); | |
7940 | c = FF(c, d, a, b, M_offset_2, 17, T[2]); | |
7941 | b = FF(b, c, d, a, M_offset_3, 22, T[3]); | |
7942 | a = FF(a, b, c, d, M_offset_4, 7, T[4]); | |
7943 | d = FF(d, a, b, c, M_offset_5, 12, T[5]); | |
7944 | c = FF(c, d, a, b, M_offset_6, 17, T[6]); | |
7945 | b = FF(b, c, d, a, M_offset_7, 22, T[7]); | |
7946 | a = FF(a, b, c, d, M_offset_8, 7, T[8]); | |
7947 | d = FF(d, a, b, c, M_offset_9, 12, T[9]); | |
7948 | c = FF(c, d, a, b, M_offset_10, 17, T[10]); | |
7949 | b = FF(b, c, d, a, M_offset_11, 22, T[11]); | |
7950 | a = FF(a, b, c, d, M_offset_12, 7, T[12]); | |
7951 | d = FF(d, a, b, c, M_offset_13, 12, T[13]); | |
7952 | c = FF(c, d, a, b, M_offset_14, 17, T[14]); | |
7953 | b = FF(b, c, d, a, M_offset_15, 22, T[15]); | |
7954 | ||
7955 | a = GG(a, b, c, d, M_offset_1, 5, T[16]); | |
7956 | d = GG(d, a, b, c, M_offset_6, 9, T[17]); | |
7957 | c = GG(c, d, a, b, M_offset_11, 14, T[18]); | |
7958 | b = GG(b, c, d, a, M_offset_0, 20, T[19]); | |
7959 | a = GG(a, b, c, d, M_offset_5, 5, T[20]); | |
7960 | d = GG(d, a, b, c, M_offset_10, 9, T[21]); | |
7961 | c = GG(c, d, a, b, M_offset_15, 14, T[22]); | |
7962 | b = GG(b, c, d, a, M_offset_4, 20, T[23]); | |
7963 | a = GG(a, b, c, d, M_offset_9, 5, T[24]); | |
7964 | d = GG(d, a, b, c, M_offset_14, 9, T[25]); | |
7965 | c = GG(c, d, a, b, M_offset_3, 14, T[26]); | |
7966 | b = GG(b, c, d, a, M_offset_8, 20, T[27]); | |
7967 | a = GG(a, b, c, d, M_offset_13, 5, T[28]); | |
7968 | d = GG(d, a, b, c, M_offset_2, 9, T[29]); | |
7969 | c = GG(c, d, a, b, M_offset_7, 14, T[30]); | |
7970 | b = GG(b, c, d, a, M_offset_12, 20, T[31]); | |
7971 | ||
7972 | a = HH(a, b, c, d, M_offset_5, 4, T[32]); | |
7973 | d = HH(d, a, b, c, M_offset_8, 11, T[33]); | |
7974 | c = HH(c, d, a, b, M_offset_11, 16, T[34]); | |
7975 | b = HH(b, c, d, a, M_offset_14, 23, T[35]); | |
7976 | a = HH(a, b, c, d, M_offset_1, 4, T[36]); | |
7977 | d = HH(d, a, b, c, M_offset_4, 11, T[37]); | |
7978 | c = HH(c, d, a, b, M_offset_7, 16, T[38]); | |
7979 | b = HH(b, c, d, a, M_offset_10, 23, T[39]); | |
7980 | a = HH(a, b, c, d, M_offset_13, 4, T[40]); | |
7981 | d = HH(d, a, b, c, M_offset_0, 11, T[41]); | |
7982 | c = HH(c, d, a, b, M_offset_3, 16, T[42]); | |
7983 | b = HH(b, c, d, a, M_offset_6, 23, T[43]); | |
7984 | a = HH(a, b, c, d, M_offset_9, 4, T[44]); | |
7985 | d = HH(d, a, b, c, M_offset_12, 11, T[45]); | |
7986 | c = HH(c, d, a, b, M_offset_15, 16, T[46]); | |
7987 | b = HH(b, c, d, a, M_offset_2, 23, T[47]); | |
7988 | ||
7989 | a = II(a, b, c, d, M_offset_0, 6, T[48]); | |
7990 | d = II(d, a, b, c, M_offset_7, 10, T[49]); | |
7991 | c = II(c, d, a, b, M_offset_14, 15, T[50]); | |
7992 | b = II(b, c, d, a, M_offset_5, 21, T[51]); | |
7993 | a = II(a, b, c, d, M_offset_12, 6, T[52]); | |
7994 | d = II(d, a, b, c, M_offset_3, 10, T[53]); | |
7995 | c = II(c, d, a, b, M_offset_10, 15, T[54]); | |
7996 | b = II(b, c, d, a, M_offset_1, 21, T[55]); | |
7997 | a = II(a, b, c, d, M_offset_8, 6, T[56]); | |
7998 | d = II(d, a, b, c, M_offset_15, 10, T[57]); | |
7999 | c = II(c, d, a, b, M_offset_6, 15, T[58]); | |
8000 | b = II(b, c, d, a, M_offset_13, 21, T[59]); | |
8001 | a = II(a, b, c, d, M_offset_4, 6, T[60]); | |
8002 | d = II(d, a, b, c, M_offset_11, 10, T[61]); | |
8003 | c = II(c, d, a, b, M_offset_2, 15, T[62]); | |
8004 | b = II(b, c, d, a, M_offset_9, 21, T[63]); | |
8005 | ||
8006 | // Intermediate hash value | |
8007 | H[0] = (H[0] + a) | 0; | |
8008 | H[1] = (H[1] + b) | 0; | |
8009 | H[2] = (H[2] + c) | 0; | |
8010 | H[3] = (H[3] + d) | 0; | |
8011 | }, | |
8012 | ||
8013 | _doFinalize: function () { | |
8014 | // Shortcuts | |
8015 | var data = this._data; | |
8016 | var dataWords = data.words; | |
8017 | ||
8018 | var nBitsTotal = this._nDataBytes * 8; | |
8019 | var nBitsLeft = data.sigBytes * 8; | |
8020 | ||
8021 | // Add padding | |
8022 | dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); | |
8023 | ||
8024 | var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); | |
8025 | var nBitsTotalL = nBitsTotal; | |
8026 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = ( | |
8027 | (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | | |
8028 | (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00) | |
8029 | ); | |
8030 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( | |
8031 | (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | | |
8032 | (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00) | |
8033 | ); | |
8034 | ||
8035 | data.sigBytes = (dataWords.length + 1) * 4; | |
8036 | ||
8037 | // Hash final blocks | |
8038 | this._process(); | |
8039 | ||
8040 | // Shortcuts | |
8041 | var hash = this._hash; | |
8042 | var H = hash.words; | |
8043 | ||
8044 | // Swap endian | |
8045 | for (var i = 0; i < 4; i++) { | |
8046 | // Shortcut | |
8047 | var H_i = H[i]; | |
8048 | ||
8049 | H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | | |
8050 | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); | |
8051 | } | |
8052 | ||
8053 | // Return final computed hash | |
8054 | return hash; | |
8055 | }, | |
8056 | ||
8057 | clone: function () { | |
8058 | var clone = Hasher.clone.call(this); | |
8059 | clone._hash = this._hash.clone(); | |
8060 | ||
8061 | return clone; | |
8062 | } | |
8063 | }); | |
8064 | ||
8065 | function FF(a, b, c, d, x, s, t) { | |
8066 | var n = a + ((b & c) | (~b & d)) + x + t; | |
8067 | return ((n << s) | (n >>> (32 - s))) + b; | |
8068 | } | |
8069 | ||
8070 | function GG(a, b, c, d, x, s, t) { | |
8071 | var n = a + ((b & d) | (c & ~d)) + x + t; | |
8072 | return ((n << s) | (n >>> (32 - s))) + b; | |
8073 | } | |
8074 | ||
8075 | function HH(a, b, c, d, x, s, t) { | |
8076 | var n = a + (b ^ c ^ d) + x + t; | |
8077 | return ((n << s) | (n >>> (32 - s))) + b; | |
8078 | } | |
8079 | ||
8080 | function II(a, b, c, d, x, s, t) { | |
8081 | var n = a + (c ^ (b | ~d)) + x + t; | |
8082 | return ((n << s) | (n >>> (32 - s))) + b; | |
8083 | } | |
8084 | ||
8085 | /** | |
8086 | * Shortcut function to the hasher's object interface. | |
8087 | * | |
8088 | * @param {WordArray|string} message The message to hash. | |
8089 | * | |
8090 | * @return {WordArray} The hash. | |
8091 | * | |
8092 | * @static | |
8093 | * | |
8094 | * @example | |
8095 | * | |
8096 | * var hash = CryptoJS.MD5('message'); | |
8097 | * var hash = CryptoJS.MD5(wordArray); | |
8098 | */ | |
8099 | C.MD5 = Hasher._createHelper(MD5); | |
8100 | ||
8101 | /** | |
8102 | * Shortcut function to the HMAC's object interface. | |
8103 | * | |
8104 | * @param {WordArray|string} message The message to hash. | |
8105 | * @param {WordArray|string} key The secret key. | |
8106 | * | |
8107 | * @return {WordArray} The HMAC. | |
8108 | * | |
8109 | * @static | |
8110 | * | |
8111 | * @example | |
8112 | * | |
8113 | * var hmac = CryptoJS.HmacMD5(message, key); | |
8114 | */ | |
8115 | C.HmacMD5 = Hasher._createHmacHelper(MD5); | |
8116 | }(Math)); | |
8117 | ||
8118 | ||
8119 | return CryptoJS.MD5; | |
8120 | ||
8121 | })); | |
8122 | },{"./core":31}],40:[function(_dereq_,module,exports){ | |
8123 | ;(function (root, factory, undef) { | |
8124 | if (typeof exports === "object") { | |
8125 | // CommonJS | |
8126 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8127 | } | |
8128 | else if (typeof define === "function" && define.amd) { | |
8129 | // AMD | |
8130 | define(["./core", "./cipher-core"], factory); | |
8131 | } | |
8132 | else { | |
8133 | // Global (browser) | |
8134 | factory(root.CryptoJS); | |
8135 | } | |
8136 | }(this, function (CryptoJS) { | |
8137 | ||
8138 | /** | |
8139 | * Cipher Feedback block mode. | |
8140 | */ | |
8141 | CryptoJS.mode.CFB = (function () { | |
8142 | var CFB = CryptoJS.lib.BlockCipherMode.extend(); | |
8143 | ||
8144 | CFB.Encryptor = CFB.extend({ | |
8145 | processBlock: function (words, offset) { | |
8146 | // Shortcuts | |
8147 | var cipher = this._cipher; | |
8148 | var blockSize = cipher.blockSize; | |
8149 | ||
8150 | generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); | |
8151 | ||
8152 | // Remember this block to use with next block | |
8153 | this._prevBlock = words.slice(offset, offset + blockSize); | |
8154 | } | |
8155 | }); | |
8156 | ||
8157 | CFB.Decryptor = CFB.extend({ | |
8158 | processBlock: function (words, offset) { | |
8159 | // Shortcuts | |
8160 | var cipher = this._cipher; | |
8161 | var blockSize = cipher.blockSize; | |
8162 | ||
8163 | // Remember this block to use with next block | |
8164 | var thisBlock = words.slice(offset, offset + blockSize); | |
8165 | ||
8166 | generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); | |
8167 | ||
8168 | // This block becomes the previous block | |
8169 | this._prevBlock = thisBlock; | |
8170 | } | |
8171 | }); | |
8172 | ||
8173 | function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) { | |
8174 | // Shortcut | |
8175 | var iv = this._iv; | |
8176 | ||
8177 | // Generate keystream | |
8178 | if (iv) { | |
8179 | var keystream = iv.slice(0); | |
8180 | ||
8181 | // Remove IV for subsequent blocks | |
8182 | this._iv = undefined; | |
8183 | } else { | |
8184 | var keystream = this._prevBlock; | |
8185 | } | |
8186 | cipher.encryptBlock(keystream, 0); | |
8187 | ||
8188 | // Encrypt | |
8189 | for (var i = 0; i < blockSize; i++) { | |
8190 | words[offset + i] ^= keystream[i]; | |
8191 | } | |
8192 | } | |
8193 | ||
8194 | return CFB; | |
8195 | }()); | |
8196 | ||
8197 | ||
8198 | return CryptoJS.mode.CFB; | |
8199 | ||
8200 | })); | |
8201 | },{"./cipher-core":30,"./core":31}],41:[function(_dereq_,module,exports){ | |
8202 | ;(function (root, factory, undef) { | |
8203 | if (typeof exports === "object") { | |
8204 | // CommonJS | |
8205 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8206 | } | |
8207 | else if (typeof define === "function" && define.amd) { | |
8208 | // AMD | |
8209 | define(["./core", "./cipher-core"], factory); | |
8210 | } | |
8211 | else { | |
8212 | // Global (browser) | |
8213 | factory(root.CryptoJS); | |
8214 | } | |
8215 | }(this, function (CryptoJS) { | |
8216 | ||
8217 | /** @preserve | |
8218 | * Counter block mode compatible with Dr Brian Gladman fileenc.c | |
8219 | * derived from CryptoJS.mode.CTR | |
8220 | * Jan Hruby jhruby.web@gmail.com | |
8221 | */ | |
8222 | CryptoJS.mode.CTRGladman = (function () { | |
8223 | var CTRGladman = CryptoJS.lib.BlockCipherMode.extend(); | |
8224 | ||
8225 | function incWord(word) | |
8226 | { | |
8227 | if (((word >> 24) & 0xff) === 0xff) { //overflow | |
8228 | var b1 = (word >> 16)&0xff; | |
8229 | var b2 = (word >> 8)&0xff; | |
8230 | var b3 = word & 0xff; | |
8231 | ||
8232 | if (b1 === 0xff) // overflow b1 | |
8233 | { | |
8234 | b1 = 0; | |
8235 | if (b2 === 0xff) | |
8236 | { | |
8237 | b2 = 0; | |
8238 | if (b3 === 0xff) | |
8239 | { | |
8240 | b3 = 0; | |
8241 | } | |
8242 | else | |
8243 | { | |
8244 | ++b3; | |
8245 | } | |
8246 | } | |
8247 | else | |
8248 | { | |
8249 | ++b2; | |
8250 | } | |
8251 | } | |
8252 | else | |
8253 | { | |
8254 | ++b1; | |
8255 | } | |
8256 | ||
8257 | word = 0; | |
8258 | word += (b1 << 16); | |
8259 | word += (b2 << 8); | |
8260 | word += b3; | |
8261 | } | |
8262 | else | |
8263 | { | |
8264 | word += (0x01 << 24); | |
8265 | } | |
8266 | return word; | |
8267 | } | |
8268 | ||
8269 | function incCounter(counter) | |
8270 | { | |
8271 | if ((counter[0] = incWord(counter[0])) === 0) | |
8272 | { | |
8273 | // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8 | |
8274 | counter[1] = incWord(counter[1]); | |
8275 | } | |
8276 | return counter; | |
8277 | } | |
8278 | ||
8279 | var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({ | |
8280 | processBlock: function (words, offset) { | |
8281 | // Shortcuts | |
8282 | var cipher = this._cipher | |
8283 | var blockSize = cipher.blockSize; | |
8284 | var iv = this._iv; | |
8285 | var counter = this._counter; | |
8286 | ||
8287 | // Generate keystream | |
8288 | if (iv) { | |
8289 | counter = this._counter = iv.slice(0); | |
8290 | ||
8291 | // Remove IV for subsequent blocks | |
8292 | this._iv = undefined; | |
8293 | } | |
8294 | ||
8295 | incCounter(counter); | |
8296 | ||
8297 | var keystream = counter.slice(0); | |
8298 | cipher.encryptBlock(keystream, 0); | |
8299 | ||
8300 | // Encrypt | |
8301 | for (var i = 0; i < blockSize; i++) { | |
8302 | words[offset + i] ^= keystream[i]; | |
8303 | } | |
8304 | } | |
8305 | }); | |
8306 | ||
8307 | CTRGladman.Decryptor = Encryptor; | |
8308 | ||
8309 | return CTRGladman; | |
8310 | }()); | |
8311 | ||
8312 | ||
8313 | ||
8314 | ||
8315 | return CryptoJS.mode.CTRGladman; | |
8316 | ||
8317 | })); | |
8318 | },{"./cipher-core":30,"./core":31}],42:[function(_dereq_,module,exports){ | |
8319 | ;(function (root, factory, undef) { | |
8320 | if (typeof exports === "object") { | |
8321 | // CommonJS | |
8322 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8323 | } | |
8324 | else if (typeof define === "function" && define.amd) { | |
8325 | // AMD | |
8326 | define(["./core", "./cipher-core"], factory); | |
8327 | } | |
8328 | else { | |
8329 | // Global (browser) | |
8330 | factory(root.CryptoJS); | |
8331 | } | |
8332 | }(this, function (CryptoJS) { | |
8333 | ||
8334 | /** | |
8335 | * Counter block mode. | |
8336 | */ | |
8337 | CryptoJS.mode.CTR = (function () { | |
8338 | var CTR = CryptoJS.lib.BlockCipherMode.extend(); | |
8339 | ||
8340 | var Encryptor = CTR.Encryptor = CTR.extend({ | |
8341 | processBlock: function (words, offset) { | |
8342 | // Shortcuts | |
8343 | var cipher = this._cipher | |
8344 | var blockSize = cipher.blockSize; | |
8345 | var iv = this._iv; | |
8346 | var counter = this._counter; | |
8347 | ||
8348 | // Generate keystream | |
8349 | if (iv) { | |
8350 | counter = this._counter = iv.slice(0); | |
8351 | ||
8352 | // Remove IV for subsequent blocks | |
8353 | this._iv = undefined; | |
8354 | } | |
8355 | var keystream = counter.slice(0); | |
8356 | cipher.encryptBlock(keystream, 0); | |
8357 | ||
8358 | // Increment counter | |
8359 | counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0 | |
8360 | ||
8361 | // Encrypt | |
8362 | for (var i = 0; i < blockSize; i++) { | |
8363 | words[offset + i] ^= keystream[i]; | |
8364 | } | |
8365 | } | |
8366 | }); | |
8367 | ||
8368 | CTR.Decryptor = Encryptor; | |
8369 | ||
8370 | return CTR; | |
8371 | }()); | |
8372 | ||
8373 | ||
8374 | return CryptoJS.mode.CTR; | |
8375 | ||
8376 | })); | |
8377 | },{"./cipher-core":30,"./core":31}],43:[function(_dereq_,module,exports){ | |
8378 | ;(function (root, factory, undef) { | |
8379 | if (typeof exports === "object") { | |
8380 | // CommonJS | |
8381 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8382 | } | |
8383 | else if (typeof define === "function" && define.amd) { | |
8384 | // AMD | |
8385 | define(["./core", "./cipher-core"], factory); | |
8386 | } | |
8387 | else { | |
8388 | // Global (browser) | |
8389 | factory(root.CryptoJS); | |
8390 | } | |
8391 | }(this, function (CryptoJS) { | |
8392 | ||
8393 | /** | |
8394 | * Electronic Codebook block mode. | |
8395 | */ | |
8396 | CryptoJS.mode.ECB = (function () { | |
8397 | var ECB = CryptoJS.lib.BlockCipherMode.extend(); | |
8398 | ||
8399 | ECB.Encryptor = ECB.extend({ | |
8400 | processBlock: function (words, offset) { | |
8401 | this._cipher.encryptBlock(words, offset); | |
8402 | } | |
8403 | }); | |
8404 | ||
8405 | ECB.Decryptor = ECB.extend({ | |
8406 | processBlock: function (words, offset) { | |
8407 | this._cipher.decryptBlock(words, offset); | |
8408 | } | |
8409 | }); | |
8410 | ||
8411 | return ECB; | |
8412 | }()); | |
8413 | ||
8414 | ||
8415 | return CryptoJS.mode.ECB; | |
8416 | ||
8417 | })); | |
8418 | },{"./cipher-core":30,"./core":31}],44:[function(_dereq_,module,exports){ | |
8419 | ;(function (root, factory, undef) { | |
8420 | if (typeof exports === "object") { | |
8421 | // CommonJS | |
8422 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8423 | } | |
8424 | else if (typeof define === "function" && define.amd) { | |
8425 | // AMD | |
8426 | define(["./core", "./cipher-core"], factory); | |
8427 | } | |
8428 | else { | |
8429 | // Global (browser) | |
8430 | factory(root.CryptoJS); | |
8431 | } | |
8432 | }(this, function (CryptoJS) { | |
8433 | ||
8434 | /** | |
8435 | * Output Feedback block mode. | |
8436 | */ | |
8437 | CryptoJS.mode.OFB = (function () { | |
8438 | var OFB = CryptoJS.lib.BlockCipherMode.extend(); | |
8439 | ||
8440 | var Encryptor = OFB.Encryptor = OFB.extend({ | |
8441 | processBlock: function (words, offset) { | |
8442 | // Shortcuts | |
8443 | var cipher = this._cipher | |
8444 | var blockSize = cipher.blockSize; | |
8445 | var iv = this._iv; | |
8446 | var keystream = this._keystream; | |
8447 | ||
8448 | // Generate keystream | |
8449 | if (iv) { | |
8450 | keystream = this._keystream = iv.slice(0); | |
8451 | ||
8452 | // Remove IV for subsequent blocks | |
8453 | this._iv = undefined; | |
8454 | } | |
8455 | cipher.encryptBlock(keystream, 0); | |
8456 | ||
8457 | // Encrypt | |
8458 | for (var i = 0; i < blockSize; i++) { | |
8459 | words[offset + i] ^= keystream[i]; | |
8460 | } | |
8461 | } | |
8462 | }); | |
8463 | ||
8464 | OFB.Decryptor = Encryptor; | |
8465 | ||
8466 | return OFB; | |
8467 | }()); | |
8468 | ||
8469 | ||
8470 | return CryptoJS.mode.OFB; | |
8471 | ||
8472 | })); | |
8473 | },{"./cipher-core":30,"./core":31}],45:[function(_dereq_,module,exports){ | |
8474 | ;(function (root, factory, undef) { | |
8475 | if (typeof exports === "object") { | |
8476 | // CommonJS | |
8477 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8478 | } | |
8479 | else if (typeof define === "function" && define.amd) { | |
8480 | // AMD | |
8481 | define(["./core", "./cipher-core"], factory); | |
8482 | } | |
8483 | else { | |
8484 | // Global (browser) | |
8485 | factory(root.CryptoJS); | |
8486 | } | |
8487 | }(this, function (CryptoJS) { | |
8488 | ||
8489 | /** | |
8490 | * ANSI X.923 padding strategy. | |
8491 | */ | |
8492 | CryptoJS.pad.AnsiX923 = { | |
8493 | pad: function (data, blockSize) { | |
8494 | // Shortcuts | |
8495 | var dataSigBytes = data.sigBytes; | |
8496 | var blockSizeBytes = blockSize * 4; | |
8497 | ||
8498 | // Count padding bytes | |
8499 | var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes; | |
8500 | ||
8501 | // Compute last byte position | |
8502 | var lastBytePos = dataSigBytes + nPaddingBytes - 1; | |
8503 | ||
8504 | // Pad | |
8505 | data.clamp(); | |
8506 | data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8); | |
8507 | data.sigBytes += nPaddingBytes; | |
8508 | }, | |
8509 | ||
8510 | unpad: function (data) { | |
8511 | // Get number of padding bytes from last byte | |
8512 | var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; | |
8513 | ||
8514 | // Remove padding | |
8515 | data.sigBytes -= nPaddingBytes; | |
8516 | } | |
8517 | }; | |
8518 | ||
8519 | ||
8520 | return CryptoJS.pad.Ansix923; | |
8521 | ||
8522 | })); | |
8523 | },{"./cipher-core":30,"./core":31}],46:[function(_dereq_,module,exports){ | |
8524 | ;(function (root, factory, undef) { | |
8525 | if (typeof exports === "object") { | |
8526 | // CommonJS | |
8527 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8528 | } | |
8529 | else if (typeof define === "function" && define.amd) { | |
8530 | // AMD | |
8531 | define(["./core", "./cipher-core"], factory); | |
8532 | } | |
8533 | else { | |
8534 | // Global (browser) | |
8535 | factory(root.CryptoJS); | |
8536 | } | |
8537 | }(this, function (CryptoJS) { | |
8538 | ||
8539 | /** | |
8540 | * ISO 10126 padding strategy. | |
8541 | */ | |
8542 | CryptoJS.pad.Iso10126 = { | |
8543 | pad: function (data, blockSize) { | |
8544 | // Shortcut | |
8545 | var blockSizeBytes = blockSize * 4; | |
8546 | ||
8547 | // Count padding bytes | |
8548 | var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; | |
8549 | ||
8550 | // Pad | |
8551 | data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)). | |
8552 | concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1)); | |
8553 | }, | |
8554 | ||
8555 | unpad: function (data) { | |
8556 | // Get number of padding bytes from last byte | |
8557 | var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; | |
8558 | ||
8559 | // Remove padding | |
8560 | data.sigBytes -= nPaddingBytes; | |
8561 | } | |
8562 | }; | |
8563 | ||
8564 | ||
8565 | return CryptoJS.pad.Iso10126; | |
8566 | ||
8567 | })); | |
8568 | },{"./cipher-core":30,"./core":31}],47:[function(_dereq_,module,exports){ | |
8569 | ;(function (root, factory, undef) { | |
8570 | if (typeof exports === "object") { | |
8571 | // CommonJS | |
8572 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8573 | } | |
8574 | else if (typeof define === "function" && define.amd) { | |
8575 | // AMD | |
8576 | define(["./core", "./cipher-core"], factory); | |
8577 | } | |
8578 | else { | |
8579 | // Global (browser) | |
8580 | factory(root.CryptoJS); | |
8581 | } | |
8582 | }(this, function (CryptoJS) { | |
8583 | ||
8584 | /** | |
8585 | * ISO/IEC 9797-1 Padding Method 2. | |
8586 | */ | |
8587 | CryptoJS.pad.Iso97971 = { | |
8588 | pad: function (data, blockSize) { | |
8589 | // Add 0x80 byte | |
8590 | data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1)); | |
8591 | ||
8592 | // Zero pad the rest | |
8593 | CryptoJS.pad.ZeroPadding.pad(data, blockSize); | |
8594 | }, | |
8595 | ||
8596 | unpad: function (data) { | |
8597 | // Remove zero padding | |
8598 | CryptoJS.pad.ZeroPadding.unpad(data); | |
8599 | ||
8600 | // Remove one more byte -- the 0x80 byte | |
8601 | data.sigBytes--; | |
8602 | } | |
8603 | }; | |
8604 | ||
8605 | ||
8606 | return CryptoJS.pad.Iso97971; | |
8607 | ||
8608 | })); | |
8609 | },{"./cipher-core":30,"./core":31}],48:[function(_dereq_,module,exports){ | |
8610 | ;(function (root, factory, undef) { | |
8611 | if (typeof exports === "object") { | |
8612 | // CommonJS | |
8613 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8614 | } | |
8615 | else if (typeof define === "function" && define.amd) { | |
8616 | // AMD | |
8617 | define(["./core", "./cipher-core"], factory); | |
8618 | } | |
8619 | else { | |
8620 | // Global (browser) | |
8621 | factory(root.CryptoJS); | |
8622 | } | |
8623 | }(this, function (CryptoJS) { | |
8624 | ||
8625 | /** | |
8626 | * A noop padding strategy. | |
8627 | */ | |
8628 | CryptoJS.pad.NoPadding = { | |
8629 | pad: function () { | |
8630 | }, | |
8631 | ||
8632 | unpad: function () { | |
8633 | } | |
8634 | }; | |
8635 | ||
8636 | ||
8637 | return CryptoJS.pad.NoPadding; | |
8638 | ||
8639 | })); | |
8640 | },{"./cipher-core":30,"./core":31}],49:[function(_dereq_,module,exports){ | |
8641 | ;(function (root, factory, undef) { | |
8642 | if (typeof exports === "object") { | |
8643 | // CommonJS | |
8644 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); | |
8645 | } | |
8646 | else if (typeof define === "function" && define.amd) { | |
8647 | // AMD | |
8648 | define(["./core", "./cipher-core"], factory); | |
8649 | } | |
8650 | else { | |
8651 | // Global (browser) | |
8652 | factory(root.CryptoJS); | |
8653 | } | |
8654 | }(this, function (CryptoJS) { | |
8655 | ||
8656 | /** | |
8657 | * Zero padding strategy. | |
8658 | */ | |
8659 | CryptoJS.pad.ZeroPadding = { | |
8660 | pad: function (data, blockSize) { | |
8661 | // Shortcut | |
8662 | var blockSizeBytes = blockSize * 4; | |
8663 | ||
8664 | // Pad | |
8665 | data.clamp(); | |
8666 | data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes); | |
8667 | }, | |
8668 | ||
8669 | unpad: function (data) { | |
8670 | // Shortcut | |
8671 | var dataWords = data.words; | |
8672 | ||
8673 | // Unpad | |
8674 | var i = data.sigBytes - 1; | |
8675 | while (!((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) { | |
8676 | i--; | |
8677 | } | |
8678 | data.sigBytes = i + 1; | |
8679 | } | |
8680 | }; | |
8681 | ||
8682 | ||
8683 | return CryptoJS.pad.ZeroPadding; | |
8684 | ||
8685 | })); | |
8686 | },{"./cipher-core":30,"./core":31}],50:[function(_dereq_,module,exports){ | |
8687 | ;(function (root, factory, undef) { | |
8688 | if (typeof exports === "object") { | |
8689 | // CommonJS | |
8690 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha1"), _dereq_("./hmac")); | |
8691 | } | |
8692 | else if (typeof define === "function" && define.amd) { | |
8693 | // AMD | |
8694 | define(["./core", "./sha1", "./hmac"], factory); | |
8695 | } | |
8696 | else { | |
8697 | // Global (browser) | |
8698 | factory(root.CryptoJS); | |
8699 | } | |
8700 | }(this, function (CryptoJS) { | |
8701 | ||
8702 | (function () { | |
8703 | // Shortcuts | |
8704 | var C = CryptoJS; | |
8705 | var C_lib = C.lib; | |
8706 | var Base = C_lib.Base; | |
8707 | var WordArray = C_lib.WordArray; | |
8708 | var C_algo = C.algo; | |
8709 | var SHA1 = C_algo.SHA1; | |
8710 | var HMAC = C_algo.HMAC; | |
8711 | ||
8712 | /** | |
8713 | * Password-Based Key Derivation Function 2 algorithm. | |
8714 | */ | |
8715 | var PBKDF2 = C_algo.PBKDF2 = Base.extend({ | |
8716 | /** | |
8717 | * Configuration options. | |
8718 | * | |
8719 | * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) | |
8720 | * @property {Hasher} hasher The hasher to use. Default: SHA1 | |
8721 | * @property {number} iterations The number of iterations to perform. Default: 1 | |
8722 | */ | |
8723 | cfg: Base.extend({ | |
8724 | keySize: 128/32, | |
8725 | hasher: SHA1, | |
8726 | iterations: 1 | |
8727 | }), | |
8728 | ||
8729 | /** | |
8730 | * Initializes a newly created key derivation function. | |
8731 | * | |
8732 | * @param {Object} cfg (Optional) The configuration options to use for the derivation. | |
8733 | * | |
8734 | * @example | |
8735 | * | |
8736 | * var kdf = CryptoJS.algo.PBKDF2.create(); | |
8737 | * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 }); | |
8738 | * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 }); | |
8739 | */ | |
8740 | init: function (cfg) { | |
8741 | this.cfg = this.cfg.extend(cfg); | |
8742 | }, | |
8743 | ||
8744 | /** | |
8745 | * Computes the Password-Based Key Derivation Function 2. | |
8746 | * | |
8747 | * @param {WordArray|string} password The password. | |
8748 | * @param {WordArray|string} salt A salt. | |
8749 | * | |
8750 | * @return {WordArray} The derived key. | |
8751 | * | |
8752 | * @example | |
8753 | * | |
8754 | * var key = kdf.compute(password, salt); | |
8755 | */ | |
8756 | compute: function (password, salt) { | |
8757 | // Shortcut | |
8758 | var cfg = this.cfg; | |
8759 | ||
8760 | // Init HMAC | |
8761 | var hmac = HMAC.create(cfg.hasher, password); | |
8762 | ||
8763 | // Initial values | |
8764 | var derivedKey = WordArray.create(); | |
8765 | var blockIndex = WordArray.create([0x00000001]); | |
8766 | ||
8767 | // Shortcuts | |
8768 | var derivedKeyWords = derivedKey.words; | |
8769 | var blockIndexWords = blockIndex.words; | |
8770 | var keySize = cfg.keySize; | |
8771 | var iterations = cfg.iterations; | |
8772 | ||
8773 | // Generate key | |
8774 | while (derivedKeyWords.length < keySize) { | |
8775 | var block = hmac.update(salt).finalize(blockIndex); | |
8776 | hmac.reset(); | |
8777 | ||
8778 | // Shortcuts | |
8779 | var blockWords = block.words; | |
8780 | var blockWordsLength = blockWords.length; | |
8781 | ||
8782 | // Iterations | |
8783 | var intermediate = block; | |
8784 | for (var i = 1; i < iterations; i++) { | |
8785 | intermediate = hmac.finalize(intermediate); | |
8786 | hmac.reset(); | |
8787 | ||
8788 | // Shortcut | |
8789 | var intermediateWords = intermediate.words; | |
8790 | ||
8791 | // XOR intermediate with block | |
8792 | for (var j = 0; j < blockWordsLength; j++) { | |
8793 | blockWords[j] ^= intermediateWords[j]; | |
8794 | } | |
8795 | } | |
8796 | ||
8797 | derivedKey.concat(block); | |
8798 | blockIndexWords[0]++; | |
8799 | } | |
8800 | derivedKey.sigBytes = keySize * 4; | |
8801 | ||
8802 | return derivedKey; | |
8803 | } | |
8804 | }); | |
8805 | ||
8806 | /** | |
8807 | * Computes the Password-Based Key Derivation Function 2. | |
8808 | * | |
8809 | * @param {WordArray|string} password The password. | |
8810 | * @param {WordArray|string} salt A salt. | |
8811 | * @param {Object} cfg (Optional) The configuration options to use for this computation. | |
8812 | * | |
8813 | * @return {WordArray} The derived key. | |
8814 | * | |
8815 | * @static | |
8816 | * | |
8817 | * @example | |
8818 | * | |
8819 | * var key = CryptoJS.PBKDF2(password, salt); | |
8820 | * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 }); | |
8821 | * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 }); | |
8822 | */ | |
8823 | C.PBKDF2 = function (password, salt, cfg) { | |
8824 | return PBKDF2.create(cfg).compute(password, salt); | |
8825 | }; | |
8826 | }()); | |
8827 | ||
8828 | ||
8829 | return CryptoJS.PBKDF2; | |
8830 | ||
8831 | })); | |
8832 | },{"./core":31,"./hmac":36,"./sha1":55}],51:[function(_dereq_,module,exports){ | |
8833 | ;(function (root, factory, undef) { | |
8834 | if (typeof exports === "object") { | |
8835 | // CommonJS | |
8836 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); | |
8837 | } | |
8838 | else if (typeof define === "function" && define.amd) { | |
8839 | // AMD | |
8840 | define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); | |
8841 | } | |
8842 | else { | |
8843 | // Global (browser) | |
8844 | factory(root.CryptoJS); | |
8845 | } | |
8846 | }(this, function (CryptoJS) { | |
8847 | ||
8848 | (function () { | |
8849 | // Shortcuts | |
8850 | var C = CryptoJS; | |
8851 | var C_lib = C.lib; | |
8852 | var StreamCipher = C_lib.StreamCipher; | |
8853 | var C_algo = C.algo; | |
8854 | ||
8855 | // Reusable objects | |
8856 | var S = []; | |
8857 | var C_ = []; | |
8858 | var G = []; | |
8859 | ||
8860 | /** | |
8861 | * Rabbit stream cipher algorithm. | |
8862 | * | |
8863 | * This is a legacy version that neglected to convert the key to little-endian. | |
8864 | * This error doesn't affect the cipher's security, | |
8865 | * but it does affect its compatibility with other implementations. | |
8866 | */ | |
8867 | var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({ | |
8868 | _doReset: function () { | |
8869 | // Shortcuts | |
8870 | var K = this._key.words; | |
8871 | var iv = this.cfg.iv; | |
8872 | ||
8873 | // Generate initial state values | |
8874 | var X = this._X = [ | |
8875 | K[0], (K[3] << 16) | (K[2] >>> 16), | |
8876 | K[1], (K[0] << 16) | (K[3] >>> 16), | |
8877 | K[2], (K[1] << 16) | (K[0] >>> 16), | |
8878 | K[3], (K[2] << 16) | (K[1] >>> 16) | |
8879 | ]; | |
8880 | ||
8881 | // Generate initial counter values | |
8882 | var C = this._C = [ | |
8883 | (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), | |
8884 | (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), | |
8885 | (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), | |
8886 | (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) | |
8887 | ]; | |
8888 | ||
8889 | // Carry bit | |
8890 | this._b = 0; | |
8891 | ||
8892 | // Iterate the system four times | |
8893 | for (var i = 0; i < 4; i++) { | |
8894 | nextState.call(this); | |
8895 | } | |
8896 | ||
8897 | // Modify the counters | |
8898 | for (var i = 0; i < 8; i++) { | |
8899 | C[i] ^= X[(i + 4) & 7]; | |
8900 | } | |
8901 | ||
8902 | // IV setup | |
8903 | if (iv) { | |
8904 | // Shortcuts | |
8905 | var IV = iv.words; | |
8906 | var IV_0 = IV[0]; | |
8907 | var IV_1 = IV[1]; | |
8908 | ||
8909 | // Generate four subvectors | |
8910 | var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); | |
8911 | var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); | |
8912 | var i1 = (i0 >>> 16) | (i2 & 0xffff0000); | |
8913 | var i3 = (i2 << 16) | (i0 & 0x0000ffff); | |
8914 | ||
8915 | // Modify counter values | |
8916 | C[0] ^= i0; | |
8917 | C[1] ^= i1; | |
8918 | C[2] ^= i2; | |
8919 | C[3] ^= i3; | |
8920 | C[4] ^= i0; | |
8921 | C[5] ^= i1; | |
8922 | C[6] ^= i2; | |
8923 | C[7] ^= i3; | |
8924 | ||
8925 | // Iterate the system four times | |
8926 | for (var i = 0; i < 4; i++) { | |
8927 | nextState.call(this); | |
8928 | } | |
8929 | } | |
8930 | }, | |
8931 | ||
8932 | _doProcessBlock: function (M, offset) { | |
8933 | // Shortcut | |
8934 | var X = this._X; | |
8935 | ||
8936 | // Iterate the system | |
8937 | nextState.call(this); | |
8938 | ||
8939 | // Generate four keystream words | |
8940 | S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); | |
8941 | S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); | |
8942 | S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); | |
8943 | S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); | |
8944 | ||
8945 | for (var i = 0; i < 4; i++) { | |
8946 | // Swap endian | |
8947 | S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | | |
8948 | (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); | |
8949 | ||
8950 | // Encrypt | |
8951 | M[offset + i] ^= S[i]; | |
8952 | } | |
8953 | }, | |
8954 | ||
8955 | blockSize: 128/32, | |
8956 | ||
8957 | ivSize: 64/32 | |
8958 | }); | |
8959 | ||
8960 | function nextState() { | |
8961 | // Shortcuts | |
8962 | var X = this._X; | |
8963 | var C = this._C; | |
8964 | ||
8965 | // Save old counter values | |
8966 | for (var i = 0; i < 8; i++) { | |
8967 | C_[i] = C[i]; | |
8968 | } | |
8969 | ||
8970 | // Calculate new counter values | |
8971 | C[0] = (C[0] + 0x4d34d34d + this._b) | 0; | |
8972 | C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; | |
8973 | C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; | |
8974 | C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; | |
8975 | C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; | |
8976 | C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; | |
8977 | C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; | |
8978 | C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; | |
8979 | this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; | |
8980 | ||
8981 | // Calculate the g-values | |
8982 | for (var i = 0; i < 8; i++) { | |
8983 | var gx = X[i] + C[i]; | |
8984 | ||
8985 | // Construct high and low argument for squaring | |
8986 | var ga = gx & 0xffff; | |
8987 | var gb = gx >>> 16; | |
8988 | ||
8989 | // Calculate high and low result of squaring | |
8990 | var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; | |
8991 | var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); | |
8992 | ||
8993 | // High XOR low | |
8994 | G[i] = gh ^ gl; | |
8995 | } | |
8996 | ||
8997 | // Calculate new state values | |
8998 | X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; | |
8999 | X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; | |
9000 | X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; | |
9001 | X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; | |
9002 | X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; | |
9003 | X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; | |
9004 | X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; | |
9005 | X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; | |
9006 | } | |
9007 | ||
9008 | /** | |
9009 | * Shortcut functions to the cipher's object interface. | |
9010 | * | |
9011 | * @example | |
9012 | * | |
9013 | * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg); | |
9014 | * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg); | |
9015 | */ | |
9016 | C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy); | |
9017 | }()); | |
9018 | ||
9019 | ||
9020 | return CryptoJS.RabbitLegacy; | |
9021 | ||
9022 | })); | |
9023 | },{"./cipher-core":30,"./core":31,"./enc-base64":32,"./evpkdf":34,"./md5":39}],52:[function(_dereq_,module,exports){ | |
9024 | ;(function (root, factory, undef) { | |
9025 | if (typeof exports === "object") { | |
9026 | // CommonJS | |
9027 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); | |
9028 | } | |
9029 | else if (typeof define === "function" && define.amd) { | |
9030 | // AMD | |
9031 | define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); | |
9032 | } | |
9033 | else { | |
9034 | // Global (browser) | |
9035 | factory(root.CryptoJS); | |
9036 | } | |
9037 | }(this, function (CryptoJS) { | |
9038 | ||
9039 | (function () { | |
9040 | // Shortcuts | |
9041 | var C = CryptoJS; | |
9042 | var C_lib = C.lib; | |
9043 | var StreamCipher = C_lib.StreamCipher; | |
9044 | var C_algo = C.algo; | |
9045 | ||
9046 | // Reusable objects | |
9047 | var S = []; | |
9048 | var C_ = []; | |
9049 | var G = []; | |
9050 | ||
9051 | /** | |
9052 | * Rabbit stream cipher algorithm | |
9053 | */ | |
9054 | var Rabbit = C_algo.Rabbit = StreamCipher.extend({ | |
9055 | _doReset: function () { | |
9056 | // Shortcuts | |
9057 | var K = this._key.words; | |
9058 | var iv = this.cfg.iv; | |
9059 | ||
9060 | // Swap endian | |
9061 | for (var i = 0; i < 4; i++) { | |
9062 | K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) | | |
9063 | (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00); | |
9064 | } | |
9065 | ||
9066 | // Generate initial state values | |
9067 | var X = this._X = [ | |
9068 | K[0], (K[3] << 16) | (K[2] >>> 16), | |
9069 | K[1], (K[0] << 16) | (K[3] >>> 16), | |
9070 | K[2], (K[1] << 16) | (K[0] >>> 16), | |
9071 | K[3], (K[2] << 16) | (K[1] >>> 16) | |
9072 | ]; | |
9073 | ||
9074 | // Generate initial counter values | |
9075 | var C = this._C = [ | |
9076 | (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), | |
9077 | (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), | |
9078 | (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), | |
9079 | (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) | |
9080 | ]; | |
9081 | ||
9082 | // Carry bit | |
9083 | this._b = 0; | |
9084 | ||
9085 | // Iterate the system four times | |
9086 | for (var i = 0; i < 4; i++) { | |
9087 | nextState.call(this); | |
9088 | } | |
9089 | ||
9090 | // Modify the counters | |
9091 | for (var i = 0; i < 8; i++) { | |
9092 | C[i] ^= X[(i + 4) & 7]; | |
9093 | } | |
9094 | ||
9095 | // IV setup | |
9096 | if (iv) { | |
9097 | // Shortcuts | |
9098 | var IV = iv.words; | |
9099 | var IV_0 = IV[0]; | |
9100 | var IV_1 = IV[1]; | |
9101 | ||
9102 | // Generate four subvectors | |
9103 | var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); | |
9104 | var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); | |
9105 | var i1 = (i0 >>> 16) | (i2 & 0xffff0000); | |
9106 | var i3 = (i2 << 16) | (i0 & 0x0000ffff); | |
9107 | ||
9108 | // Modify counter values | |
9109 | C[0] ^= i0; | |
9110 | C[1] ^= i1; | |
9111 | C[2] ^= i2; | |
9112 | C[3] ^= i3; | |
9113 | C[4] ^= i0; | |
9114 | C[5] ^= i1; | |
9115 | C[6] ^= i2; | |
9116 | C[7] ^= i3; | |
9117 | ||
9118 | // Iterate the system four times | |
9119 | for (var i = 0; i < 4; i++) { | |
9120 | nextState.call(this); | |
9121 | } | |
9122 | } | |
9123 | }, | |
9124 | ||
9125 | _doProcessBlock: function (M, offset) { | |
9126 | // Shortcut | |
9127 | var X = this._X; | |
9128 | ||
9129 | // Iterate the system | |
9130 | nextState.call(this); | |
9131 | ||
9132 | // Generate four keystream words | |
9133 | S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); | |
9134 | S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); | |
9135 | S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); | |
9136 | S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); | |
9137 | ||
9138 | for (var i = 0; i < 4; i++) { | |
9139 | // Swap endian | |
9140 | S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | | |
9141 | (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); | |
9142 | ||
9143 | // Encrypt | |
9144 | M[offset + i] ^= S[i]; | |
9145 | } | |
9146 | }, | |
9147 | ||
9148 | blockSize: 128/32, | |
9149 | ||
9150 | ivSize: 64/32 | |
9151 | }); | |
9152 | ||
9153 | function nextState() { | |
9154 | // Shortcuts | |
9155 | var X = this._X; | |
9156 | var C = this._C; | |
9157 | ||
9158 | // Save old counter values | |
9159 | for (var i = 0; i < 8; i++) { | |
9160 | C_[i] = C[i]; | |
9161 | } | |
9162 | ||
9163 | // Calculate new counter values | |
9164 | C[0] = (C[0] + 0x4d34d34d + this._b) | 0; | |
9165 | C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; | |
9166 | C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; | |
9167 | C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; | |
9168 | C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; | |
9169 | C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; | |
9170 | C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; | |
9171 | C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; | |
9172 | this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; | |
9173 | ||
9174 | // Calculate the g-values | |
9175 | for (var i = 0; i < 8; i++) { | |
9176 | var gx = X[i] + C[i]; | |
9177 | ||
9178 | // Construct high and low argument for squaring | |
9179 | var ga = gx & 0xffff; | |
9180 | var gb = gx >>> 16; | |
9181 | ||
9182 | // Calculate high and low result of squaring | |
9183 | var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; | |
9184 | var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); | |
9185 | ||
9186 | // High XOR low | |
9187 | G[i] = gh ^ gl; | |
9188 | } | |
9189 | ||
9190 | // Calculate new state values | |
9191 | X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; | |
9192 | X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; | |
9193 | X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; | |
9194 | X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; | |
9195 | X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; | |
9196 | X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; | |
9197 | X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; | |
9198 | X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; | |
9199 | } | |
9200 | ||
9201 | /** | |
9202 | * Shortcut functions to the cipher's object interface. | |
9203 | * | |
9204 | * @example | |
9205 | * | |
9206 | * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg); | |
9207 | * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg); | |
9208 | */ | |
9209 | C.Rabbit = StreamCipher._createHelper(Rabbit); | |
9210 | }()); | |
9211 | ||
9212 | ||
9213 | return CryptoJS.Rabbit; | |
9214 | ||
9215 | })); | |
9216 | },{"./cipher-core":30,"./core":31,"./enc-base64":32,"./evpkdf":34,"./md5":39}],53:[function(_dereq_,module,exports){ | |
9217 | ;(function (root, factory, undef) { | |
9218 | if (typeof exports === "object") { | |
9219 | // CommonJS | |
9220 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); | |
9221 | } | |
9222 | else if (typeof define === "function" && define.amd) { | |
9223 | // AMD | |
9224 | define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); | |
9225 | } | |
9226 | else { | |
9227 | // Global (browser) | |
9228 | factory(root.CryptoJS); | |
9229 | } | |
9230 | }(this, function (CryptoJS) { | |
9231 | ||
9232 | (function () { | |
9233 | // Shortcuts | |
9234 | var C = CryptoJS; | |
9235 | var C_lib = C.lib; | |
9236 | var StreamCipher = C_lib.StreamCipher; | |
9237 | var C_algo = C.algo; | |
9238 | ||
9239 | /** | |
9240 | * RC4 stream cipher algorithm. | |
9241 | */ | |
9242 | var RC4 = C_algo.RC4 = StreamCipher.extend({ | |
9243 | _doReset: function () { | |
9244 | // Shortcuts | |
9245 | var key = this._key; | |
9246 | var keyWords = key.words; | |
9247 | var keySigBytes = key.sigBytes; | |
9248 | ||
9249 | // Init sbox | |
9250 | var S = this._S = []; | |
9251 | for (var i = 0; i < 256; i++) { | |
9252 | S[i] = i; | |
9253 | } | |
9254 | ||
9255 | // Key setup | |
9256 | for (var i = 0, j = 0; i < 256; i++) { | |
9257 | var keyByteIndex = i % keySigBytes; | |
9258 | var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff; | |
9259 | ||
9260 | j = (j + S[i] + keyByte) % 256; | |
9261 | ||
9262 | // Swap | |
9263 | var t = S[i]; | |
9264 | S[i] = S[j]; | |
9265 | S[j] = t; | |
9266 | } | |
9267 | ||
9268 | // Counters | |
9269 | this._i = this._j = 0; | |
9270 | }, | |
9271 | ||
9272 | _doProcessBlock: function (M, offset) { | |
9273 | M[offset] ^= generateKeystreamWord.call(this); | |
9274 | }, | |
9275 | ||
9276 | keySize: 256/32, | |
9277 | ||
9278 | ivSize: 0 | |
9279 | }); | |
9280 | ||
9281 | function generateKeystreamWord() { | |
9282 | // Shortcuts | |
9283 | var S = this._S; | |
9284 | var i = this._i; | |
9285 | var j = this._j; | |
9286 | ||
9287 | // Generate keystream word | |
9288 | var keystreamWord = 0; | |
9289 | for (var n = 0; n < 4; n++) { | |
9290 | i = (i + 1) % 256; | |
9291 | j = (j + S[i]) % 256; | |
9292 | ||
9293 | // Swap | |
9294 | var t = S[i]; | |
9295 | S[i] = S[j]; | |
9296 | S[j] = t; | |
9297 | ||
9298 | keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8); | |
9299 | } | |
9300 | ||
9301 | // Update counters | |
9302 | this._i = i; | |
9303 | this._j = j; | |
9304 | ||
9305 | return keystreamWord; | |
9306 | } | |
9307 | ||
9308 | /** | |
9309 | * Shortcut functions to the cipher's object interface. | |
9310 | * | |
9311 | * @example | |
9312 | * | |
9313 | * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg); | |
9314 | * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg); | |
9315 | */ | |
9316 | C.RC4 = StreamCipher._createHelper(RC4); | |
9317 | ||
9318 | /** | |
9319 | * Modified RC4 stream cipher algorithm. | |
9320 | */ | |
9321 | var RC4Drop = C_algo.RC4Drop = RC4.extend({ | |
9322 | /** | |
9323 | * Configuration options. | |
9324 | * | |
9325 | * @property {number} drop The number of keystream words to drop. Default 192 | |
9326 | */ | |
9327 | cfg: RC4.cfg.extend({ | |
9328 | drop: 192 | |
9329 | }), | |
9330 | ||
9331 | _doReset: function () { | |
9332 | RC4._doReset.call(this); | |
9333 | ||
9334 | // Drop | |
9335 | for (var i = this.cfg.drop; i > 0; i--) { | |
9336 | generateKeystreamWord.call(this); | |
9337 | } | |
9338 | } | |
9339 | }); | |
9340 | ||
9341 | /** | |
9342 | * Shortcut functions to the cipher's object interface. | |
9343 | * | |
9344 | * @example | |
9345 | * | |
9346 | * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg); | |
9347 | * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg); | |
9348 | */ | |
9349 | C.RC4Drop = StreamCipher._createHelper(RC4Drop); | |
9350 | }()); | |
9351 | ||
9352 | ||
9353 | return CryptoJS.RC4; | |
9354 | ||
9355 | })); | |
9356 | },{"./cipher-core":30,"./core":31,"./enc-base64":32,"./evpkdf":34,"./md5":39}],54:[function(_dereq_,module,exports){ | |
9357 | ;(function (root, factory) { | |
9358 | if (typeof exports === "object") { | |
9359 | // CommonJS | |
9360 | module.exports = exports = factory(_dereq_("./core")); | |
9361 | } | |
9362 | else if (typeof define === "function" && define.amd) { | |
9363 | // AMD | |
9364 | define(["./core"], factory); | |
9365 | } | |
9366 | else { | |
9367 | // Global (browser) | |
9368 | factory(root.CryptoJS); | |
9369 | } | |
9370 | }(this, function (CryptoJS) { | |
9371 | ||
9372 | /** @preserve | |
9373 | (c) 2012 by Cédric Mesnil. All rights reserved. | |
9374 | ||
9375 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |
9376 | ||
9377 | - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |
9378 | - 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. | |
9379 | ||
9380 | 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. | |
9381 | */ | |
9382 | ||
9383 | (function (Math) { | |
9384 | // Shortcuts | |
9385 | var C = CryptoJS; | |
9386 | var C_lib = C.lib; | |
9387 | var WordArray = C_lib.WordArray; | |
9388 | var Hasher = C_lib.Hasher; | |
9389 | var C_algo = C.algo; | |
9390 | ||
9391 | // Constants table | |
9392 | var _zl = WordArray.create([ | |
9393 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | |
9394 | 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, | |
9395 | 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, | |
9396 | 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, | |
9397 | 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]); | |
9398 | var _zr = WordArray.create([ | |
9399 | 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, | |
9400 | 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, | |
9401 | 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, | |
9402 | 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, | |
9403 | 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]); | |
9404 | var _sl = WordArray.create([ | |
9405 | 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, | |
9406 | 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, | |
9407 | 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, | |
9408 | 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, | |
9409 | 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]); | |
9410 | var _sr = WordArray.create([ | |
9411 | 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, | |
9412 | 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, | |
9413 | 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, | |
9414 | 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, | |
9415 | 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]); | |
9416 | ||
9417 | var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]); | |
9418 | var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]); | |
9419 | ||
9420 | /** | |
9421 | * RIPEMD160 hash algorithm. | |
9422 | */ | |
9423 | var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({ | |
9424 | _doReset: function () { | |
9425 | this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]); | |
9426 | }, | |
9427 | ||
9428 | _doProcessBlock: function (M, offset) { | |
9429 | ||
9430 | // Swap endian | |
9431 | for (var i = 0; i < 16; i++) { | |
9432 | // Shortcuts | |
9433 | var offset_i = offset + i; | |
9434 | var M_offset_i = M[offset_i]; | |
9435 | ||
9436 | // Swap | |
9437 | M[offset_i] = ( | |
9438 | (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | | |
9439 | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) | |
9440 | ); | |
9441 | } | |
9442 | // Shortcut | |
9443 | var H = this._hash.words; | |
9444 | var hl = _hl.words; | |
9445 | var hr = _hr.words; | |
9446 | var zl = _zl.words; | |
9447 | var zr = _zr.words; | |
9448 | var sl = _sl.words; | |
9449 | var sr = _sr.words; | |
9450 | ||
9451 | // Working variables | |
9452 | var al, bl, cl, dl, el; | |
9453 | var ar, br, cr, dr, er; | |
9454 | ||
9455 | ar = al = H[0]; | |
9456 | br = bl = H[1]; | |
9457 | cr = cl = H[2]; | |
9458 | dr = dl = H[3]; | |
9459 | er = el = H[4]; | |
9460 | // Computation | |
9461 | var t; | |
9462 | for (var i = 0; i < 80; i += 1) { | |
9463 | t = (al + M[offset+zl[i]])|0; | |
9464 | if (i<16){ | |
9465 | t += f1(bl,cl,dl) + hl[0]; | |
9466 | } else if (i<32) { | |
9467 | t += f2(bl,cl,dl) + hl[1]; | |
9468 | } else if (i<48) { | |
9469 | t += f3(bl,cl,dl) + hl[2]; | |
9470 | } else if (i<64) { | |
9471 | t += f4(bl,cl,dl) + hl[3]; | |
9472 | } else {// if (i<80) { | |
9473 | t += f5(bl,cl,dl) + hl[4]; | |
9474 | } | |
9475 | t = t|0; | |
9476 | t = rotl(t,sl[i]); | |
9477 | t = (t+el)|0; | |
9478 | al = el; | |
9479 | el = dl; | |
9480 | dl = rotl(cl, 10); | |
9481 | cl = bl; | |
9482 | bl = t; | |
9483 | ||
9484 | t = (ar + M[offset+zr[i]])|0; | |
9485 | if (i<16){ | |
9486 | t += f5(br,cr,dr) + hr[0]; | |
9487 | } else if (i<32) { | |
9488 | t += f4(br,cr,dr) + hr[1]; | |
9489 | } else if (i<48) { | |
9490 | t += f3(br,cr,dr) + hr[2]; | |
9491 | } else if (i<64) { | |
9492 | t += f2(br,cr,dr) + hr[3]; | |
9493 | } else {// if (i<80) { | |
9494 | t += f1(br,cr,dr) + hr[4]; | |
9495 | } | |
9496 | t = t|0; | |
9497 | t = rotl(t,sr[i]) ; | |
9498 | t = (t+er)|0; | |
9499 | ar = er; | |
9500 | er = dr; | |
9501 | dr = rotl(cr, 10); | |
9502 | cr = br; | |
9503 | br = t; | |
9504 | } | |
9505 | // Intermediate hash value | |
9506 | t = (H[1] + cl + dr)|0; | |
9507 | H[1] = (H[2] + dl + er)|0; | |
9508 | H[2] = (H[3] + el + ar)|0; | |
9509 | H[3] = (H[4] + al + br)|0; | |
9510 | H[4] = (H[0] + bl + cr)|0; | |
9511 | H[0] = t; | |
9512 | }, | |
9513 | ||
9514 | _doFinalize: function () { | |
9515 | // Shortcuts | |
9516 | var data = this._data; | |
9517 | var dataWords = data.words; | |
9518 | ||
9519 | var nBitsTotal = this._nDataBytes * 8; | |
9520 | var nBitsLeft = data.sigBytes * 8; | |
9521 | ||
9522 | // Add padding | |
9523 | dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); | |
9524 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( | |
9525 | (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | | |
9526 | (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) | |
9527 | ); | |
9528 | data.sigBytes = (dataWords.length + 1) * 4; | |
9529 | ||
9530 | // Hash final blocks | |
9531 | this._process(); | |
9532 | ||
9533 | // Shortcuts | |
9534 | var hash = this._hash; | |
9535 | var H = hash.words; | |
9536 | ||
9537 | // Swap endian | |
9538 | for (var i = 0; i < 5; i++) { | |
9539 | // Shortcut | |
9540 | var H_i = H[i]; | |
9541 | ||
9542 | // Swap | |
9543 | H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | | |
9544 | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); | |
9545 | } | |
9546 | ||
9547 | // Return final computed hash | |
9548 | return hash; | |
9549 | }, | |
9550 | ||
9551 | clone: function () { | |
9552 | var clone = Hasher.clone.call(this); | |
9553 | clone._hash = this._hash.clone(); | |
9554 | ||
9555 | return clone; | |
9556 | } | |
9557 | }); | |
9558 | ||
9559 | ||
9560 | function f1(x, y, z) { | |
9561 | return ((x) ^ (y) ^ (z)); | |
9562 | ||
9563 | } | |
9564 | ||
9565 | function f2(x, y, z) { | |
9566 | return (((x)&(y)) | ((~x)&(z))); | |
9567 | } | |
9568 | ||
9569 | function f3(x, y, z) { | |
9570 | return (((x) | (~(y))) ^ (z)); | |
9571 | } | |
9572 | ||
9573 | function f4(x, y, z) { | |
9574 | return (((x) & (z)) | ((y)&(~(z)))); | |
9575 | } | |
9576 | ||
9577 | function f5(x, y, z) { | |
9578 | return ((x) ^ ((y) |(~(z)))); | |
9579 | ||
9580 | } | |
9581 | ||
9582 | function rotl(x,n) { | |
9583 | return (x<<n) | (x>>>(32-n)); | |
9584 | } | |
9585 | ||
9586 | ||
9587 | /** | |
9588 | * Shortcut function to the hasher's object interface. | |
9589 | * | |
9590 | * @param {WordArray|string} message The message to hash. | |
9591 | * | |
9592 | * @return {WordArray} The hash. | |
9593 | * | |
9594 | * @static | |
9595 | * | |
9596 | * @example | |
9597 | * | |
9598 | * var hash = CryptoJS.RIPEMD160('message'); | |
9599 | * var hash = CryptoJS.RIPEMD160(wordArray); | |
9600 | */ | |
9601 | C.RIPEMD160 = Hasher._createHelper(RIPEMD160); | |
9602 | ||
9603 | /** | |
9604 | * Shortcut function to the HMAC's object interface. | |
9605 | * | |
9606 | * @param {WordArray|string} message The message to hash. | |
9607 | * @param {WordArray|string} key The secret key. | |
9608 | * | |
9609 | * @return {WordArray} The HMAC. | |
9610 | * | |
9611 | * @static | |
9612 | * | |
9613 | * @example | |
9614 | * | |
9615 | * var hmac = CryptoJS.HmacRIPEMD160(message, key); | |
9616 | */ | |
9617 | C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160); | |
9618 | }(Math)); | |
9619 | ||
9620 | ||
9621 | return CryptoJS.RIPEMD160; | |
9622 | ||
9623 | })); | |
9624 | },{"./core":31}],55:[function(_dereq_,module,exports){ | |
9625 | ;(function (root, factory) { | |
9626 | if (typeof exports === "object") { | |
9627 | // CommonJS | |
9628 | module.exports = exports = factory(_dereq_("./core")); | |
9629 | } | |
9630 | else if (typeof define === "function" && define.amd) { | |
9631 | // AMD | |
9632 | define(["./core"], factory); | |
9633 | } | |
9634 | else { | |
9635 | // Global (browser) | |
9636 | factory(root.CryptoJS); | |
9637 | } | |
9638 | }(this, function (CryptoJS) { | |
9639 | ||
9640 | (function () { | |
9641 | // Shortcuts | |
9642 | var C = CryptoJS; | |
9643 | var C_lib = C.lib; | |
9644 | var WordArray = C_lib.WordArray; | |
9645 | var Hasher = C_lib.Hasher; | |
9646 | var C_algo = C.algo; | |
9647 | ||
9648 | // Reusable object | |
9649 | var W = []; | |
9650 | ||
9651 | /** | |
9652 | * SHA-1 hash algorithm. | |
9653 | */ | |
9654 | var SHA1 = C_algo.SHA1 = Hasher.extend({ | |
9655 | _doReset: function () { | |
9656 | this._hash = new WordArray.init([ | |
9657 | 0x67452301, 0xefcdab89, | |
9658 | 0x98badcfe, 0x10325476, | |
9659 | 0xc3d2e1f0 | |
9660 | ]); | |
9661 | }, | |
9662 | ||
9663 | _doProcessBlock: function (M, offset) { | |
9664 | // Shortcut | |
9665 | var H = this._hash.words; | |
9666 | ||
9667 | // Working variables | |
9668 | var a = H[0]; | |
9669 | var b = H[1]; | |
9670 | var c = H[2]; | |
9671 | var d = H[3]; | |
9672 | var e = H[4]; | |
9673 | ||
9674 | // Computation | |
9675 | for (var i = 0; i < 80; i++) { | |
9676 | if (i < 16) { | |
9677 | W[i] = M[offset + i] | 0; | |
9678 | } else { | |
9679 | var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; | |
9680 | W[i] = (n << 1) | (n >>> 31); | |
9681 | } | |
9682 | ||
9683 | var t = ((a << 5) | (a >>> 27)) + e + W[i]; | |
9684 | if (i < 20) { | |
9685 | t += ((b & c) | (~b & d)) + 0x5a827999; | |
9686 | } else if (i < 40) { | |
9687 | t += (b ^ c ^ d) + 0x6ed9eba1; | |
9688 | } else if (i < 60) { | |
9689 | t += ((b & c) | (b & d) | (c & d)) - 0x70e44324; | |
9690 | } else /* if (i < 80) */ { | |
9691 | t += (b ^ c ^ d) - 0x359d3e2a; | |
9692 | } | |
9693 | ||
9694 | e = d; | |
9695 | d = c; | |
9696 | c = (b << 30) | (b >>> 2); | |
9697 | b = a; | |
9698 | a = t; | |
9699 | } | |
9700 | ||
9701 | // Intermediate hash value | |
9702 | H[0] = (H[0] + a) | 0; | |
9703 | H[1] = (H[1] + b) | 0; | |
9704 | H[2] = (H[2] + c) | 0; | |
9705 | H[3] = (H[3] + d) | 0; | |
9706 | H[4] = (H[4] + e) | 0; | |
9707 | }, | |
9708 | ||
9709 | _doFinalize: function () { | |
9710 | // Shortcuts | |
9711 | var data = this._data; | |
9712 | var dataWords = data.words; | |
9713 | ||
9714 | var nBitsTotal = this._nDataBytes * 8; | |
9715 | var nBitsLeft = data.sigBytes * 8; | |
9716 | ||
9717 | // Add padding | |
9718 | dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); | |
9719 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); | |
9720 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; | |
9721 | data.sigBytes = dataWords.length * 4; | |
9722 | ||
9723 | // Hash final blocks | |
9724 | this._process(); | |
9725 | ||
9726 | // Return final computed hash | |
9727 | return this._hash; | |
9728 | }, | |
9729 | ||
9730 | clone: function () { | |
9731 | var clone = Hasher.clone.call(this); | |
9732 | clone._hash = this._hash.clone(); | |
9733 | ||
9734 | return clone; | |
9735 | } | |
9736 | }); | |
9737 | ||
9738 | /** | |
9739 | * Shortcut function to the hasher's object interface. | |
9740 | * | |
9741 | * @param {WordArray|string} message The message to hash. | |
9742 | * | |
9743 | * @return {WordArray} The hash. | |
9744 | * | |
9745 | * @static | |
9746 | * | |
9747 | * @example | |
9748 | * | |
9749 | * var hash = CryptoJS.SHA1('message'); | |
9750 | * var hash = CryptoJS.SHA1(wordArray); | |
9751 | */ | |
9752 | C.SHA1 = Hasher._createHelper(SHA1); | |
9753 | ||
9754 | /** | |
9755 | * Shortcut function to the HMAC's object interface. | |
9756 | * | |
9757 | * @param {WordArray|string} message The message to hash. | |
9758 | * @param {WordArray|string} key The secret key. | |
9759 | * | |
9760 | * @return {WordArray} The HMAC. | |
9761 | * | |
9762 | * @static | |
9763 | * | |
9764 | * @example | |
9765 | * | |
9766 | * var hmac = CryptoJS.HmacSHA1(message, key); | |
9767 | */ | |
9768 | C.HmacSHA1 = Hasher._createHmacHelper(SHA1); | |
9769 | }()); | |
9770 | ||
9771 | ||
9772 | return CryptoJS.SHA1; | |
9773 | ||
9774 | })); | |
9775 | },{"./core":31}],56:[function(_dereq_,module,exports){ | |
9776 | ;(function (root, factory, undef) { | |
9777 | if (typeof exports === "object") { | |
9778 | // CommonJS | |
9779 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha256")); | |
9780 | } | |
9781 | else if (typeof define === "function" && define.amd) { | |
9782 | // AMD | |
9783 | define(["./core", "./sha256"], factory); | |
9784 | } | |
9785 | else { | |
9786 | // Global (browser) | |
9787 | factory(root.CryptoJS); | |
9788 | } | |
9789 | }(this, function (CryptoJS) { | |
9790 | ||
9791 | (function () { | |
9792 | // Shortcuts | |
9793 | var C = CryptoJS; | |
9794 | var C_lib = C.lib; | |
9795 | var WordArray = C_lib.WordArray; | |
9796 | var C_algo = C.algo; | |
9797 | var SHA256 = C_algo.SHA256; | |
9798 | ||
9799 | /** | |
9800 | * SHA-224 hash algorithm. | |
9801 | */ | |
9802 | var SHA224 = C_algo.SHA224 = SHA256.extend({ | |
9803 | _doReset: function () { | |
9804 | this._hash = new WordArray.init([ | |
9805 | 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, | |
9806 | 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 | |
9807 | ]); | |
9808 | }, | |
9809 | ||
9810 | _doFinalize: function () { | |
9811 | var hash = SHA256._doFinalize.call(this); | |
9812 | ||
9813 | hash.sigBytes -= 4; | |
9814 | ||
9815 | return hash; | |
9816 | } | |
9817 | }); | |
9818 | ||
9819 | /** | |
9820 | * Shortcut function to the hasher's object interface. | |
9821 | * | |
9822 | * @param {WordArray|string} message The message to hash. | |
9823 | * | |
9824 | * @return {WordArray} The hash. | |
9825 | * | |
9826 | * @static | |
9827 | * | |
9828 | * @example | |
9829 | * | |
9830 | * var hash = CryptoJS.SHA224('message'); | |
9831 | * var hash = CryptoJS.SHA224(wordArray); | |
9832 | */ | |
9833 | C.SHA224 = SHA256._createHelper(SHA224); | |
9834 | ||
9835 | /** | |
9836 | * Shortcut function to the HMAC's object interface. | |
9837 | * | |
9838 | * @param {WordArray|string} message The message to hash. | |
9839 | * @param {WordArray|string} key The secret key. | |
9840 | * | |
9841 | * @return {WordArray} The HMAC. | |
9842 | * | |
9843 | * @static | |
9844 | * | |
9845 | * @example | |
9846 | * | |
9847 | * var hmac = CryptoJS.HmacSHA224(message, key); | |
9848 | */ | |
9849 | C.HmacSHA224 = SHA256._createHmacHelper(SHA224); | |
9850 | }()); | |
9851 | ||
9852 | ||
9853 | return CryptoJS.SHA224; | |
9854 | ||
9855 | })); | |
9856 | },{"./core":31,"./sha256":57}],57:[function(_dereq_,module,exports){ | |
9857 | ;(function (root, factory) { | |
9858 | if (typeof exports === "object") { | |
9859 | // CommonJS | |
9860 | module.exports = exports = factory(_dereq_("./core")); | |
9861 | } | |
9862 | else if (typeof define === "function" && define.amd) { | |
9863 | // AMD | |
9864 | define(["./core"], factory); | |
9865 | } | |
9866 | else { | |
9867 | // Global (browser) | |
9868 | factory(root.CryptoJS); | |
9869 | } | |
9870 | }(this, function (CryptoJS) { | |
9871 | ||
9872 | (function (Math) { | |
9873 | // Shortcuts | |
9874 | var C = CryptoJS; | |
9875 | var C_lib = C.lib; | |
9876 | var WordArray = C_lib.WordArray; | |
9877 | var Hasher = C_lib.Hasher; | |
9878 | var C_algo = C.algo; | |
9879 | ||
9880 | // Initialization and round constants tables | |
9881 | var H = []; | |
9882 | var K = []; | |
9883 | ||
9884 | // Compute constants | |
9885 | (function () { | |
9886 | function isPrime(n) { | |
9887 | var sqrtN = Math.sqrt(n); | |
9888 | for (var factor = 2; factor <= sqrtN; factor++) { | |
9889 | if (!(n % factor)) { | |
9890 | return false; | |
9891 | } | |
9892 | } | |
9893 | ||
9894 | return true; | |
9895 | } | |
9896 | ||
9897 | function getFractionalBits(n) { | |
9898 | return ((n - (n | 0)) * 0x100000000) | 0; | |
9899 | } | |
9900 | ||
9901 | var n = 2; | |
9902 | var nPrime = 0; | |
9903 | while (nPrime < 64) { | |
9904 | if (isPrime(n)) { | |
9905 | if (nPrime < 8) { | |
9906 | H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2)); | |
9907 | } | |
9908 | K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3)); | |
9909 | ||
9910 | nPrime++; | |
9911 | } | |
9912 | ||
9913 | n++; | |
9914 | } | |
9915 | }()); | |
9916 | ||
9917 | // Reusable object | |
9918 | var W = []; | |
9919 | ||
9920 | /** | |
9921 | * SHA-256 hash algorithm. | |
9922 | */ | |
9923 | var SHA256 = C_algo.SHA256 = Hasher.extend({ | |
9924 | _doReset: function () { | |
9925 | this._hash = new WordArray.init(H.slice(0)); | |
9926 | }, | |
9927 | ||
9928 | _doProcessBlock: function (M, offset) { | |
9929 | // Shortcut | |
9930 | var H = this._hash.words; | |
9931 | ||
9932 | // Working variables | |
9933 | var a = H[0]; | |
9934 | var b = H[1]; | |
9935 | var c = H[2]; | |
9936 | var d = H[3]; | |
9937 | var e = H[4]; | |
9938 | var f = H[5]; | |
9939 | var g = H[6]; | |
9940 | var h = H[7]; | |
9941 | ||
9942 | // Computation | |
9943 | for (var i = 0; i < 64; i++) { | |
9944 | if (i < 16) { | |
9945 | W[i] = M[offset + i] | 0; | |
9946 | } else { | |
9947 | var gamma0x = W[i - 15]; | |
9948 | var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ | |
9949 | ((gamma0x << 14) | (gamma0x >>> 18)) ^ | |
9950 | (gamma0x >>> 3); | |
9951 | ||
9952 | var gamma1x = W[i - 2]; | |
9953 | var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ | |
9954 | ((gamma1x << 13) | (gamma1x >>> 19)) ^ | |
9955 | (gamma1x >>> 10); | |
9956 | ||
9957 | W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]; | |
9958 | } | |
9959 | ||
9960 | var ch = (e & f) ^ (~e & g); | |
9961 | var maj = (a & b) ^ (a & c) ^ (b & c); | |
9962 | ||
9963 | var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22)); | |
9964 | var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25)); | |
9965 | ||
9966 | var t1 = h + sigma1 + ch + K[i] + W[i]; | |
9967 | var t2 = sigma0 + maj; | |
9968 | ||
9969 | h = g; | |
9970 | g = f; | |
9971 | f = e; | |
9972 | e = (d + t1) | 0; | |
9973 | d = c; | |
9974 | c = b; | |
9975 | b = a; | |
9976 | a = (t1 + t2) | 0; | |
9977 | } | |
9978 | ||
9979 | // Intermediate hash value | |
9980 | H[0] = (H[0] + a) | 0; | |
9981 | H[1] = (H[1] + b) | 0; | |
9982 | H[2] = (H[2] + c) | 0; | |
9983 | H[3] = (H[3] + d) | 0; | |
9984 | H[4] = (H[4] + e) | 0; | |
9985 | H[5] = (H[5] + f) | 0; | |
9986 | H[6] = (H[6] + g) | 0; | |
9987 | H[7] = (H[7] + h) | 0; | |
9988 | }, | |
9989 | ||
9990 | _doFinalize: function () { | |
9991 | // Shortcuts | |
9992 | var data = this._data; | |
9993 | var dataWords = data.words; | |
9994 | ||
9995 | var nBitsTotal = this._nDataBytes * 8; | |
9996 | var nBitsLeft = data.sigBytes * 8; | |
9997 | ||
9998 | // Add padding | |
9999 | dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); | |
10000 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); | |
10001 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; | |
10002 | data.sigBytes = dataWords.length * 4; | |
10003 | ||
10004 | // Hash final blocks | |
10005 | this._process(); | |
10006 | ||
10007 | // Return final computed hash | |
10008 | return this._hash; | |
10009 | }, | |
10010 | ||
10011 | clone: function () { | |
10012 | var clone = Hasher.clone.call(this); | |
10013 | clone._hash = this._hash.clone(); | |
10014 | ||
10015 | return clone; | |
10016 | } | |
10017 | }); | |
10018 | ||
10019 | /** | |
10020 | * Shortcut function to the hasher's object interface. | |
10021 | * | |
10022 | * @param {WordArray|string} message The message to hash. | |
10023 | * | |
10024 | * @return {WordArray} The hash. | |
10025 | * | |
10026 | * @static | |
10027 | * | |
10028 | * @example | |
10029 | * | |
10030 | * var hash = CryptoJS.SHA256('message'); | |
10031 | * var hash = CryptoJS.SHA256(wordArray); | |
10032 | */ | |
10033 | C.SHA256 = Hasher._createHelper(SHA256); | |
10034 | ||
10035 | /** | |
10036 | * Shortcut function to the HMAC's object interface. | |
10037 | * | |
10038 | * @param {WordArray|string} message The message to hash. | |
10039 | * @param {WordArray|string} key The secret key. | |
10040 | * | |
10041 | * @return {WordArray} The HMAC. | |
10042 | * | |
10043 | * @static | |
10044 | * | |
10045 | * @example | |
10046 | * | |
10047 | * var hmac = CryptoJS.HmacSHA256(message, key); | |
10048 | */ | |
10049 | C.HmacSHA256 = Hasher._createHmacHelper(SHA256); | |
10050 | }(Math)); | |
10051 | ||
10052 | ||
10053 | return CryptoJS.SHA256; | |
10054 | ||
10055 | })); | |
10056 | },{"./core":31}],58:[function(_dereq_,module,exports){ | |
10057 | ;(function (root, factory, undef) { | |
10058 | if (typeof exports === "object") { | |
10059 | // CommonJS | |
10060 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core")); | |
10061 | } | |
10062 | else if (typeof define === "function" && define.amd) { | |
10063 | // AMD | |
10064 | define(["./core", "./x64-core"], factory); | |
10065 | } | |
10066 | else { | |
10067 | // Global (browser) | |
10068 | factory(root.CryptoJS); | |
10069 | } | |
10070 | }(this, function (CryptoJS) { | |
10071 | ||
10072 | (function (Math) { | |
10073 | // Shortcuts | |
10074 | var C = CryptoJS; | |
10075 | var C_lib = C.lib; | |
10076 | var WordArray = C_lib.WordArray; | |
10077 | var Hasher = C_lib.Hasher; | |
10078 | var C_x64 = C.x64; | |
10079 | var X64Word = C_x64.Word; | |
10080 | var C_algo = C.algo; | |
10081 | ||
10082 | // Constants tables | |
10083 | var RHO_OFFSETS = []; | |
10084 | var PI_INDEXES = []; | |
10085 | var ROUND_CONSTANTS = []; | |
10086 | ||
10087 | // Compute Constants | |
10088 | (function () { | |
10089 | // Compute rho offset constants | |
10090 | var x = 1, y = 0; | |
10091 | for (var t = 0; t < 24; t++) { | |
10092 | RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64; | |
10093 | ||
10094 | var newX = y % 5; | |
10095 | var newY = (2 * x + 3 * y) % 5; | |
10096 | x = newX; | |
10097 | y = newY; | |
10098 | } | |
10099 | ||
10100 | // Compute pi index constants | |
10101 | for (var x = 0; x < 5; x++) { | |
10102 | for (var y = 0; y < 5; y++) { | |
10103 | PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5; | |
10104 | } | |
10105 | } | |
10106 | ||
10107 | // Compute round constants | |
10108 | var LFSR = 0x01; | |
10109 | for (var i = 0; i < 24; i++) { | |
10110 | var roundConstantMsw = 0; | |
10111 | var roundConstantLsw = 0; | |
10112 | ||
10113 | for (var j = 0; j < 7; j++) { | |
10114 | if (LFSR & 0x01) { | |
10115 | var bitPosition = (1 << j) - 1; | |
10116 | if (bitPosition < 32) { | |
10117 | roundConstantLsw ^= 1 << bitPosition; | |
10118 | } else /* if (bitPosition >= 32) */ { | |
10119 | roundConstantMsw ^= 1 << (bitPosition - 32); | |
10120 | } | |
10121 | } | |
10122 | ||
10123 | // Compute next LFSR | |
10124 | if (LFSR & 0x80) { | |
10125 | // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1 | |
10126 | LFSR = (LFSR << 1) ^ 0x71; | |
10127 | } else { | |
10128 | LFSR <<= 1; | |
10129 | } | |
10130 | } | |
10131 | ||
10132 | ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw); | |
10133 | } | |
10134 | }()); | |
10135 | ||
10136 | // Reusable objects for temporary values | |
10137 | var T = []; | |
10138 | (function () { | |
10139 | for (var i = 0; i < 25; i++) { | |
10140 | T[i] = X64Word.create(); | |
10141 | } | |
10142 | }()); | |
10143 | ||
10144 | /** | |
10145 | * SHA-3 hash algorithm. | |
10146 | */ | |
10147 | var SHA3 = C_algo.SHA3 = Hasher.extend({ | |
10148 | /** | |
10149 | * Configuration options. | |
10150 | * | |
10151 | * @property {number} outputLength | |
10152 | * The desired number of bits in the output hash. | |
10153 | * Only values permitted are: 224, 256, 384, 512. | |
10154 | * Default: 512 | |
10155 | */ | |
10156 | cfg: Hasher.cfg.extend({ | |
10157 | outputLength: 512 | |
10158 | }), | |
10159 | ||
10160 | _doReset: function () { | |
10161 | var state = this._state = [] | |
10162 | for (var i = 0; i < 25; i++) { | |
10163 | state[i] = new X64Word.init(); | |
10164 | } | |
10165 | ||
10166 | this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32; | |
10167 | }, | |
10168 | ||
10169 | _doProcessBlock: function (M, offset) { | |
10170 | // Shortcuts | |
10171 | var state = this._state; | |
10172 | var nBlockSizeLanes = this.blockSize / 2; | |
10173 | ||
10174 | // Absorb | |
10175 | for (var i = 0; i < nBlockSizeLanes; i++) { | |
10176 | // Shortcuts | |
10177 | var M2i = M[offset + 2 * i]; | |
10178 | var M2i1 = M[offset + 2 * i + 1]; | |
10179 | ||
10180 | // Swap endian | |
10181 | M2i = ( | |
10182 | (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) | | |
10183 | (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00) | |
10184 | ); | |
10185 | M2i1 = ( | |
10186 | (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) | | |
10187 | (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00) | |
10188 | ); | |
10189 | ||
10190 | // Absorb message into state | |
10191 | var lane = state[i]; | |
10192 | lane.high ^= M2i1; | |
10193 | lane.low ^= M2i; | |
10194 | } | |
10195 | ||
10196 | // Rounds | |
10197 | for (var round = 0; round < 24; round++) { | |
10198 | // Theta | |
10199 | for (var x = 0; x < 5; x++) { | |
10200 | // Mix column lanes | |
10201 | var tMsw = 0, tLsw = 0; | |
10202 | for (var y = 0; y < 5; y++) { | |
10203 | var lane = state[x + 5 * y]; | |
10204 | tMsw ^= lane.high; | |
10205 | tLsw ^= lane.low; | |
10206 | } | |
10207 | ||
10208 | // Temporary values | |
10209 | var Tx = T[x]; | |
10210 | Tx.high = tMsw; | |
10211 | Tx.low = tLsw; | |
10212 | } | |
10213 | for (var x = 0; x < 5; x++) { | |
10214 | // Shortcuts | |
10215 | var Tx4 = T[(x + 4) % 5]; | |
10216 | var Tx1 = T[(x + 1) % 5]; | |
10217 | var Tx1Msw = Tx1.high; | |
10218 | var Tx1Lsw = Tx1.low; | |
10219 | ||
10220 | // Mix surrounding columns | |
10221 | var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31)); | |
10222 | var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31)); | |
10223 | for (var y = 0; y < 5; y++) { | |
10224 | var lane = state[x + 5 * y]; | |
10225 | lane.high ^= tMsw; | |
10226 | lane.low ^= tLsw; | |
10227 | } | |
10228 | } | |
10229 | ||
10230 | // Rho Pi | |
10231 | for (var laneIndex = 1; laneIndex < 25; laneIndex++) { | |
10232 | // Shortcuts | |
10233 | var lane = state[laneIndex]; | |
10234 | var laneMsw = lane.high; | |
10235 | var laneLsw = lane.low; | |
10236 | var rhoOffset = RHO_OFFSETS[laneIndex]; | |
10237 | ||
10238 | // Rotate lanes | |
10239 | if (rhoOffset < 32) { | |
10240 | var tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset)); | |
10241 | var tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset)); | |
10242 | } else /* if (rhoOffset >= 32) */ { | |
10243 | var tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset)); | |
10244 | var tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset)); | |
10245 | } | |
10246 | ||
10247 | // Transpose lanes | |
10248 | var TPiLane = T[PI_INDEXES[laneIndex]]; | |
10249 | TPiLane.high = tMsw; | |
10250 | TPiLane.low = tLsw; | |
10251 | } | |
10252 | ||
10253 | // Rho pi at x = y = 0 | |
10254 | var T0 = T[0]; | |
10255 | var state0 = state[0]; | |
10256 | T0.high = state0.high; | |
10257 | T0.low = state0.low; | |
10258 | ||
10259 | // Chi | |
10260 | for (var x = 0; x < 5; x++) { | |
10261 | for (var y = 0; y < 5; y++) { | |
10262 | // Shortcuts | |
10263 | var laneIndex = x + 5 * y; | |
10264 | var lane = state[laneIndex]; | |
10265 | var TLane = T[laneIndex]; | |
10266 | var Tx1Lane = T[((x + 1) % 5) + 5 * y]; | |
10267 | var Tx2Lane = T[((x + 2) % 5) + 5 * y]; | |
10268 | ||
10269 | // Mix rows | |
10270 | lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high); | |
10271 | lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low); | |
10272 | } | |
10273 | } | |
10274 | ||
10275 | // Iota | |
10276 | var lane = state[0]; | |
10277 | var roundConstant = ROUND_CONSTANTS[round]; | |
10278 | lane.high ^= roundConstant.high; | |
10279 | lane.low ^= roundConstant.low;; | |
10280 | } | |
10281 | }, | |
10282 | ||
10283 | _doFinalize: function () { | |
10284 | // Shortcuts | |
10285 | var data = this._data; | |
10286 | var dataWords = data.words; | |
10287 | var nBitsTotal = this._nDataBytes * 8; | |
10288 | var nBitsLeft = data.sigBytes * 8; | |
10289 | var blockSizeBits = this.blockSize * 32; | |
10290 | ||
10291 | // Add padding | |
10292 | dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32); | |
10293 | dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80; | |
10294 | data.sigBytes = dataWords.length * 4; | |
10295 | ||
10296 | // Hash final blocks | |
10297 | this._process(); | |
10298 | ||
10299 | // Shortcuts | |
10300 | var state = this._state; | |
10301 | var outputLengthBytes = this.cfg.outputLength / 8; | |
10302 | var outputLengthLanes = outputLengthBytes / 8; | |
10303 | ||
10304 | // Squeeze | |
10305 | var hashWords = []; | |
10306 | for (var i = 0; i < outputLengthLanes; i++) { | |
10307 | // Shortcuts | |
10308 | var lane = state[i]; | |
10309 | var laneMsw = lane.high; | |
10310 | var laneLsw = lane.low; | |
10311 | ||
10312 | // Swap endian | |
10313 | laneMsw = ( | |
10314 | (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) | | |
10315 | (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00) | |
10316 | ); | |
10317 | laneLsw = ( | |
10318 | (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) | | |
10319 | (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00) | |
10320 | ); | |
10321 | ||
10322 | // Squeeze state to retrieve hash | |
10323 | hashWords.push(laneLsw); | |
10324 | hashWords.push(laneMsw); | |
10325 | } | |
10326 | ||
10327 | // Return final computed hash | |
10328 | return new WordArray.init(hashWords, outputLengthBytes); | |
10329 | }, | |
10330 | ||
10331 | clone: function () { | |
10332 | var clone = Hasher.clone.call(this); | |
10333 | ||
10334 | var state = clone._state = this._state.slice(0); | |
10335 | for (var i = 0; i < 25; i++) { | |
10336 | state[i] = state[i].clone(); | |
10337 | } | |
10338 | ||
10339 | return clone; | |
10340 | } | |
10341 | }); | |
10342 | ||
10343 | /** | |
10344 | * Shortcut function to the hasher's object interface. | |
10345 | * | |
10346 | * @param {WordArray|string} message The message to hash. | |
10347 | * | |
10348 | * @return {WordArray} The hash. | |
10349 | * | |
10350 | * @static | |
10351 | * | |
10352 | * @example | |
10353 | * | |
10354 | * var hash = CryptoJS.SHA3('message'); | |
10355 | * var hash = CryptoJS.SHA3(wordArray); | |
10356 | */ | |
10357 | C.SHA3 = Hasher._createHelper(SHA3); | |
10358 | ||
10359 | /** | |
10360 | * Shortcut function to the HMAC's object interface. | |
10361 | * | |
10362 | * @param {WordArray|string} message The message to hash. | |
10363 | * @param {WordArray|string} key The secret key. | |
10364 | * | |
10365 | * @return {WordArray} The HMAC. | |
10366 | * | |
10367 | * @static | |
10368 | * | |
10369 | * @example | |
10370 | * | |
10371 | * var hmac = CryptoJS.HmacSHA3(message, key); | |
10372 | */ | |
10373 | C.HmacSHA3 = Hasher._createHmacHelper(SHA3); | |
10374 | }(Math)); | |
10375 | ||
10376 | ||
10377 | return CryptoJS.SHA3; | |
10378 | ||
10379 | })); | |
10380 | },{"./core":31,"./x64-core":62}],59:[function(_dereq_,module,exports){ | |
10381 | ;(function (root, factory, undef) { | |
10382 | if (typeof exports === "object") { | |
10383 | // CommonJS | |
10384 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core"), _dereq_("./sha512")); | |
10385 | } | |
10386 | else if (typeof define === "function" && define.amd) { | |
10387 | // AMD | |
10388 | define(["./core", "./x64-core", "./sha512"], factory); | |
10389 | } | |
10390 | else { | |
10391 | // Global (browser) | |
10392 | factory(root.CryptoJS); | |
10393 | } | |
10394 | }(this, function (CryptoJS) { | |
10395 | ||
10396 | (function () { | |
10397 | // Shortcuts | |
10398 | var C = CryptoJS; | |
10399 | var C_x64 = C.x64; | |
10400 | var X64Word = C_x64.Word; | |
10401 | var X64WordArray = C_x64.WordArray; | |
10402 | var C_algo = C.algo; | |
10403 | var SHA512 = C_algo.SHA512; | |
10404 | ||
10405 | /** | |
10406 | * SHA-384 hash algorithm. | |
10407 | */ | |
10408 | var SHA384 = C_algo.SHA384 = SHA512.extend({ | |
10409 | _doReset: function () { | |
10410 | this._hash = new X64WordArray.init([ | |
10411 | new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), | |
10412 | new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), | |
10413 | new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), | |
10414 | new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4) | |
10415 | ]); | |
10416 | }, | |
10417 | ||
10418 | _doFinalize: function () { | |
10419 | var hash = SHA512._doFinalize.call(this); | |
10420 | ||
10421 | hash.sigBytes -= 16; | |
10422 | ||
10423 | return hash; | |
10424 | } | |
10425 | }); | |
10426 | ||
10427 | /** | |
10428 | * Shortcut function to the hasher's object interface. | |
10429 | * | |
10430 | * @param {WordArray|string} message The message to hash. | |
10431 | * | |
10432 | * @return {WordArray} The hash. | |
10433 | * | |
10434 | * @static | |
10435 | * | |
10436 | * @example | |
10437 | * | |
10438 | * var hash = CryptoJS.SHA384('message'); | |
10439 | * var hash = CryptoJS.SHA384(wordArray); | |
10440 | */ | |
10441 | C.SHA384 = SHA512._createHelper(SHA384); | |
10442 | ||
10443 | /** | |
10444 | * Shortcut function to the HMAC's object interface. | |
10445 | * | |
10446 | * @param {WordArray|string} message The message to hash. | |
10447 | * @param {WordArray|string} key The secret key. | |
10448 | * | |
10449 | * @return {WordArray} The HMAC. | |
10450 | * | |
10451 | * @static | |
10452 | * | |
10453 | * @example | |
10454 | * | |
10455 | * var hmac = CryptoJS.HmacSHA384(message, key); | |
10456 | */ | |
10457 | C.HmacSHA384 = SHA512._createHmacHelper(SHA384); | |
10458 | }()); | |
10459 | ||
10460 | ||
10461 | return CryptoJS.SHA384; | |
10462 | ||
10463 | })); | |
10464 | },{"./core":31,"./sha512":60,"./x64-core":62}],60:[function(_dereq_,module,exports){ | |
10465 | ;(function (root, factory, undef) { | |
10466 | if (typeof exports === "object") { | |
10467 | // CommonJS | |
10468 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core")); | |
10469 | } | |
10470 | else if (typeof define === "function" && define.amd) { | |
10471 | // AMD | |
10472 | define(["./core", "./x64-core"], factory); | |
10473 | } | |
10474 | else { | |
10475 | // Global (browser) | |
10476 | factory(root.CryptoJS); | |
10477 | } | |
10478 | }(this, function (CryptoJS) { | |
10479 | ||
10480 | (function () { | |
10481 | // Shortcuts | |
10482 | var C = CryptoJS; | |
10483 | var C_lib = C.lib; | |
10484 | var Hasher = C_lib.Hasher; | |
10485 | var C_x64 = C.x64; | |
10486 | var X64Word = C_x64.Word; | |
10487 | var X64WordArray = C_x64.WordArray; | |
10488 | var C_algo = C.algo; | |
10489 | ||
10490 | function X64Word_create() { | |
10491 | return X64Word.create.apply(X64Word, arguments); | |
10492 | } | |
10493 | ||
10494 | // Constants | |
10495 | var K = [ | |
10496 | X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd), | |
10497 | X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc), | |
10498 | X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019), | |
10499 | X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118), | |
10500 | X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe), | |
10501 | X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2), | |
10502 | X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1), | |
10503 | X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694), | |
10504 | X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3), | |
10505 | X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65), | |
10506 | X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483), | |
10507 | X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5), | |
10508 | X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210), | |
10509 | X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4), | |
10510 | X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725), | |
10511 | X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70), | |
10512 | X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926), | |
10513 | X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df), | |
10514 | X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8), | |
10515 | X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b), | |
10516 | X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001), | |
10517 | X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30), | |
10518 | X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910), | |
10519 | X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8), | |
10520 | X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53), | |
10521 | X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8), | |
10522 | X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb), | |
10523 | X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3), | |
10524 | X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60), | |
10525 | X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec), | |
10526 | X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9), | |
10527 | X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b), | |
10528 | X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207), | |
10529 | X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178), | |
10530 | X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6), | |
10531 | X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b), | |
10532 | X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493), | |
10533 | X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c), | |
10534 | X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a), | |
10535 | X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817) | |
10536 | ]; | |
10537 | ||
10538 | // Reusable objects | |
10539 | var W = []; | |
10540 | (function () { | |
10541 | for (var i = 0; i < 80; i++) { | |
10542 | W[i] = X64Word_create(); | |
10543 | } | |
10544 | }()); | |
10545 | ||
10546 | /** | |
10547 | * SHA-512 hash algorithm. | |
10548 | */ | |
10549 | var SHA512 = C_algo.SHA512 = Hasher.extend({ | |
10550 | _doReset: function () { | |
10551 | this._hash = new X64WordArray.init([ | |
10552 | new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b), | |
10553 | new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1), | |
10554 | new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f), | |
10555 | new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179) | |
10556 | ]); | |
10557 | }, | |
10558 | ||
10559 | _doProcessBlock: function (M, offset) { | |
10560 | // Shortcuts | |
10561 | var H = this._hash.words; | |
10562 | ||
10563 | var H0 = H[0]; | |
10564 | var H1 = H[1]; | |
10565 | var H2 = H[2]; | |
10566 | var H3 = H[3]; | |
10567 | var H4 = H[4]; | |
10568 | var H5 = H[5]; | |
10569 | var H6 = H[6]; | |
10570 | var H7 = H[7]; | |
10571 | ||
10572 | var H0h = H0.high; | |
10573 | var H0l = H0.low; | |
10574 | var H1h = H1.high; | |
10575 | var H1l = H1.low; | |
10576 | var H2h = H2.high; | |
10577 | var H2l = H2.low; | |
10578 | var H3h = H3.high; | |
10579 | var H3l = H3.low; | |
10580 | var H4h = H4.high; | |
10581 | var H4l = H4.low; | |
10582 | var H5h = H5.high; | |
10583 | var H5l = H5.low; | |
10584 | var H6h = H6.high; | |
10585 | var H6l = H6.low; | |
10586 | var H7h = H7.high; | |
10587 | var H7l = H7.low; | |
10588 | ||
10589 | // Working variables | |
10590 | var ah = H0h; | |
10591 | var al = H0l; | |
10592 | var bh = H1h; | |
10593 | var bl = H1l; | |
10594 | var ch = H2h; | |
10595 | var cl = H2l; | |
10596 | var dh = H3h; | |
10597 | var dl = H3l; | |
10598 | var eh = H4h; | |
10599 | var el = H4l; | |
10600 | var fh = H5h; | |
10601 | var fl = H5l; | |
10602 | var gh = H6h; | |
10603 | var gl = H6l; | |
10604 | var hh = H7h; | |
10605 | var hl = H7l; | |
10606 | ||
10607 | // Rounds | |
10608 | for (var i = 0; i < 80; i++) { | |
10609 | // Shortcut | |
10610 | var Wi = W[i]; | |
10611 | ||
10612 | // Extend message | |
10613 | if (i < 16) { | |
10614 | var Wih = Wi.high = M[offset + i * 2] | 0; | |
10615 | var Wil = Wi.low = M[offset + i * 2 + 1] | 0; | |
10616 | } else { | |
10617 | // Gamma0 | |
10618 | var gamma0x = W[i - 15]; | |
10619 | var gamma0xh = gamma0x.high; | |
10620 | var gamma0xl = gamma0x.low; | |
10621 | var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7); | |
10622 | var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25)); | |
10623 | ||
10624 | // Gamma1 | |
10625 | var gamma1x = W[i - 2]; | |
10626 | var gamma1xh = gamma1x.high; | |
10627 | var gamma1xl = gamma1x.low; | |
10628 | var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6); | |
10629 | var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26)); | |
10630 | ||
10631 | // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] | |
10632 | var Wi7 = W[i - 7]; | |
10633 | var Wi7h = Wi7.high; | |
10634 | var Wi7l = Wi7.low; | |
10635 | ||
10636 | var Wi16 = W[i - 16]; | |
10637 | var Wi16h = Wi16.high; | |
10638 | var Wi16l = Wi16.low; | |
10639 | ||
10640 | var Wil = gamma0l + Wi7l; | |
10641 | var Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0); | |
10642 | var Wil = Wil + gamma1l; | |
10643 | var Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0); | |
10644 | var Wil = Wil + Wi16l; | |
10645 | var Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0); | |
10646 | ||
10647 | Wi.high = Wih; | |
10648 | Wi.low = Wil; | |
10649 | } | |
10650 | ||
10651 | var chh = (eh & fh) ^ (~eh & gh); | |
10652 | var chl = (el & fl) ^ (~el & gl); | |
10653 | var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch); | |
10654 | var majl = (al & bl) ^ (al & cl) ^ (bl & cl); | |
10655 | ||
10656 | var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7)); | |
10657 | var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7)); | |
10658 | var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9)); | |
10659 | var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9)); | |
10660 | ||
10661 | // t1 = h + sigma1 + ch + K[i] + W[i] | |
10662 | var Ki = K[i]; | |
10663 | var Kih = Ki.high; | |
10664 | var Kil = Ki.low; | |
10665 | ||
10666 | var t1l = hl + sigma1l; | |
10667 | var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0); | |
10668 | var t1l = t1l + chl; | |
10669 | var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0); | |
10670 | var t1l = t1l + Kil; | |
10671 | var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0); | |
10672 | var t1l = t1l + Wil; | |
10673 | var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0); | |
10674 | ||
10675 | // t2 = sigma0 + maj | |
10676 | var t2l = sigma0l + majl; | |
10677 | var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0); | |
10678 | ||
10679 | // Update working variables | |
10680 | hh = gh; | |
10681 | hl = gl; | |
10682 | gh = fh; | |
10683 | gl = fl; | |
10684 | fh = eh; | |
10685 | fl = el; | |
10686 | el = (dl + t1l) | 0; | |
10687 | eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0; | |
10688 | dh = ch; | |
10689 | dl = cl; | |
10690 | ch = bh; | |
10691 | cl = bl; | |
10692 | bh = ah; | |
10693 | bl = al; | |
10694 | al = (t1l + t2l) | 0; | |
10695 | ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0; | |
10696 | } | |
10697 | ||
10698 | // Intermediate hash value | |
10699 | H0l = H0.low = (H0l + al); | |
10700 | H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0)); | |
10701 | H1l = H1.low = (H1l + bl); | |
10702 | H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0)); | |
10703 | H2l = H2.low = (H2l + cl); | |
10704 | H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0)); | |
10705 | H3l = H3.low = (H3l + dl); | |
10706 | H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0)); | |
10707 | H4l = H4.low = (H4l + el); | |
10708 | H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0)); | |
10709 | H5l = H5.low = (H5l + fl); | |
10710 | H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0)); | |
10711 | H6l = H6.low = (H6l + gl); | |
10712 | H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0)); | |
10713 | H7l = H7.low = (H7l + hl); | |
10714 | H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0)); | |
10715 | }, | |
10716 | ||
10717 | _doFinalize: function () { | |
10718 | // Shortcuts | |
10719 | var data = this._data; | |
10720 | var dataWords = data.words; | |
10721 | ||
10722 | var nBitsTotal = this._nDataBytes * 8; | |
10723 | var nBitsLeft = data.sigBytes * 8; | |
10724 | ||
10725 | // Add padding | |
10726 | dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); | |
10727 | dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000); | |
10728 | dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal; | |
10729 | data.sigBytes = dataWords.length * 4; | |
10730 | ||
10731 | // Hash final blocks | |
10732 | this._process(); | |
10733 | ||
10734 | // Convert hash to 32-bit word array before returning | |
10735 | var hash = this._hash.toX32(); | |
10736 | ||
10737 | // Return final computed hash | |
10738 | return hash; | |
10739 | }, | |
10740 | ||
10741 | clone: function () { | |
10742 | var clone = Hasher.clone.call(this); | |
10743 | clone._hash = this._hash.clone(); | |
10744 | ||
10745 | return clone; | |
10746 | }, | |
10747 | ||
10748 | blockSize: 1024/32 | |
10749 | }); | |
10750 | ||
10751 | /** | |
10752 | * Shortcut function to the hasher's object interface. | |
10753 | * | |
10754 | * @param {WordArray|string} message The message to hash. | |
10755 | * | |
10756 | * @return {WordArray} The hash. | |
10757 | * | |
10758 | * @static | |
10759 | * | |
10760 | * @example | |
10761 | * | |
10762 | * var hash = CryptoJS.SHA512('message'); | |
10763 | * var hash = CryptoJS.SHA512(wordArray); | |
10764 | */ | |
10765 | C.SHA512 = Hasher._createHelper(SHA512); | |
10766 | ||
10767 | /** | |
10768 | * Shortcut function to the HMAC's object interface. | |
10769 | * | |
10770 | * @param {WordArray|string} message The message to hash. | |
10771 | * @param {WordArray|string} key The secret key. | |
10772 | * | |
10773 | * @return {WordArray} The HMAC. | |
10774 | * | |
10775 | * @static | |
10776 | * | |
10777 | * @example | |
10778 | * | |
10779 | * var hmac = CryptoJS.HmacSHA512(message, key); | |
10780 | */ | |
10781 | C.HmacSHA512 = Hasher._createHmacHelper(SHA512); | |
10782 | }()); | |
10783 | ||
10784 | ||
10785 | return CryptoJS.SHA512; | |
10786 | ||
10787 | })); | |
10788 | },{"./core":31,"./x64-core":62}],61:[function(_dereq_,module,exports){ | |
10789 | ;(function (root, factory, undef) { | |
10790 | if (typeof exports === "object") { | |
10791 | // CommonJS | |
10792 | module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); | |
10793 | } | |
10794 | else if (typeof define === "function" && define.amd) { | |
10795 | // AMD | |
10796 | define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); | |
10797 | } | |
10798 | else { | |
10799 | // Global (browser) | |
10800 | factory(root.CryptoJS); | |
10801 | } | |
10802 | }(this, function (CryptoJS) { | |
10803 | ||
10804 | (function () { | |
10805 | // Shortcuts | |
10806 | var C = CryptoJS; | |
10807 | var C_lib = C.lib; | |
10808 | var WordArray = C_lib.WordArray; | |
10809 | var BlockCipher = C_lib.BlockCipher; | |
10810 | var C_algo = C.algo; | |
10811 | ||
10812 | // Permuted Choice 1 constants | |
10813 | var PC1 = [ | |
10814 | 57, 49, 41, 33, 25, 17, 9, 1, | |
10815 | 58, 50, 42, 34, 26, 18, 10, 2, | |
10816 | 59, 51, 43, 35, 27, 19, 11, 3, | |
10817 | 60, 52, 44, 36, 63, 55, 47, 39, | |
10818 | 31, 23, 15, 7, 62, 54, 46, 38, | |
10819 | 30, 22, 14, 6, 61, 53, 45, 37, | |
10820 | 29, 21, 13, 5, 28, 20, 12, 4 | |
10821 | ]; | |
10822 | ||
10823 | // Permuted Choice 2 constants | |
10824 | var PC2 = [ | |
10825 | 14, 17, 11, 24, 1, 5, | |
10826 | 3, 28, 15, 6, 21, 10, | |
10827 | 23, 19, 12, 4, 26, 8, | |
10828 | 16, 7, 27, 20, 13, 2, | |
10829 | 41, 52, 31, 37, 47, 55, | |
10830 | 30, 40, 51, 45, 33, 48, | |
10831 | 44, 49, 39, 56, 34, 53, | |
10832 | 46, 42, 50, 36, 29, 32 | |
10833 | ]; | |
10834 | ||
10835 | // Cumulative bit shift constants | |
10836 | var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28]; | |
10837 | ||
10838 | // SBOXes and round permutation constants | |
10839 | var SBOX_P = [ | |
10840 | { | |
10841 | 0x0: 0x808200, | |
10842 | 0x10000000: 0x8000, | |
10843 | 0x20000000: 0x808002, | |
10844 | 0x30000000: 0x2, | |
10845 | 0x40000000: 0x200, | |
10846 | 0x50000000: 0x808202, | |
10847 | 0x60000000: 0x800202, | |
10848 | 0x70000000: 0x800000, | |
10849 | 0x80000000: 0x202, | |
10850 | 0x90000000: 0x800200, | |
10851 | 0xa0000000: 0x8200, | |
10852 | 0xb0000000: 0x808000, | |
10853 | 0xc0000000: 0x8002, | |
10854 | 0xd0000000: 0x800002, | |
10855 | 0xe0000000: 0x0, | |
10856 | 0xf0000000: 0x8202, | |
10857 | 0x8000000: 0x0, | |
10858 | 0x18000000: 0x808202, | |
10859 | 0x28000000: 0x8202, | |
10860 | 0x38000000: 0x8000, | |
10861 | 0x48000000: 0x808200, | |
10862 | 0x58000000: 0x200, | |
10863 | 0x68000000: 0x808002, | |
10864 | 0x78000000: 0x2, | |
10865 | 0x88000000: 0x800200, | |
10866 | 0x98000000: 0x8200, | |
10867 | 0xa8000000: 0x808000, | |
10868 | 0xb8000000: 0x800202, | |
10869 | 0xc8000000: 0x800002, | |
10870 | 0xd8000000: 0x8002, | |
10871 | 0xe8000000: 0x202, | |
10872 | 0xf8000000: 0x800000, | |
10873 | 0x1: 0x8000, | |
10874 | 0x10000001: 0x2, | |
10875 | 0x20000001: 0x808200, | |
10876 | 0x30000001: 0x800000, | |
10877 | 0x40000001: 0x808002, | |
10878 | 0x50000001: 0x8200, | |
10879 | 0x60000001: 0x200, | |
10880 | 0x70000001: 0x800202, | |
10881 | 0x80000001: 0x808202, | |
10882 | 0x90000001: 0x808000, | |
10883 | 0xa0000001: 0x800002, | |
10884 | 0xb0000001: 0x8202, | |
10885 | 0xc0000001: 0x202, | |
10886 | 0xd0000001: 0x800200, | |
10887 | 0xe0000001: 0x8002, | |
10888 | 0xf0000001: 0x0, | |
10889 | 0x8000001: 0x808202, | |
10890 | 0x18000001: 0x808000, | |
10891 | 0x28000001: 0x800000, | |
10892 | 0x38000001: 0x200, | |
10893 | 0x48000001: 0x8000, | |
10894 | 0x58000001: 0x800002, | |
10895 | 0x68000001: 0x2, | |
10896 | 0x78000001: 0x8202, | |
10897 | 0x88000001: 0x8002, | |
10898 | 0x98000001: 0x800202, | |
10899 | 0xa8000001: 0x202, | |
10900 | 0xb8000001: 0x808200, | |
10901 | 0xc8000001: 0x800200, | |
10902 | 0xd8000001: 0x0, | |
10903 | 0xe8000001: 0x8200, | |
10904 | 0xf8000001: 0x808002 | |
10905 | }, | |
10906 | { | |
10907 | 0x0: 0x40084010, | |
10908 | 0x1000000: 0x4000, | |
10909 | 0x2000000: 0x80000, | |
10910 | 0x3000000: 0x40080010, | |
10911 | 0x4000000: 0x40000010, | |
10912 | 0x5000000: 0x40084000, | |
10913 | 0x6000000: 0x40004000, | |
10914 | 0x7000000: 0x10, | |
10915 | 0x8000000: 0x84000, | |
10916 | 0x9000000: 0x40004010, | |
10917 | 0xa000000: 0x40000000, | |
10918 | 0xb000000: 0x84010, | |
10919 | 0xc000000: 0x80010, | |
10920 | 0xd000000: 0x0, | |
10921 | 0xe000000: 0x4010, | |
10922 | 0xf000000: 0x40080000, | |
10923 | 0x800000: 0x40004000, | |
10924 | 0x1800000: 0x84010, | |
10925 | 0x2800000: 0x10, | |
10926 | 0x3800000: 0x40004010, | |
10927 | 0x4800000: 0x40084010, | |
10928 | 0x5800000: 0x40000000, | |
10929 | 0x6800000: 0x80000, | |
10930 | 0x7800000: 0x40080010, | |
10931 | 0x8800000: 0x80010, | |
10932 | 0x9800000: 0x0, | |
10933 | 0xa800000: 0x4000, | |
10934 | 0xb800000: 0x40080000, | |
10935 | 0xc800000: 0x40000010, | |
10936 | 0xd800000: 0x84000, | |
10937 | 0xe800000: 0x40084000, | |
10938 | 0xf800000: 0x4010, | |
10939 | 0x10000000: 0x0, | |
10940 | 0x11000000: 0x40080010, | |
10941 | 0x12000000: 0x40004010, | |
10942 | 0x13000000: 0x40084000, | |
10943 | 0x14000000: 0x40080000, | |
10944 | 0x15000000: 0x10, | |
10945 | 0x16000000: 0x84010, | |
10946 | 0x17000000: 0x4000, | |
10947 | 0x18000000: 0x4010, | |
10948 | 0x19000000: 0x80000, | |
10949 | 0x1a000000: 0x80010, | |
10950 | 0x1b000000: 0x40000010, | |
10951 | 0x1c000000: 0x84000, | |
10952 | 0x1d000000: 0x40004000, | |
10953 | 0x1e000000: 0x40000000, | |
10954 | 0x1f000000: 0x40084010, | |
10955 | 0x10800000: 0x84010, | |
10956 | 0x11800000: 0x80000, | |
10957 | 0x12800000: 0x40080000, | |
10958 | 0x13800000: 0x4000, | |
10959 | 0x14800000: 0x40004000, | |
10960 | 0x15800000: 0x40084010, | |
10961 | 0x16800000: 0x10, | |
10962 | 0x17800000: 0x40000000, | |
10963 | 0x18800000: 0x40084000, | |
10964 | 0x19800000: 0x40000010, | |
10965 | 0x1a800000: 0x40004010, | |
10966 | 0x1b800000: 0x80010, | |
10967 | 0x1c800000: 0x0, | |
10968 | 0x1d800000: 0x4010, | |
10969 | 0x1e800000: 0x40080010, | |
10970 | 0x1f800000: 0x84000 | |
10971 | }, | |
10972 | { | |
10973 | 0x0: 0x104, | |
10974 | 0x100000: 0x0, | |
10975 | 0x200000: 0x4000100, | |
10976 | 0x300000: 0x10104, | |
10977 | 0x400000: 0x10004, | |
10978 | 0x500000: 0x4000004, | |
10979 | 0x600000: 0x4010104, | |
10980 | 0x700000: 0x4010000, | |
10981 | 0x800000: 0x4000000, | |
10982 | 0x900000: 0x4010100, | |
10983 | 0xa00000: 0x10100, | |
10984 | 0xb00000: 0x4010004, | |
10985 | 0xc00000: 0x4000104, | |
10986 | 0xd00000: 0x10000, | |
10987 | 0xe00000: 0x4, | |
10988 | 0xf00000: 0x100, | |
10989 | 0x80000: 0x4010100, | |
10990 | 0x180000: 0x4010004, | |
10991 | 0x280000: 0x0, | |
10992 | 0x380000: 0x4000100, | |
10993 | 0x480000: 0x4000004, | |
10994 | 0x580000: 0x10000, | |
10995 | 0x680000: 0x10004, | |
10996 | 0x780000: 0x104, | |
10997 | 0x880000: 0x4, | |
10998 | 0x980000: 0x100, | |
10999 | 0xa80000: 0x4010000, | |
11000 | 0xb80000: 0x10104, | |
11001 | 0xc80000: 0x10100, | |
11002 | 0xd80000: 0x4000104, | |
11003 | 0xe80000: 0x4010104, | |
11004 | 0xf80000: 0x4000000, | |
11005 | 0x1000000: 0x4010100, | |
11006 | 0x1100000: 0x10004, | |
11007 | 0x1200000: 0x10000, | |
11008 | 0x1300000: 0x4000100, | |
11009 | 0x1400000: 0x100, | |
11010 | 0x1500000: 0x4010104, | |
11011 | 0x1600000: 0x4000004, | |
11012 | 0x1700000: 0x0, | |
11013 | 0x1800000: 0x4000104, | |
11014 | 0x1900000: 0x4000000, | |
11015 | 0x1a00000: 0x4, | |
11016 | 0x1b00000: 0x10100, | |
11017 | 0x1c00000: 0x4010000, | |
11018 | 0x1d00000: 0x104, | |
11019 | 0x1e00000: 0x10104, | |
11020 | 0x1f00000: 0x4010004, | |
11021 | 0x1080000: 0x4000000, | |
11022 | 0x1180000: 0x104, | |
11023 | 0x1280000: 0x4010100, | |
11024 | 0x1380000: 0x0, | |
11025 | 0x1480000: 0x10004, | |
11026 | 0x1580000: 0x4000100, | |
11027 | 0x1680000: 0x100, | |
11028 | 0x1780000: 0x4010004, | |
11029 | 0x1880000: 0x10000, | |
11030 | 0x1980000: 0x4010104, | |
11031 | 0x1a80000: 0x10104, | |
11032 | 0x1b80000: 0x4000004, | |
11033 | 0x1c80000: 0x4000104, | |
11034 | 0x1d80000: 0x4010000, | |
11035 | 0x1e80000: 0x4, | |
11036 | 0x1f80000: 0x10100 | |
11037 | }, | |
11038 | { | |
11039 | 0x0: 0x80401000, | |
11040 | 0x10000: 0x80001040, | |
11041 | 0x20000: 0x401040, | |
11042 | 0x30000: 0x80400000, | |
11043 | 0x40000: 0x0, | |
11044 | 0x50000: 0x401000, | |
11045 | 0x60000: 0x80000040, | |
11046 | 0x70000: 0x400040, | |
11047 | 0x80000: 0x80000000, | |
11048 | 0x90000: 0x400000, | |
11049 | 0xa0000: 0x40, | |
11050 | 0xb0000: 0x80001000, | |
11051 | 0xc0000: 0x80400040, | |
11052 | 0xd0000: 0x1040, | |
11053 | 0xe0000: 0x1000, | |
11054 | 0xf0000: 0x80401040, | |
11055 | 0x8000: 0x80001040, | |
11056 | 0x18000: 0x40, | |
11057 | 0x28000: 0x80400040, | |
11058 | 0x38000: 0x80001000, | |
11059 | 0x48000: 0x401000, | |
11060 | 0x58000: 0x80401040, | |
11061 | 0x68000: 0x0, | |
11062 | 0x78000: 0x80400000, | |
11063 | 0x88000: 0x1000, | |
11064 | 0x98000: 0x80401000, | |
11065 | 0xa8000: 0x400000, | |
11066 | 0xb8000: 0x1040, | |
11067 | 0xc8000: 0x80000000, | |
11068 | 0xd8000: 0x400040, | |
11069 | 0xe8000: 0x401040, | |
11070 | 0xf8000: 0x80000040, | |
11071 | 0x100000: 0x400040, | |
11072 | 0x110000: 0x401000, | |
11073 | 0x120000: 0x80000040, | |
11074 | 0x130000: 0x0, | |
11075 | 0x140000: 0x1040, | |
11076 | 0x150000: 0x80400040, | |
11077 | 0x160000: 0x80401000, | |
11078 | 0x170000: 0x80001040, | |
11079 | 0x180000: 0x80401040, | |
11080 | 0x190000: 0x80000000, | |
11081 | 0x1a0000: 0x80400000, | |
11082 | 0x1b0000: 0x401040, | |
11083 | 0x1c0000: 0x80001000, | |
11084 | 0x1d0000: 0x400000, | |
11085 | 0x1e0000: 0x40, | |
11086 | 0x1f0000: 0x1000, | |
11087 | 0x108000: 0x80400000, | |
11088 | 0x118000: 0x80401040, | |
11089 | 0x128000: 0x0, | |
11090 | 0x138000: 0x401000, | |
11091 | 0x148000: 0x400040, | |
11092 | 0x158000: 0x80000000, | |
11093 | 0x168000: 0x80001040, | |
11094 | 0x178000: 0x40, | |
11095 | 0x188000: 0x80000040, | |
11096 | 0x198000: 0x1000, | |
11097 | 0x1a8000: 0x80001000, | |
11098 | 0x1b8000: 0x80400040, | |
11099 | 0x1c8000: 0x1040, | |
11100 | 0x1d8000: 0x80401000, | |
11101 | 0x1e8000: 0x400000, | |
11102 | 0x1f8000: 0x401040 | |
11103 | }, | |
11104 | { | |
11105 | 0x0: 0x80, | |
11106 | 0x1000: 0x1040000, | |
11107 | 0x2000: 0x40000, | |
11108 | 0x3000: 0x20000000, | |
11109 | 0x4000: 0x20040080, | |
11110 | 0x5000: 0x1000080, | |
11111 | 0x6000: 0x21000080, | |
11112 | 0x7000: 0x40080, | |
11113 | 0x8000: 0x1000000, | |
11114 | 0x9000: 0x20040000, | |
11115 | 0xa000: 0x20000080, | |
11116 | 0xb000: 0x21040080, | |
11117 | 0xc000: 0x21040000, | |
11118 | 0xd000: 0x0, | |
11119 | 0xe000: 0x1040080, | |
11120 | 0xf000: 0x21000000, | |
11121 | 0x800: 0x1040080, | |
11122 | 0x1800: 0x21000080, | |
11123 | 0x2800: 0x80, | |
11124 | 0x3800: 0x1040000, | |
11125 | 0x4800: 0x40000, | |
11126 | 0x5800: 0x20040080, | |
11127 | 0x6800: 0x21040000, | |
11128 | 0x7800: 0x20000000, | |
11129 | 0x8800: 0x20040000, | |
11130 | 0x9800: 0x0, | |
11131 | 0xa800: 0x21040080, | |
11132 | 0xb800: 0x1000080, | |
11133 | 0xc800: 0x20000080, | |
11134 | 0xd800: 0x21000000, | |
11135 | 0xe800: 0x1000000, | |
11136 | 0xf800: 0x40080, | |
11137 | 0x10000: 0x40000, | |
11138 | 0x11000: 0x80, | |
11139 | 0x12000: 0x20000000, | |
11140 | 0x13000: 0x21000080, | |
11141 | 0x14000: 0x1000080, | |
11142 | 0x15000: 0x21040000, | |
11143 | 0x16000: 0x20040080, | |
11144 | 0x17000: 0x1000000, | |
11145 | 0x18000: 0x21040080, | |
11146 | 0x19000: 0x21000000, | |
11147 | 0x1a000: 0x1040000, | |
11148 | 0x1b000: 0x20040000, | |
11149 | 0x1c000: 0x40080, | |
11150 | 0x1d000: 0x20000080, | |
11151 | 0x1e000: 0x0, | |
11152 | 0x1f000: 0x1040080, | |
11153 | 0x10800: 0x21000080, | |
11154 | 0x11800: 0x1000000, | |
11155 | 0x12800: 0x1040000, | |
11156 | 0x13800: 0x20040080, | |
11157 | 0x14800: 0x20000000, | |
11158 | 0x15800: 0x1040080, | |
11159 | 0x16800: 0x80, | |
11160 | 0x17800: 0x21040000, | |
11161 | 0x18800: 0x40080, | |
11162 | 0x19800: 0x21040080, | |
11163 | 0x1a800: 0x0, | |
11164 | 0x1b800: 0x21000000, | |
11165 | 0x1c800: 0x1000080, | |
11166 | 0x1d800: 0x40000, | |
11167 | 0x1e800: 0x20040000, | |
11168 | 0x1f800: 0x20000080 | |
11169 | }, | |
11170 | { | |
11171 | 0x0: 0x10000008, | |
11172 | 0x100: 0x2000, | |
11173 | 0x200: 0x10200000, | |
11174 | 0x300: 0x10202008, | |
11175 | 0x400: 0x10002000, | |
11176 | 0x500: 0x200000, | |
11177 | 0x600: 0x200008, | |
11178 | 0x700: 0x10000000, | |
11179 | 0x800: 0x0, | |
11180 | 0x900: 0x10002008, | |
11181 | 0xa00: 0x202000, | |
11182 | 0xb00: 0x8, | |
11183 | 0xc00: 0x10200008, | |
11184 | 0xd00: 0x202008, | |
11185 | 0xe00: 0x2008, | |
11186 | 0xf00: 0x10202000, | |
11187 | 0x80: 0x10200000, | |
11188 | 0x180: 0x10202008, | |
11189 | 0x280: 0x8, | |
11190 | 0x380: 0x200000, | |
11191 | 0x480: 0x202008, | |
11192 | 0x580: 0x10000008, | |
11193 | 0x680: 0x10002000, | |
11194 | 0x780: 0x2008, | |
11195 | 0x880: 0x200008, | |
11196 | 0x980: 0x2000, | |
11197 | 0xa80: 0x10002008, | |
11198 | 0xb80: 0x10200008, | |
11199 | 0xc80: 0x0, | |
11200 | 0xd80: 0x10202000, | |
11201 | 0xe80: 0x202000, | |
11202 | 0xf80: 0x10000000, | |
11203 | 0x1000: 0x10002000, | |
11204 | 0x1100: 0x10200008, | |
11205 | 0x1200: 0x10202008, | |
11206 | 0x1300: 0x2008, | |
11207 | 0x1400: 0x200000, | |
11208 | 0x1500: 0x10000000, | |
11209 | 0x1600: 0x10000008, | |
11210 | 0x1700: 0x202000, | |
11211 | 0x1800: 0x202008, | |
11212 | 0x1900: 0x0, | |
11213 | 0x1a00: 0x8, | |
11214 | 0x1b00: 0x10200000, | |
11215 | 0x1c00: 0x2000, | |
11216 | 0x1d00: 0x10002008, | |
11217 | 0x1e00: 0x10202000, | |
11218 | 0x1f00: 0x200008, | |
11219 | 0x1080: 0x8, | |
11220 | 0x1180: 0x202000, | |
11221 | 0x1280: 0x200000, | |
11222 | 0x1380: 0x10000008, | |
11223 | 0x1480: 0x10002000, | |
11224 | 0x1580: 0x2008, | |
11225 | 0x1680: 0x10202008, | |
11226 | 0x1780: 0x10200000, | |
11227 | 0x1880: 0x10202000, | |
11228 | 0x1980: 0x10200008, | |
11229 | 0x1a80: 0x2000, | |
11230 | 0x1b80: 0x202008, | |
11231 | 0x1c80: 0x200008, | |
11232 | 0x1d80: 0x0, | |
11233 | 0x1e80: 0x10000000, | |
11234 | 0x1f80: 0x10002008 | |
11235 | }, | |
11236 | { | |
11237 | 0x0: 0x100000, | |
11238 | 0x10: 0x2000401, | |
11239 | 0x20: 0x400, | |
11240 | 0x30: 0x100401, | |
11241 | 0x40: 0x2100401, | |
11242 | 0x50: 0x0, | |
11243 | 0x60: 0x1, | |
11244 | 0x70: 0x2100001, | |
11245 | 0x80: 0x2000400, | |
11246 | 0x90: 0x100001, | |
11247 | 0xa0: 0x2000001, | |
11248 | 0xb0: 0x2100400, | |
11249 | 0xc0: 0x2100000, | |
11250 | 0xd0: 0x401, | |
11251 | 0xe0: 0x100400, | |
11252 | 0xf0: 0x2000000, | |
11253 | 0x8: 0x2100001, | |
11254 | 0x18: 0x0, | |
11255 | 0x28: 0x2000401, | |
11256 | 0x38: 0x2100400, | |
11257 | 0x48: 0x100000, | |
11258 | 0x58: 0x2000001, | |
11259 | 0x68: 0x2000000, | |
11260 | 0x78: 0x401, | |
11261 | 0x88: 0x100401, | |
11262 | 0x98: 0x2000400, | |
11263 | 0xa8: 0x2100000, | |
11264 | 0xb8: 0x100001, | |
11265 | 0xc8: 0x400, | |
11266 | 0xd8: 0x2100401, | |
11267 | 0xe8: 0x1, | |
11268 | 0xf8: 0x100400, | |
11269 | 0x100: 0x2000000, | |
11270 | 0x110: 0x100000, | |
11271 | 0x120: 0x2000401, | |
11272 | 0x130: 0x2100001, | |
11273 | 0x140: 0x100001, | |
11274 | 0x150: 0x2000400, | |
11275 | 0x160: 0x2100400, | |
11276 | 0x170: 0x100401, | |
11277 | 0x180: 0x401, | |
11278 | 0x190: 0x2100401, | |
11279 | 0x1a0: 0x100400, | |
11280 | 0x1b0: 0x1, | |
11281 | 0x1c0: 0x0, | |
11282 | 0x1d0: 0x2100000, | |
11283 | 0x1e0: 0x2000001, | |
11284 | 0x1f0: 0x400, | |
11285 | 0x108: 0x100400, | |
11286 | 0x118: 0x2000401, | |
11287 | 0x128: 0x2100001, | |
11288 | 0x138: 0x1, | |
11289 | 0x148: 0x2000000, | |
11290 | 0x158: 0x100000, | |
11291 | 0x168: 0x401, | |
11292 | 0x178: 0x2100400, | |
11293 | 0x188: 0x2000001, | |
11294 | 0x198: 0x2100000, | |
11295 | 0x1a8: 0x0, | |
11296 | 0x1b8: 0x2100401, | |
11297 | 0x1c8: 0x100401, | |
11298 | 0x1d8: 0x400, | |
11299 | 0x1e8: 0x2000400, | |
11300 | 0x1f8: 0x100001 | |
11301 | }, | |
11302 | { | |
11303 | 0x0: 0x8000820, | |
11304 | 0x1: 0x20000, | |
11305 | 0x2: 0x8000000, | |
11306 | 0x3: 0x20, | |
11307 | 0x4: 0x20020, | |
11308 | 0x5: 0x8020820, | |
11309 | 0x6: 0x8020800, | |
11310 | 0x7: 0x800, | |
11311 | 0x8: 0x8020000, | |
11312 | 0x9: 0x8000800, | |
11313 | 0xa: 0x20800, | |
11314 | 0xb: 0x8020020, | |
11315 | 0xc: 0x820, | |
11316 | 0xd: 0x0, | |
11317 | 0xe: 0x8000020, | |
11318 | 0xf: 0x20820, | |
11319 | 0x80000000: 0x800, | |
11320 | 0x80000001: 0x8020820, | |
11321 | 0x80000002: 0x8000820, | |
11322 | 0x80000003: 0x8000000, | |
11323 | 0x80000004: 0x8020000, | |
11324 | 0x80000005: 0x20800, | |
11325 | 0x80000006: 0x20820, | |
11326 | 0x80000007: 0x20, | |
11327 | 0x80000008: 0x8000020, | |
11328 | 0x80000009: 0x820, | |
11329 | 0x8000000a: 0x20020, | |
11330 | 0x8000000b: 0x8020800, | |
11331 | 0x8000000c: 0x0, | |
11332 | 0x8000000d: 0x8020020, | |
11333 | 0x8000000e: 0x8000800, | |
11334 | 0x8000000f: 0x20000, | |
11335 | 0x10: 0x20820, | |
11336 | 0x11: 0x8020800, | |
11337 | 0x12: 0x20, | |
11338 | 0x13: 0x800, | |
11339 | 0x14: 0x8000800, | |
11340 | 0x15: 0x8000020, | |
11341 | 0x16: 0x8020020, | |
11342 | 0x17: 0x20000, | |
11343 | 0x18: 0x0, | |
11344 | 0x19: 0x20020, | |
11345 | 0x1a: 0x8020000, | |
11346 | 0x1b: 0x8000820, | |
11347 | 0x1c: 0x8020820, | |
11348 | 0x1d: 0x20800, | |
11349 | 0x1e: 0x820, | |
11350 | 0x1f: 0x8000000, | |
11351 | 0x80000010: 0x20000, | |
11352 | 0x80000011: 0x800, | |
11353 | 0x80000012: 0x8020020, | |
11354 | 0x80000013: 0x20820, | |
11355 | 0x80000014: 0x20, | |
11356 | 0x80000015: 0x8020000, | |
11357 | 0x80000016: 0x8000000, | |
11358 | 0x80000017: 0x8000820, | |
11359 | 0x80000018: 0x8020820, | |
11360 | 0x80000019: 0x8000020, | |
11361 | 0x8000001a: 0x8000800, | |
11362 | 0x8000001b: 0x0, | |
11363 | 0x8000001c: 0x20800, | |
11364 | 0x8000001d: 0x820, | |
11365 | 0x8000001e: 0x20020, | |
11366 | 0x8000001f: 0x8020800 | |
11367 | } | |
11368 | ]; | |
11369 | ||
11370 | // Masks that select the SBOX input | |
11371 | var SBOX_MASK = [ | |
11372 | 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000, | |
11373 | 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f | |
11374 | ]; | |
11375 | ||
11376 | /** | |
11377 | * DES block cipher algorithm. | |
11378 | */ | |
11379 | var DES = C_algo.DES = BlockCipher.extend({ | |
11380 | _doReset: function () { | |
11381 | // Shortcuts | |
11382 | var key = this._key; | |
11383 | var keyWords = key.words; | |
11384 | ||
11385 | // Select 56 bits according to PC1 | |
11386 | var keyBits = []; | |
11387 | for (var i = 0; i < 56; i++) { | |
11388 | var keyBitPos = PC1[i] - 1; | |
11389 | keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1; | |
11390 | } | |
11391 | ||
11392 | // Assemble 16 subkeys | |
11393 | var subKeys = this._subKeys = []; | |
11394 | for (var nSubKey = 0; nSubKey < 16; nSubKey++) { | |
11395 | // Create subkey | |
11396 | var subKey = subKeys[nSubKey] = []; | |
11397 | ||
11398 | // Shortcut | |
11399 | var bitShift = BIT_SHIFTS[nSubKey]; | |
11400 | ||
11401 | // Select 48 bits according to PC2 | |
11402 | for (var i = 0; i < 24; i++) { | |
11403 | // Select from the left 28 key bits | |
11404 | subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6); | |
11405 | ||
11406 | // Select from the right 28 key bits | |
11407 | subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6); | |
11408 | } | |
11409 | ||
11410 | // Since each subkey is applied to an expanded 32-bit input, | |
11411 | // the subkey can be broken into 8 values scaled to 32-bits, | |
11412 | // which allows the key to be used without expansion | |
11413 | subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31); | |
11414 | for (var i = 1; i < 7; i++) { | |
11415 | subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3); | |
11416 | } | |
11417 | subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27); | |
11418 | } | |
11419 | ||
11420 | // Compute inverse subkeys | |
11421 | var invSubKeys = this._invSubKeys = []; | |
11422 | for (var i = 0; i < 16; i++) { | |
11423 | invSubKeys[i] = subKeys[15 - i]; | |
11424 | } | |
11425 | }, | |
11426 | ||
11427 | encryptBlock: function (M, offset) { | |
11428 | this._doCryptBlock(M, offset, this._subKeys); | |
11429 | }, | |
11430 | ||
11431 | decryptBlock: function (M, offset) { | |
11432 | this._doCryptBlock(M, offset, this._invSubKeys); | |
11433 | }, | |
11434 | ||
11435 | _doCryptBlock: function (M, offset, subKeys) { | |
11436 | // Get input | |
11437 | this._lBlock = M[offset]; | |
11438 | this._rBlock = M[offset + 1]; | |
11439 | ||
11440 | // Initial permutation | |
11441 | exchangeLR.call(this, 4, 0x0f0f0f0f); | |
11442 | exchangeLR.call(this, 16, 0x0000ffff); | |
11443 | exchangeRL.call(this, 2, 0x33333333); | |
11444 | exchangeRL.call(this, 8, 0x00ff00ff); | |
11445 | exchangeLR.call(this, 1, 0x55555555); | |
11446 | ||
11447 | // Rounds | |
11448 | for (var round = 0; round < 16; round++) { | |
11449 | // Shortcuts | |
11450 | var subKey = subKeys[round]; | |
11451 | var lBlock = this._lBlock; | |
11452 | var rBlock = this._rBlock; | |
11453 | ||
11454 | // Feistel function | |
11455 | var f = 0; | |
11456 | for (var i = 0; i < 8; i++) { | |
11457 | f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0]; | |
11458 | } | |
11459 | this._lBlock = rBlock; | |
11460 | this._rBlock = lBlock ^ f; | |
11461 | } | |
11462 | ||
11463 | // Undo swap from last round | |
11464 | var t = this._lBlock; | |
11465 | this._lBlock = this._rBlock; | |
11466 | this._rBlock = t; | |
11467 | ||
11468 | // Final permutation | |
11469 | exchangeLR.call(this, 1, 0x55555555); | |
11470 | exchangeRL.call(this, 8, 0x00ff00ff); | |
11471 | exchangeRL.call(this, 2, 0x33333333); | |
11472 | exchangeLR.call(this, 16, 0x0000ffff); | |
11473 | exchangeLR.call(this, 4, 0x0f0f0f0f); | |
11474 | ||
11475 | // Set output | |
11476 | M[offset] = this._lBlock; | |
11477 | M[offset + 1] = this._rBlock; | |
11478 | }, | |
11479 | ||
11480 | keySize: 64/32, | |
11481 | ||
11482 | ivSize: 64/32, | |
11483 | ||
11484 | blockSize: 64/32 | |
11485 | }); | |
11486 | ||
11487 | // Swap bits across the left and right words | |
11488 | function exchangeLR(offset, mask) { | |
11489 | var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask; | |
11490 | this._rBlock ^= t; | |
11491 | this._lBlock ^= t << offset; | |
11492 | } | |
11493 | ||
11494 | function exchangeRL(offset, mask) { | |
11495 | var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask; | |
11496 | this._lBlock ^= t; | |
11497 | this._rBlock ^= t << offset; | |
11498 | } | |
11499 | ||
11500 | /** | |
11501 | * Shortcut functions to the cipher's object interface. | |
11502 | * | |
11503 | * @example | |
11504 | * | |
11505 | * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg); | |
11506 | * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg); | |
11507 | */ | |
11508 | C.DES = BlockCipher._createHelper(DES); | |
11509 | ||
11510 | /** | |
11511 | * Triple-DES block cipher algorithm. | |
11512 | */ | |
11513 | var TripleDES = C_algo.TripleDES = BlockCipher.extend({ | |
11514 | _doReset: function () { | |
11515 | // Shortcuts | |
11516 | var key = this._key; | |
11517 | var keyWords = key.words; | |
11518 | ||
11519 | // Create DES instances | |
11520 | this._des1 = DES.createEncryptor(WordArray.create(keyWords.slice(0, 2))); | |
11521 | this._des2 = DES.createEncryptor(WordArray.create(keyWords.slice(2, 4))); | |
11522 | this._des3 = DES.createEncryptor(WordArray.create(keyWords.slice(4, 6))); | |
11523 | }, | |
11524 | ||
11525 | encryptBlock: function (M, offset) { | |
11526 | this._des1.encryptBlock(M, offset); | |
11527 | this._des2.decryptBlock(M, offset); | |
11528 | this._des3.encryptBlock(M, offset); | |
11529 | }, | |
11530 | ||
11531 | decryptBlock: function (M, offset) { | |
11532 | this._des3.decryptBlock(M, offset); | |
11533 | this._des2.encryptBlock(M, offset); | |
11534 | this._des1.decryptBlock(M, offset); | |
11535 | }, | |
11536 | ||
11537 | keySize: 192/32, | |
11538 | ||
11539 | ivSize: 64/32, | |
11540 | ||
11541 | blockSize: 64/32 | |
11542 | }); | |
11543 | ||
11544 | /** | |
11545 | * Shortcut functions to the cipher's object interface. | |
11546 | * | |
11547 | * @example | |
11548 | * | |
11549 | * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg); | |
11550 | * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg); | |
11551 | */ | |
11552 | C.TripleDES = BlockCipher._createHelper(TripleDES); | |
11553 | }()); | |
11554 | ||
11555 | ||
11556 | return CryptoJS.TripleDES; | |
11557 | ||
11558 | })); | |
11559 | },{"./cipher-core":30,"./core":31,"./enc-base64":32,"./evpkdf":34,"./md5":39}],62:[function(_dereq_,module,exports){ | |
11560 | ;(function (root, factory) { | |
11561 | if (typeof exports === "object") { | |
11562 | // CommonJS | |
11563 | module.exports = exports = factory(_dereq_("./core")); | |
11564 | } | |
11565 | else if (typeof define === "function" && define.amd) { | |
11566 | // AMD | |
11567 | define(["./core"], factory); | |
11568 | } | |
11569 | else { | |
11570 | // Global (browser) | |
11571 | factory(root.CryptoJS); | |
11572 | } | |
11573 | }(this, function (CryptoJS) { | |
11574 | ||
11575 | (function (undefined) { | |
11576 | // Shortcuts | |
11577 | var C = CryptoJS; | |
11578 | var C_lib = C.lib; | |
11579 | var Base = C_lib.Base; | |
11580 | var X32WordArray = C_lib.WordArray; | |
11581 | ||
11582 | /** | |
11583 | * x64 namespace. | |
11584 | */ | |
11585 | var C_x64 = C.x64 = {}; | |
11586 | ||
11587 | /** | |
11588 | * A 64-bit word. | |
11589 | */ | |
11590 | var X64Word = C_x64.Word = Base.extend({ | |
11591 | /** | |
11592 | * Initializes a newly created 64-bit word. | |
11593 | * | |
11594 | * @param {number} high The high 32 bits. | |
11595 | * @param {number} low The low 32 bits. | |
11596 | * | |
11597 | * @example | |
11598 | * | |
11599 | * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607); | |
11600 | */ | |
11601 | init: function (high, low) { | |
11602 | this.high = high; | |
11603 | this.low = low; | |
11604 | } | |
11605 | ||
11606 | /** | |
11607 | * Bitwise NOTs this word. | |
11608 | * | |
11609 | * @return {X64Word} A new x64-Word object after negating. | |
11610 | * | |
11611 | * @example | |
11612 | * | |
11613 | * var negated = x64Word.not(); | |
11614 | */ | |
11615 | // not: function () { | |
11616 | // var high = ~this.high; | |
11617 | // var low = ~this.low; | |
11618 | ||
11619 | // return X64Word.create(high, low); | |
11620 | // }, | |
11621 | ||
11622 | /** | |
11623 | * Bitwise ANDs this word with the passed word. | |
11624 | * | |
11625 | * @param {X64Word} word The x64-Word to AND with this word. | |
11626 | * | |
11627 | * @return {X64Word} A new x64-Word object after ANDing. | |
11628 | * | |
11629 | * @example | |
11630 | * | |
11631 | * var anded = x64Word.and(anotherX64Word); | |
11632 | */ | |
11633 | // and: function (word) { | |
11634 | // var high = this.high & word.high; | |
11635 | // var low = this.low & word.low; | |
11636 | ||
11637 | // return X64Word.create(high, low); | |
11638 | // }, | |
11639 | ||
11640 | /** | |
11641 | * Bitwise ORs this word with the passed word. | |
11642 | * | |
11643 | * @param {X64Word} word The x64-Word to OR with this word. | |
11644 | * | |
11645 | * @return {X64Word} A new x64-Word object after ORing. | |
11646 | * | |
11647 | * @example | |
11648 | * | |
11649 | * var ored = x64Word.or(anotherX64Word); | |
11650 | */ | |
11651 | // or: function (word) { | |
11652 | // var high = this.high | word.high; | |
11653 | // var low = this.low | word.low; | |
11654 | ||
11655 | // return X64Word.create(high, low); | |
11656 | // }, | |
11657 | ||
11658 | /** | |
11659 | * Bitwise XORs this word with the passed word. | |
11660 | * | |
11661 | * @param {X64Word} word The x64-Word to XOR with this word. | |
11662 | * | |
11663 | * @return {X64Word} A new x64-Word object after XORing. | |
11664 | * | |
11665 | * @example | |
11666 | * | |
11667 | * var xored = x64Word.xor(anotherX64Word); | |
11668 | */ | |
11669 | // xor: function (word) { | |
11670 | // var high = this.high ^ word.high; | |
11671 | // var low = this.low ^ word.low; | |
11672 | ||
11673 | // return X64Word.create(high, low); | |
11674 | // }, | |
11675 | ||
11676 | /** | |
11677 | * Shifts this word n bits to the left. | |
11678 | * | |
11679 | * @param {number} n The number of bits to shift. | |
11680 | * | |
11681 | * @return {X64Word} A new x64-Word object after shifting. | |
11682 | * | |
11683 | * @example | |
11684 | * | |
11685 | * var shifted = x64Word.shiftL(25); | |
11686 | */ | |
11687 | // shiftL: function (n) { | |
11688 | // if (n < 32) { | |
11689 | // var high = (this.high << n) | (this.low >>> (32 - n)); | |
11690 | // var low = this.low << n; | |
11691 | // } else { | |
11692 | // var high = this.low << (n - 32); | |
11693 | // var low = 0; | |
11694 | // } | |
11695 | ||
11696 | // return X64Word.create(high, low); | |
11697 | // }, | |
11698 | ||
11699 | /** | |
11700 | * Shifts this word n bits to the right. | |
11701 | * | |
11702 | * @param {number} n The number of bits to shift. | |
11703 | * | |
11704 | * @return {X64Word} A new x64-Word object after shifting. | |
11705 | * | |
11706 | * @example | |
11707 | * | |
11708 | * var shifted = x64Word.shiftR(7); | |
11709 | */ | |
11710 | // shiftR: function (n) { | |
11711 | // if (n < 32) { | |
11712 | // var low = (this.low >>> n) | (this.high << (32 - n)); | |
11713 | // var high = this.high >>> n; | |
11714 | // } else { | |
11715 | // var low = this.high >>> (n - 32); | |
11716 | // var high = 0; | |
11717 | // } | |
11718 | ||
11719 | // return X64Word.create(high, low); | |
11720 | // }, | |
11721 | ||
11722 | /** | |
11723 | * Rotates this word n bits to the left. | |
11724 | * | |
11725 | * @param {number} n The number of bits to rotate. | |
11726 | * | |
11727 | * @return {X64Word} A new x64-Word object after rotating. | |
11728 | * | |
11729 | * @example | |
11730 | * | |
11731 | * var rotated = x64Word.rotL(25); | |
11732 | */ | |
11733 | // rotL: function (n) { | |
11734 | // return this.shiftL(n).or(this.shiftR(64 - n)); | |
11735 | // }, | |
11736 | ||
11737 | /** | |
11738 | * Rotates this word n bits to the right. | |
11739 | * | |
11740 | * @param {number} n The number of bits to rotate. | |
11741 | * | |
11742 | * @return {X64Word} A new x64-Word object after rotating. | |
11743 | * | |
11744 | * @example | |
11745 | * | |
11746 | * var rotated = x64Word.rotR(7); | |
11747 | */ | |
11748 | // rotR: function (n) { | |
11749 | // return this.shiftR(n).or(this.shiftL(64 - n)); | |
11750 | // }, | |
11751 | ||
11752 | /** | |
11753 | * Adds this word with the passed word. | |
11754 | * | |
11755 | * @param {X64Word} word The x64-Word to add with this word. | |
11756 | * | |
11757 | * @return {X64Word} A new x64-Word object after adding. | |
11758 | * | |
11759 | * @example | |
11760 | * | |
11761 | * var added = x64Word.add(anotherX64Word); | |
11762 | */ | |
11763 | // add: function (word) { | |
11764 | // var low = (this.low + word.low) | 0; | |
11765 | // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0; | |
11766 | // var high = (this.high + word.high + carry) | 0; | |
11767 | ||
11768 | // return X64Word.create(high, low); | |
11769 | // } | |
11770 | }); | |
11771 | ||
11772 | /** | |
11773 | * An array of 64-bit words. | |
11774 | * | |
11775 | * @property {Array} words The array of CryptoJS.x64.Word objects. | |
11776 | * @property {number} sigBytes The number of significant bytes in this word array. | |
11777 | */ | |
11778 | var X64WordArray = C_x64.WordArray = Base.extend({ | |
11779 | /** | |
11780 | * Initializes a newly created word array. | |
11781 | * | |
11782 | * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects. | |
11783 | * @param {number} sigBytes (Optional) The number of significant bytes in the words. | |
11784 | * | |
11785 | * @example | |
11786 | * | |
11787 | * var wordArray = CryptoJS.x64.WordArray.create(); | |
11788 | * | |
11789 | * var wordArray = CryptoJS.x64.WordArray.create([ | |
11790 | * CryptoJS.x64.Word.create(0x00010203, 0x04050607), | |
11791 | * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) | |
11792 | * ]); | |
11793 | * | |
11794 | * var wordArray = CryptoJS.x64.WordArray.create([ | |
11795 | * CryptoJS.x64.Word.create(0x00010203, 0x04050607), | |
11796 | * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) | |
11797 | * ], 10); | |
11798 | */ | |
11799 | init: function (words, sigBytes) { | |
11800 | words = this.words = words || []; | |
11801 | ||
11802 | if (sigBytes != undefined) { | |
11803 | this.sigBytes = sigBytes; | |
11804 | } else { | |
11805 | this.sigBytes = words.length * 8; | |
11806 | } | |
11807 | }, | |
11808 | ||
11809 | /** | |
11810 | * Converts this 64-bit word array to a 32-bit word array. | |
11811 | * | |
11812 | * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array. | |
11813 | * | |
11814 | * @example | |
11815 | * | |
11816 | * var x32WordArray = x64WordArray.toX32(); | |
11817 | */ | |
11818 | toX32: function () { | |
11819 | // Shortcuts | |
11820 | var x64Words = this.words; | |
11821 | var x64WordsLength = x64Words.length; | |
11822 | ||
11823 | // Convert | |
11824 | var x32Words = []; | |
11825 | for (var i = 0; i < x64WordsLength; i++) { | |
11826 | var x64Word = x64Words[i]; | |
11827 | x32Words.push(x64Word.high); | |
11828 | x32Words.push(x64Word.low); | |
11829 | } | |
11830 | ||
11831 | return X32WordArray.create(x32Words, this.sigBytes); | |
11832 | }, | |
11833 | ||
11834 | /** | |
11835 | * Creates a copy of this word array. | |
11836 | * | |
11837 | * @return {X64WordArray} The clone. | |
11838 | * | |
11839 | * @example | |
11840 | * | |
11841 | * var clone = x64WordArray.clone(); | |
11842 | */ | |
11843 | clone: function () { | |
11844 | var clone = Base.clone.call(this); | |
11845 | ||
11846 | // Clone "words" array | |
11847 | var words = clone.words = this.words.slice(0); | |
11848 | ||
11849 | // Clone each X64Word object | |
11850 | var wordsLength = words.length; | |
11851 | for (var i = 0; i < wordsLength; i++) { | |
11852 | words[i] = words[i].clone(); | |
11853 | } | |
11854 | ||
11855 | return clone; | |
11856 | } | |
11857 | }); | |
11858 | }()); | |
11859 | ||
11860 | ||
11861 | return CryptoJS; | |
11862 | ||
11863 | })); | |
11864 | },{"./core":31}],63:[function(_dereq_,module,exports){ | |
11865 | var assert = _dereq_('assert') | |
11866 | var BigInteger = _dereq_('bigi') | |
11867 | ||
11868 | var Point = _dereq_('./point') | |
11869 | ||
11870 | function Curve(p, a, b, Gx, Gy, n, h) { | |
11871 | this.p = p | |
11872 | this.a = a | |
11873 | this.b = b | |
11874 | this.G = Point.fromAffine(this, Gx, Gy) | |
11875 | this.n = n | |
11876 | this.h = h | |
11877 | ||
11878 | this.infinity = new Point(this, null, null, BigInteger.ZERO) | |
11879 | ||
11880 | // result caching | |
11881 | this.pOverFour = p.add(BigInteger.ONE).shiftRight(2) | |
11882 | } | |
11883 | ||
11884 | Curve.prototype.pointFromX = function(isOdd, x) { | |
11885 | var alpha = x.pow(3).add(this.a.multiply(x)).add(this.b).mod(this.p) | |
11886 | var beta = alpha.modPow(this.pOverFour, this.p) | |
11887 | ||
11888 | var y = beta | |
11889 | if (beta.isEven() ^ !isOdd) { | |
11890 | y = this.p.subtract(y) // -y % p | |
11891 | } | |
11892 | ||
11893 | return Point.fromAffine(this, x, y) | |
11894 | } | |
11895 | ||
11896 | Curve.prototype.isInfinity = function(Q) { | |
11897 | if (Q === this.infinity) return true | |
11898 | ||
11899 | return Q.z.signum() === 0 && Q.y.signum() !== 0 | |
11900 | } | |
11901 | ||
11902 | Curve.prototype.isOnCurve = function(Q) { | |
11903 | if (this.isInfinity(Q)) return true | |
11904 | ||
11905 | var x = Q.affineX | |
11906 | var y = Q.affineY | |
11907 | var a = this.a | |
11908 | var b = this.b | |
11909 | var p = this.p | |
11910 | ||
11911 | // Check that xQ and yQ are integers in the interval [0, p - 1] | |
11912 | if (x.signum() < 0 || x.compareTo(p) >= 0) return false | |
11913 | if (y.signum() < 0 || y.compareTo(p) >= 0) return false | |
11914 | ||
11915 | // and check that y^2 = x^3 + ax + b (mod p) | |
11916 | var lhs = y.square().mod(p) | |
11917 | var rhs = x.pow(3).add(a.multiply(x)).add(b).mod(p) | |
11918 | return lhs.equals(rhs) | |
11919 | } | |
11920 | ||
11921 | /** | |
11922 | * Validate an elliptic curve point. | |
11923 | * | |
11924 | * See SEC 1, section 3.2.2.1: Elliptic Curve Public Key Validation Primitive | |
11925 | */ | |
11926 | Curve.prototype.validate = function(Q) { | |
11927 | // Check Q != O | |
11928 | assert(!this.isInfinity(Q), 'Point is at infinity') | |
11929 | assert(this.isOnCurve(Q), 'Point is not on the curve') | |
11930 | ||
11931 | // Check nQ = O (where Q is a scalar multiple of G) | |
11932 | var nQ = Q.multiply(this.n) | |
11933 | assert(this.isInfinity(nQ), 'Point is not a scalar multiple of G') | |
11934 | ||
11935 | return true | |
11936 | } | |
11937 | ||
11938 | module.exports = Curve | |
11939 | ||
11940 | },{"./point":67,"assert":4,"bigi":3}],64:[function(_dereq_,module,exports){ | |
11941 | module.exports={ | |
11942 | "secp128r1": { | |
11943 | "p": "fffffffdffffffffffffffffffffffff", | |
11944 | "a": "fffffffdfffffffffffffffffffffffc", | |
11945 | "b": "e87579c11079f43dd824993c2cee5ed3", | |
11946 | "n": "fffffffe0000000075a30d1b9038a115", | |
11947 | "h": "01", | |
11948 | "Gx": "161ff7528b899b2d0c28607ca52c5b86", | |
11949 | "Gy": "cf5ac8395bafeb13c02da292dded7a83" | |
11950 | }, | |
11951 | "secp160k1": { | |
11952 | "p": "fffffffffffffffffffffffffffffffeffffac73", | |
11953 | "a": "00", | |
11954 | "b": "07", | |
11955 | "n": "0100000000000000000001b8fa16dfab9aca16b6b3", | |
11956 | "h": "01", | |
11957 | "Gx": "3b4c382ce37aa192a4019e763036f4f5dd4d7ebb", | |
11958 | "Gy": "938cf935318fdced6bc28286531733c3f03c4fee" | |
11959 | }, | |
11960 | "secp160r1": { | |
11961 | "p": "ffffffffffffffffffffffffffffffff7fffffff", | |
11962 | "a": "ffffffffffffffffffffffffffffffff7ffffffc", | |
11963 | "b": "1c97befc54bd7a8b65acf89f81d4d4adc565fa45", | |
11964 | "n": "0100000000000000000001f4c8f927aed3ca752257", | |
11965 | "h": "01", | |
11966 | "Gx": "4a96b5688ef573284664698968c38bb913cbfc82", | |
11967 | "Gy": "23a628553168947d59dcc912042351377ac5fb32" | |
11968 | }, | |
11969 | "secp192k1": { | |
11970 | "p": "fffffffffffffffffffffffffffffffffffffffeffffee37", | |
11971 | "a": "00", | |
11972 | "b": "03", | |
11973 | "n": "fffffffffffffffffffffffe26f2fc170f69466a74defd8d", | |
11974 | "h": "01", | |
11975 | "Gx": "db4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d", | |
11976 | "Gy": "9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d" | |
11977 | }, | |
11978 | "secp192r1": { | |
11979 | "p": "fffffffffffffffffffffffffffffffeffffffffffffffff", | |
11980 | "a": "fffffffffffffffffffffffffffffffefffffffffffffffc", | |
11981 | "b": "64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", | |
11982 | "n": "ffffffffffffffffffffffff99def836146bc9b1b4d22831", | |
11983 | "h": "01", | |
11984 | "Gx": "188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012", | |
11985 | "Gy": "07192b95ffc8da78631011ed6b24cdd573f977a11e794811" | |
11986 | }, | |
11987 | "secp224r1": { | |
11988 | "p": "ffffffffffffffffffffffffffffffff000000000000000000000001", | |
11989 | "a": "fffffffffffffffffffffffffffffffefffffffffffffffffffffffe", | |
11990 | "b": "b4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4", | |
11991 | "n": "ffffffffffffffffffffffffffff16a2e0b8f03e13dd29455c5c2a3d", | |
11992 | "h": "01", | |
11993 | "Gx": "b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21", | |
11994 | "Gy": "bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34" | |
11995 | }, | |
11996 | "secp256k1": { | |
11997 | "p": "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", | |
11998 | "a": "00", | |
11999 | "b": "07", | |
12000 | "n": "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", | |
12001 | "h": "01", | |
12002 | "Gx": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", | |
12003 | "Gy": "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8" | |
12004 | }, | |
12005 | "secp256r1": { | |
12006 | "p": "ffffffff00000001000000000000000000000000ffffffffffffffffffffffff", | |
12007 | "a": "ffffffff00000001000000000000000000000000fffffffffffffffffffffffc", | |
12008 | "b": "5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b", | |
12009 | "n": "ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551", | |
12010 | "h": "01", | |
12011 | "Gx": "6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296", | |
12012 | "Gy": "4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5" | |
12013 | } | |
12014 | } | |
12015 | ||
12016 | },{}],65:[function(_dereq_,module,exports){ | |
12017 | var Point = _dereq_('./point') | |
12018 | var Curve = _dereq_('./curve') | |
12019 | ||
12020 | var getCurveByName = _dereq_('./names') | |
12021 | ||
12022 | module.exports = { | |
12023 | Curve: Curve, | |
12024 | Point: Point, | |
12025 | getCurveByName: getCurveByName | |
12026 | } | |
12027 | ||
12028 | },{"./curve":63,"./names":66,"./point":67}],66:[function(_dereq_,module,exports){ | |
12029 | var BigInteger = _dereq_('bigi') | |
12030 | ||
12031 | var curves = _dereq_('./curves') | |
12032 | var Curve = _dereq_('./curve') | |
12033 | ||
12034 | function getCurveByName(name) { | |
12035 | var curve = curves[name] | |
12036 | if (!curve) return null | |
12037 | ||
12038 | var p = new BigInteger(curve.p, 16) | |
12039 | var a = new BigInteger(curve.a, 16) | |
12040 | var b = new BigInteger(curve.b, 16) | |
12041 | var n = new BigInteger(curve.n, 16) | |
12042 | var h = new BigInteger(curve.h, 16) | |
12043 | var Gx = new BigInteger(curve.Gx, 16) | |
12044 | var Gy = new BigInteger(curve.Gy, 16) | |
12045 | ||
12046 | return new Curve(p, a, b, Gx, Gy, n, h) | |
12047 | } | |
12048 | ||
12049 | module.exports = getCurveByName | |
12050 | ||
12051 | },{"./curve":63,"./curves":64,"bigi":3}],67:[function(_dereq_,module,exports){ | |
12052 | (function (Buffer){ | |
12053 | var assert = _dereq_('assert') | |
12054 | var BigInteger = _dereq_('bigi') | |
12055 | ||
12056 | var THREE = BigInteger.valueOf(3) | |
12057 | ||
12058 | function Point(curve, x, y, z) { | |
12059 | assert.notStrictEqual(z, undefined, 'Missing Z coordinate') | |
12060 | ||
12061 | this.curve = curve | |
12062 | this.x = x | |
12063 | this.y = y | |
12064 | this.z = z | |
12065 | this._zInv = null | |
12066 | ||
12067 | this.compressed = true | |
12068 | } | |
12069 | ||
12070 | Object.defineProperty(Point.prototype, 'zInv', { | |
12071 | get: function() { | |
12072 | if (this._zInv === null) { | |
12073 | this._zInv = this.z.modInverse(this.curve.p) | |
12074 | } | |
12075 | ||
12076 | return this._zInv | |
12077 | } | |
12078 | }) | |
12079 | ||
12080 | Object.defineProperty(Point.prototype, 'affineX', { | |
12081 | get: function() { | |
12082 | return this.x.multiply(this.zInv).mod(this.curve.p) | |
12083 | } | |
12084 | }) | |
12085 | ||
12086 | Object.defineProperty(Point.prototype, 'affineY', { | |
12087 | get: function() { | |
12088 | return this.y.multiply(this.zInv).mod(this.curve.p) | |
12089 | } | |
12090 | }) | |
12091 | ||
12092 | Point.fromAffine = function(curve, x, y) { | |
12093 | return new Point(curve, x, y, BigInteger.ONE) | |
12094 | } | |
12095 | ||
12096 | Point.prototype.equals = function(other) { | |
12097 | if (other === this) return true | |
12098 | if (this.curve.isInfinity(this)) return this.curve.isInfinity(other) | |
12099 | if (this.curve.isInfinity(other)) return this.curve.isInfinity(this) | |
12100 | ||
12101 | // u = Y2 * Z1 - Y1 * Z2 | |
12102 | var u = other.y.multiply(this.z).subtract(this.y.multiply(other.z)).mod(this.curve.p) | |
12103 | ||
12104 | if (u.signum() !== 0) return false | |
12105 | ||
12106 | // v = X2 * Z1 - X1 * Z2 | |
12107 | var v = other.x.multiply(this.z).subtract(this.x.multiply(other.z)).mod(this.curve.p) | |
12108 | ||
12109 | return v.signum() === 0 | |
12110 | } | |
12111 | ||
12112 | Point.prototype.negate = function() { | |
12113 | var y = this.curve.p.subtract(this.y) | |
12114 | ||
12115 | return new Point(this.curve, this.x, y, this.z) | |
12116 | } | |
12117 | ||
12118 | Point.prototype.add = function(b) { | |
12119 | if (this.curve.isInfinity(this)) return b | |
12120 | if (this.curve.isInfinity(b)) return this | |
12121 | ||
12122 | var x1 = this.x | |
12123 | var y1 = this.y | |
12124 | var x2 = b.x | |
12125 | var y2 = b.y | |
12126 | ||
12127 | // u = Y2 * Z1 - Y1 * Z2 | |
12128 | var u = y2.multiply(this.z).subtract(y1.multiply(b.z)).mod(this.curve.p) | |
12129 | // v = X2 * Z1 - X1 * Z2 | |
12130 | var v = x2.multiply(this.z).subtract(x1.multiply(b.z)).mod(this.curve.p) | |
12131 | ||
12132 | if (v.signum() === 0) { | |
12133 | if (u.signum() === 0) { | |
12134 | return this.twice() // this == b, so double | |
12135 | } | |
12136 | ||
12137 | return this.curve.infinity // this = -b, so infinity | |
12138 | } | |
12139 | ||
12140 | var v2 = v.square() | |
12141 | var v3 = v2.multiply(v) | |
12142 | var x1v2 = x1.multiply(v2) | |
12143 | var zu2 = u.square().multiply(this.z) | |
12144 | ||
12145 | // x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3) | |
12146 | var x3 = zu2.subtract(x1v2.shiftLeft(1)).multiply(b.z).subtract(v3).multiply(v).mod(this.curve.p) | |
12147 | // y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3 | |
12148 | 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) | |
12149 | // z3 = v^3 * z1 * z2 | |
12150 | var z3 = v3.multiply(this.z).multiply(b.z).mod(this.curve.p) | |
12151 | ||
12152 | return new Point(this.curve, x3, y3, z3) | |
12153 | } | |
12154 | ||
12155 | Point.prototype.twice = function() { | |
12156 | if (this.curve.isInfinity(this)) return this | |
12157 | if (this.y.signum() === 0) return this.curve.infinity | |
12158 | ||
12159 | var x1 = this.x | |
12160 | var y1 = this.y | |
12161 | ||
12162 | var y1z1 = y1.multiply(this.z) | |
12163 | var y1sqz1 = y1z1.multiply(y1).mod(this.curve.p) | |
12164 | var a = this.curve.a | |
12165 | ||
12166 | // w = 3 * x1^2 + a * z1^2 | |
12167 | var w = x1.square().multiply(THREE) | |
12168 | ||
12169 | if (a.signum() !== 0) { | |
12170 | w = w.add(this.z.square().multiply(a)) | |
12171 | } | |
12172 | ||
12173 | w = w.mod(this.curve.p) | |
12174 | // x3 = 2 * y1 * z1 * (w^2 - 8 * x1 * y1^2 * z1) | |
12175 | var x3 = w.square().subtract(x1.shiftLeft(3).multiply(y1sqz1)).shiftLeft(1).multiply(y1z1).mod(this.curve.p) | |
12176 | // y3 = 4 * y1^2 * z1 * (3 * w * x1 - 2 * y1^2 * z1) - w^3 | |
12177 | var y3 = w.multiply(THREE).multiply(x1).subtract(y1sqz1.shiftLeft(1)).shiftLeft(2).multiply(y1sqz1).subtract(w.pow(3)).mod(this.curve.p) | |
12178 | // z3 = 8 * (y1 * z1)^3 | |
12179 | var z3 = y1z1.pow(3).shiftLeft(3).mod(this.curve.p) | |
12180 | ||
12181 | return new Point(this.curve, x3, y3, z3) | |
12182 | } | |
12183 | ||
12184 | // Simple NAF (Non-Adjacent Form) multiplication algorithm | |
12185 | // TODO: modularize the multiplication algorithm | |
12186 | Point.prototype.multiply = function(k) { | |
12187 | if (this.curve.isInfinity(this)) return this | |
12188 | if (k.signum() === 0) return this.curve.infinity | |
12189 | ||
12190 | var e = k | |
12191 | var h = e.multiply(THREE) | |
12192 | ||
12193 | var neg = this.negate() | |
12194 | var R = this | |
12195 | ||
12196 | for (var i = h.bitLength() - 2; i > 0; --i) { | |
12197 | R = R.twice() | |
12198 | ||
12199 | var hBit = h.testBit(i) | |
12200 | var eBit = e.testBit(i) | |
12201 | ||
12202 | if (hBit != eBit) { | |
12203 | R = R.add(hBit ? this : neg) | |
12204 | } | |
12205 | } | |
12206 | ||
12207 | return R | |
12208 | } | |
12209 | ||
12210 | // Compute this*j + x*k (simultaneous multiplication) | |
12211 | Point.prototype.multiplyTwo = function(j, x, k) { | |
12212 | var i | |
12213 | ||
12214 | if (j.bitLength() > k.bitLength()) | |
12215 | i = j.bitLength() - 1 | |
12216 | else | |
12217 | i = k.bitLength() - 1 | |
12218 | ||
12219 | var R = this.curve.infinity | |
12220 | var both = this.add(x) | |
12221 | ||
12222 | while (i >= 0) { | |
12223 | R = R.twice() | |
12224 | ||
12225 | var jBit = j.testBit(i) | |
12226 | var kBit = k.testBit(i) | |
12227 | ||
12228 | if (jBit) { | |
12229 | if (kBit) { | |
12230 | R = R.add(both) | |
12231 | ||
12232 | } else { | |
12233 | R = R.add(this) | |
12234 | } | |
12235 | ||
12236 | } else { | |
12237 | if (kBit) { | |
12238 | R = R.add(x) | |
12239 | } | |
12240 | } | |
12241 | --i | |
12242 | } | |
12243 | ||
12244 | return R | |
12245 | } | |
12246 | ||
12247 | Point.prototype.getEncoded = function(compressed) { | |
12248 | if (compressed == undefined) compressed = this.compressed | |
12249 | if (this.curve.isInfinity(this)) return new Buffer('00', 'hex') // Infinity point encoded is simply '00' | |
12250 | ||
12251 | var x = this.affineX | |
12252 | var y = this.affineY | |
12253 | ||
12254 | var buffer | |
12255 | ||
12256 | // Determine size of q in bytes | |
12257 | var byteLength = Math.floor((this.curve.p.bitLength() + 7) / 8) | |
12258 | ||
12259 | // 0x02/0x03 | X | |
12260 | if (compressed) { | |
12261 | buffer = new Buffer(1 + byteLength) | |
12262 | buffer.writeUInt8(y.isEven() ? 0x02 : 0x03, 0) | |
12263 | ||
12264 | // 0x04 | X | Y | |
12265 | } else { | |
12266 | buffer = new Buffer(1 + byteLength + byteLength) | |
12267 | buffer.writeUInt8(0x04, 0) | |
12268 | ||
12269 | y.toBuffer(byteLength).copy(buffer, 1 + byteLength) | |
12270 | } | |
12271 | ||
12272 | x.toBuffer(byteLength).copy(buffer, 1) | |
12273 | ||
12274 | return buffer | |
12275 | } | |
12276 | ||
12277 | Point.decodeFrom = function(curve, buffer) { | |
12278 | var type = buffer.readUInt8(0) | |
12279 | var compressed = (type !== 4) | |
12280 | ||
12281 | var x = BigInteger.fromBuffer(buffer.slice(1, 33)) | |
12282 | var byteLength = Math.floor((curve.p.bitLength() + 7) / 8) | |
12283 | ||
12284 | var Q | |
12285 | if (compressed) { | |
12286 | assert.equal(buffer.length, byteLength + 1, 'Invalid sequence length') | |
12287 | assert(type === 0x02 || type === 0x03, 'Invalid sequence tag') | |
12288 | ||
12289 | var isOdd = (type === 0x03) | |
12290 | Q = curve.pointFromX(isOdd, x) | |
12291 | ||
12292 | } else { | |
12293 | assert.equal(buffer.length, 1 + byteLength + byteLength, 'Invalid sequence length') | |
12294 | ||
12295 | var y = BigInteger.fromBuffer(buffer.slice(1 + byteLength)) | |
12296 | Q = Point.fromAffine(curve, x, y) | |
12297 | } | |
12298 | ||
12299 | Q.compressed = compressed | |
12300 | return Q | |
12301 | } | |
12302 | ||
12303 | Point.prototype.toString = function () { | |
12304 | if (this.curve.isInfinity(this)) return '(INFINITY)' | |
12305 | ||
12306 | return '(' + this.affineX.toString() + ',' + this.affineY.toString() + ')' | |
12307 | } | |
12308 | ||
12309 | module.exports = Point | |
12310 | ||
12311 | }).call(this,_dereq_("buffer").Buffer) | |
12312 | },{"assert":4,"bigi":3,"buffer":8}],68:[function(_dereq_,module,exports){ | |
12313 | (function (process,Buffer){ | |
12314 | // Closure compiler error - result of 'not' operator not being used | |
12315 | //!function(globals){ | |
12316 | (function(globals){ | |
12317 | 'use strict' | |
12318 | ||
12319 | //*** UMD BEGIN | |
12320 | if (typeof define !== 'undefined' && define.amd) { //require.js / AMD | |
12321 | define([], function() { | |
12322 | return secureRandom | |
12323 | }) | |
12324 | } else if (typeof module !== 'undefined' && module.exports) { //CommonJS | |
12325 | module.exports = secureRandom | |
12326 | } else { //script / browser | |
12327 | globals.secureRandom = secureRandom | |
12328 | } | |
12329 | //*** UMD END | |
12330 | ||
12331 | //options.type is the only valid option | |
12332 | function secureRandom(count, options) { | |
12333 | options = options || {type: 'Array'} | |
12334 | //we check for process.pid to prevent browserify from tricking us | |
12335 | if (typeof process != 'undefined' && typeof process.pid == 'number') { | |
12336 | return nodeRandom(count, options) | |
12337 | } else { | |
12338 | var crypto = window.crypto || window.msCrypto | |
12339 | if (!crypto) throw new Error("Your browser does not support window.crypto.") | |
12340 | return browserRandom(count, options) | |
12341 | } | |
12342 | } | |
12343 | ||
12344 | function nodeRandom(count, options) { | |
12345 | var crypto = _dereq_('crypto') | |
12346 | var buf = crypto.randomBytes(count) | |
12347 | ||
12348 | switch (options.type) { | |
12349 | case 'Array': | |
12350 | return [].slice.call(buf) | |
12351 | case 'Buffer': | |
12352 | return buf | |
12353 | case 'Uint8Array': | |
12354 | var arr = new Uint8Array(count) | |
12355 | for (var i = 0; i < count; ++i) { arr[i] = buf.readUInt8(i) } | |
12356 | return arr | |
12357 | default: | |
12358 | throw new Error(options.type + " is unsupported.") | |
12359 | } | |
12360 | } | |
12361 | ||
12362 | function browserRandom(count, options) { | |
12363 | var nativeArr = new Uint8Array(count) | |
12364 | var crypto = window.crypto || window.msCrypto | |
12365 | crypto.getRandomValues(nativeArr) | |
12366 | ||
12367 | switch (options.type) { | |
12368 | case 'Array': | |
12369 | return [].slice.call(nativeArr) | |
12370 | case 'Buffer': | |
12371 | 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.')} | |
12372 | return new Buffer(nativeArr) | |
12373 | case 'Uint8Array': | |
12374 | return nativeArr | |
12375 | default: | |
12376 | throw new Error(options.type + " is unsupported.") | |
12377 | } | |
12378 | } | |
12379 | ||
12380 | secureRandom.randomArray = function(byteCount) { | |
12381 | return secureRandom(byteCount, {type: 'Array'}) | |
12382 | } | |
12383 | ||
12384 | secureRandom.randomUint8Array = function(byteCount) { | |
12385 | return secureRandom(byteCount, {type: 'Uint8Array'}) | |
12386 | } | |
12387 | ||
12388 | secureRandom.randomBuffer = function(byteCount) { | |
12389 | return secureRandom(byteCount, {type: 'Buffer'}) | |
12390 | } | |
12391 | ||
12392 | ||
12393 | })(this); | |
12394 | ||
12395 | }).call(this,_dereq_("FWaASH"),_dereq_("buffer").Buffer) | |
12396 | },{"FWaASH":12,"buffer":8,"crypto":7}],69:[function(_dereq_,module,exports){ | |
12397 | (function (Buffer){ | |
12398 | var assert = _dereq_('assert') | |
12399 | var base58check = _dereq_('./base58check') | |
12400 | var networks = _dereq_('./networks') | |
12401 | var scripts = _dereq_('./scripts') | |
12402 | ||
12403 | function findScriptTypeByVersion(version) { | |
12404 | for (var networkName in networks) { | |
12405 | var network = networks[networkName] | |
12406 | ||
12407 | if (version === network.pubKeyHash) return 'pubkeyhash' | |
12408 | if (version === network.scriptHash) return 'scripthash' | |
12409 | } | |
12410 | } | |
12411 | ||
12412 | function Address(hash, version) { | |
12413 | assert(Buffer.isBuffer(hash), 'Expected Buffer, got ' + hash) | |
12414 | assert.strictEqual(hash.length, 20, 'Invalid hash length') | |
12415 | assert.strictEqual(version & 0xff, version, 'Invalid version byte') | |
12416 | ||
12417 | this.hash = hash | |
12418 | this.version = version | |
12419 | } | |
12420 | ||
12421 | // Import functions | |
12422 | Address.fromBase58Check = function(string) { | |
12423 | var payload = base58check.decode(string) | |
12424 | var version = payload.readUInt8(0) | |
12425 | var hash = payload.slice(1) | |
12426 | ||
12427 | return new Address(hash, version) | |
12428 | } | |
12429 | ||
12430 | Address.fromOutputScript = function(script, network) { | |
12431 | network = network || networks.bitcoin | |
12432 | ||
12433 | var type = scripts.classifyOutput(script) | |
12434 | ||
12435 | if (type === 'pubkeyhash') return new Address(script.chunks[2], network.pubKeyHash) | |
12436 | if (type === 'scripthash') return new Address(script.chunks[1], network.scriptHash) | |
12437 | ||
12438 | assert(false, type + ' has no matching Address') | |
12439 | } | |
12440 | ||
12441 | // Export functions | |
12442 | Address.prototype.toBase58Check = function () { | |
12443 | var payload = new Buffer(21) | |
12444 | payload.writeUInt8(this.version, 0) | |
12445 | this.hash.copy(payload, 1) | |
12446 | ||
12447 | return base58check.encode(payload) | |
12448 | } | |
12449 | ||
12450 | Address.prototype.toOutputScript = function() { | |
12451 | var scriptType = findScriptTypeByVersion(this.version) | |
12452 | ||
12453 | if (scriptType === 'pubkeyhash') return scripts.pubKeyHashOutput(this.hash) | |
12454 | if (scriptType === 'scripthash') return scripts.scriptHashOutput(this.hash) | |
12455 | ||
12456 | assert(false, this.toString() + ' has no matching Script') | |
12457 | } | |
12458 | ||
12459 | Address.prototype.toString = Address.prototype.toBase58Check | |
12460 | ||
12461 | module.exports = Address | |
12462 | ||
12463 | }).call(this,_dereq_("buffer").Buffer) | |
12464 | },{"./base58check":70,"./networks":81,"./scripts":84,"assert":4,"buffer":8}],70:[function(_dereq_,module,exports){ | |
12465 | (function (Buffer){ | |
12466 | // https://en.bitcoin.it/wiki/Base58Check_encoding | |
12467 | var assert = _dereq_('assert') | |
12468 | var base58 = _dereq_('bs58') | |
12469 | var crypto = _dereq_('./crypto') | |
12470 | ||
12471 | // Encode a buffer as a base58-check-encoded string | |
12472 | function encode(payload) { | |
12473 | var checksum = crypto.hash256(payload).slice(0, 4) | |
12474 | ||
12475 | return base58.encode(Buffer.concat([ | |
12476 | payload, | |
12477 | checksum | |
12478 | ])) | |
12479 | } | |
12480 | ||
12481 | // Decode a base58-check-encoded string to a buffer | |
12482 | function decode(string) { | |
12483 | var buffer = base58.decode(string) | |
12484 | ||
12485 | var payload = buffer.slice(0, -4) | |
12486 | var checksum = buffer.slice(-4) | |
12487 | var newChecksum = crypto.hash256(payload).slice(0, 4) | |
12488 | ||
12489 | assert.deepEqual(newChecksum, checksum, 'Invalid checksum') | |
12490 | ||
12491 | return payload | |
12492 | } | |
12493 | ||
12494 | module.exports = { | |
12495 | encode: encode, | |
12496 | decode: decode | |
12497 | } | |
12498 | ||
12499 | }).call(this,_dereq_("buffer").Buffer) | |
12500 | },{"./crypto":73,"assert":4,"bs58":15,"buffer":8}],71:[function(_dereq_,module,exports){ | |
12501 | var assert = _dereq_('assert') | |
12502 | var opcodes = _dereq_('./opcodes') | |
12503 | ||
12504 | // https://github.com/feross/buffer/blob/master/index.js#L1127 | |
12505 | function verifuint(value, max) { | |
12506 | assert(typeof value === 'number', 'cannot write a non-number as a number') | |
12507 | assert(value >= 0, 'specified a negative value for writing an unsigned value') | |
12508 | assert(value <= max, 'value is larger than maximum value for type') | |
12509 | assert(Math.floor(value) === value, 'value has a fractional component') | |
12510 | } | |
12511 | ||
12512 | function pushDataSize(i) { | |
12513 | return i < opcodes.OP_PUSHDATA1 ? 1 | |
12514 | : i < 0xff ? 2 | |
12515 | : i < 0xffff ? 3 | |
12516 | : 5 | |
12517 | } | |
12518 | ||
12519 | function readPushDataInt(buffer, offset) { | |
12520 | var opcode = buffer.readUInt8(offset) | |
12521 | var number, size | |
12522 | ||
12523 | // ~6 bit | |
12524 | if (opcode < opcodes.OP_PUSHDATA1) { | |
12525 | number = opcode | |
12526 | size = 1 | |
12527 | ||
12528 | // 8 bit | |
12529 | } else if (opcode === opcodes.OP_PUSHDATA1) { | |
12530 | number = buffer.readUInt8(offset + 1) | |
12531 | size = 2 | |
12532 | ||
12533 | // 16 bit | |
12534 | } else if (opcode === opcodes.OP_PUSHDATA2) { | |
12535 | number = buffer.readUInt16LE(offset + 1) | |
12536 | size = 3 | |
12537 | ||
12538 | // 32 bit | |
12539 | } else { | |
12540 | assert.equal(opcode, opcodes.OP_PUSHDATA4, 'Unexpected opcode') | |
12541 | ||
12542 | number = buffer.readUInt32LE(offset + 1) | |
12543 | size = 5 | |
12544 | ||
12545 | } | |
12546 | ||
12547 | return { | |
12548 | opcode: opcode, | |
12549 | number: number, | |
12550 | size: size | |
12551 | } | |
12552 | } | |
12553 | ||
12554 | function readUInt64LE(buffer, offset) { | |
12555 | var a = buffer.readUInt32LE(offset) | |
12556 | var b = buffer.readUInt32LE(offset + 4) | |
12557 | b *= 0x100000000 | |
12558 | ||
12559 | verifuint(b + a, 0x001fffffffffffff) | |
12560 | ||
12561 | return b + a | |
12562 | } | |
12563 | ||
12564 | function readVarInt(buffer, offset) { | |
12565 | var t = buffer.readUInt8(offset) | |
12566 | var number, size | |
12567 | ||
12568 | // 8 bit | |
12569 | if (t < 253) { | |
12570 | number = t | |
12571 | size = 1 | |
12572 | ||
12573 | // 16 bit | |
12574 | } else if (t < 254) { | |
12575 | number = buffer.readUInt16LE(offset + 1) | |
12576 | size = 3 | |
12577 | ||
12578 | // 32 bit | |
12579 | } else if (t < 255) { | |
12580 | number = buffer.readUInt32LE(offset + 1) | |
12581 | size = 5 | |
12582 | ||
12583 | // 64 bit | |
12584 | } else { | |
12585 | number = readUInt64LE(buffer, offset + 1) | |
12586 | size = 9 | |
12587 | } | |
12588 | ||
12589 | return { | |
12590 | number: number, | |
12591 | size: size | |
12592 | } | |
12593 | } | |
12594 | ||
12595 | function writePushDataInt(buffer, number, offset) { | |
12596 | var size = pushDataSize(number) | |
12597 | ||
12598 | // ~6 bit | |
12599 | if (size === 1) { | |
12600 | buffer.writeUInt8(number, offset) | |
12601 | ||
12602 | // 8 bit | |
12603 | } else if (size === 2) { | |
12604 | buffer.writeUInt8(opcodes.OP_PUSHDATA1, offset) | |
12605 | buffer.writeUInt8(number, offset + 1) | |
12606 | ||
12607 | // 16 bit | |
12608 | } else if (size === 3) { | |
12609 | buffer.writeUInt8(opcodes.OP_PUSHDATA2, offset) | |
12610 | buffer.writeUInt16LE(number, offset + 1) | |
12611 | ||
12612 | // 32 bit | |
12613 | } else { | |
12614 | buffer.writeUInt8(opcodes.OP_PUSHDATA4, offset) | |
12615 | buffer.writeUInt32LE(number, offset + 1) | |
12616 | ||
12617 | } | |
12618 | ||
12619 | return size | |
12620 | } | |
12621 | ||
12622 | function writeUInt64LE(buffer, value, offset) { | |
12623 | verifuint(value, 0x001fffffffffffff) | |
12624 | ||
12625 | buffer.writeInt32LE(value & -1, offset) | |
12626 | buffer.writeUInt32LE(Math.floor(value / 0x100000000), offset + 4) | |
12627 | } | |
12628 | ||
12629 | function varIntSize(i) { | |
12630 | return i < 253 ? 1 | |
12631 | : i < 0x10000 ? 3 | |
12632 | : i < 0x100000000 ? 5 | |
12633 | : 9 | |
12634 | } | |
12635 | ||
12636 | function writeVarInt(buffer, number, offset) { | |
12637 | var size = varIntSize(number) | |
12638 | ||
12639 | // 8 bit | |
12640 | if (size === 1) { | |
12641 | buffer.writeUInt8(number, offset) | |
12642 | ||
12643 | // 16 bit | |
12644 | } else if (size === 3) { | |
12645 | buffer.writeUInt8(253, offset) | |
12646 | buffer.writeUInt16LE(number, offset + 1) | |
12647 | ||
12648 | // 32 bit | |
12649 | } else if (size === 5) { | |
12650 | buffer.writeUInt8(254, offset) | |
12651 | buffer.writeUInt32LE(number, offset + 1) | |
12652 | ||
12653 | // 64 bit | |
12654 | } else { | |
12655 | buffer.writeUInt8(255, offset) | |
12656 | writeUInt64LE(buffer, number, offset + 1) | |
12657 | } | |
12658 | ||
12659 | return size | |
12660 | } | |
12661 | ||
12662 | module.exports = { | |
12663 | pushDataSize: pushDataSize, | |
12664 | readPushDataInt: readPushDataInt, | |
12665 | readUInt64LE: readUInt64LE, | |
12666 | readVarInt: readVarInt, | |
12667 | varIntSize: varIntSize, | |
12668 | writePushDataInt: writePushDataInt, | |
12669 | writeUInt64LE: writeUInt64LE, | |
12670 | writeVarInt: writeVarInt | |
12671 | } | |
12672 | ||
12673 | },{"./opcodes":82,"assert":4}],72:[function(_dereq_,module,exports){ | |
12674 | (function (Buffer){ | |
12675 | var assert = _dereq_('assert') | |
12676 | var Crypto = _dereq_('crypto-js') | |
12677 | var WordArray = Crypto.lib.WordArray | |
12678 | ||
12679 | function bufferToWordArray(buffer) { | |
12680 | assert(Buffer.isBuffer(buffer), 'Expected Buffer, got', buffer) | |
12681 | ||
12682 | var words = [] | |
12683 | for (var i = 0, b = 0; i < buffer.length; i++, b += 8) { | |
12684 | words[b >>> 5] |= buffer[i] << (24 - b % 32) | |
12685 | } | |
12686 | ||
12687 | return new WordArray.init(words, buffer.length) | |
12688 | } | |
12689 | ||
12690 | function wordArrayToBuffer(wordArray) { | |
12691 | assert(Array.isArray(wordArray.words), 'Expected WordArray, got' + wordArray) | |
12692 | ||
12693 | var words = wordArray.words | |
12694 | var buffer = new Buffer(words.length * 4) | |
12695 | ||
12696 | words.forEach(function(value, i) { | |
12697 | buffer.writeInt32BE(value & -1, i * 4) | |
12698 | }) | |
12699 | ||
12700 | return buffer | |
12701 | } | |
12702 | ||
12703 | module.exports = { | |
12704 | bufferToWordArray: bufferToWordArray, | |
12705 | wordArrayToBuffer: wordArrayToBuffer | |
12706 | } | |
12707 | ||
12708 | }).call(this,_dereq_("buffer").Buffer) | |
12709 | },{"assert":4,"buffer":8,"crypto-js":37}],73:[function(_dereq_,module,exports){ | |
12710 | (function (Buffer){ | |
12711 | // Crypto, crypto, where art thou crypto | |
12712 | var assert = _dereq_('assert') | |
12713 | var CryptoJS = _dereq_('crypto-js') | |
12714 | var crypto = _dereq_('crypto') | |
12715 | var convert = _dereq_('./convert') | |
12716 | ||
12717 | function hash160(buffer) { | |
12718 | return ripemd160(sha256(buffer)) | |
12719 | } | |
12720 | ||
12721 | function hash256(buffer) { | |
12722 | return sha256(sha256(buffer)) | |
12723 | } | |
12724 | ||
12725 | function ripemd160(buffer) { | |
12726 | return crypto.createHash('rmd160').update(buffer).digest() | |
12727 | } | |
12728 | ||
12729 | function sha1(buffer) { | |
12730 | return crypto.createHash('sha1').update(buffer).digest() | |
12731 | } | |
12732 | ||
12733 | function sha256(buffer) { | |
12734 | return crypto.createHash('sha256').update(buffer).digest() | |
12735 | } | |
12736 | ||
12737 | // FIXME: Name not consistent with others | |
12738 | function HmacSHA256(buffer, secret) { | |
12739 | return crypto.createHmac('sha256', secret).update(buffer).digest() | |
12740 | } | |
12741 | ||
12742 | function HmacSHA512(data, secret) { | |
12743 | assert(Buffer.isBuffer(data), 'Expected Buffer for data, got ' + data) | |
12744 | assert(Buffer.isBuffer(secret), 'Expected Buffer for secret, got ' + secret) | |
12745 | ||
12746 | var dataWords = convert.bufferToWordArray(data) | |
12747 | var secretWords = convert.bufferToWordArray(secret) | |
12748 | ||
12749 | var hash = CryptoJS.HmacSHA512(dataWords, secretWords) | |
12750 | ||
12751 | return convert.wordArrayToBuffer(hash) | |
12752 | } | |
12753 | ||
12754 | module.exports = { | |
12755 | ripemd160: ripemd160, | |
12756 | sha1: sha1, | |
12757 | sha256: sha256, | |
12758 | hash160: hash160, | |
12759 | hash256: hash256, | |
12760 | HmacSHA256: HmacSHA256, | |
12761 | HmacSHA512: HmacSHA512 | |
12762 | } | |
12763 | ||
12764 | }).call(this,_dereq_("buffer").Buffer) | |
12765 | },{"./convert":72,"assert":4,"buffer":8,"crypto":19,"crypto-js":37}],74:[function(_dereq_,module,exports){ | |
12766 | (function (Buffer){ | |
12767 | var assert = _dereq_('assert') | |
12768 | var crypto = _dereq_('./crypto') | |
12769 | ||
12770 | var BigInteger = _dereq_('bigi') | |
12771 | var ECSignature = _dereq_('./ecsignature') | |
12772 | var Point = _dereq_('ecurve').Point | |
12773 | ||
12774 | // https://tools.ietf.org/html/rfc6979#section-3.2 | |
12775 | function deterministicGenerateK(curve, hash, d) { | |
12776 | assert(Buffer.isBuffer(hash), 'Hash must be a Buffer, not ' + hash) | |
12777 | assert.equal(hash.length, 32, 'Hash must be 256 bit') | |
12778 | assert(d instanceof BigInteger, 'Private key must be a BigInteger') | |
12779 | ||
12780 | var x = d.toBuffer(32) | |
12781 | var k = new Buffer(32) | |
12782 | var v = new Buffer(32) | |
12783 | ||
12784 | // Step B | |
12785 | v.fill(1) | |
12786 | ||
12787 | // Step C | |
12788 | k.fill(0) | |
12789 | ||
12790 | // Step D | |
12791 | k = crypto.HmacSHA256(Buffer.concat([v, new Buffer([0]), x, hash]), k) | |
12792 | ||
12793 | // Step E | |
12794 | v = crypto.HmacSHA256(v, k) | |
12795 | ||
12796 | // Step F | |
12797 | k = crypto.HmacSHA256(Buffer.concat([v, new Buffer([1]), x, hash]), k) | |
12798 | ||
12799 | // Step G | |
12800 | v = crypto.HmacSHA256(v, k) | |
12801 | ||
12802 | // Step H1/H2a, ignored as tlen === qlen (256 bit) | |
12803 | // Step H2b | |
12804 | v = crypto.HmacSHA256(v, k) | |
12805 | ||
12806 | var T = BigInteger.fromBuffer(v) | |
12807 | ||
12808 | // Step H3, repeat until T is within the interval [1, n - 1] | |
12809 | while ((T.signum() <= 0) || (T.compareTo(curve.n) >= 0)) { | |
12810 | k = crypto.HmacSHA256(Buffer.concat([v, new Buffer([0])]), k) | |
12811 | v = crypto.HmacSHA256(v, k) | |
12812 | ||
12813 | T = BigInteger.fromBuffer(v) | |
12814 | } | |
12815 | ||
12816 | return T | |
12817 | } | |
12818 | ||
12819 | function sign(curve, hash, d) { | |
12820 | var k = deterministicGenerateK(curve, hash, d) | |
12821 | ||
12822 | var n = curve.n | |
12823 | var G = curve.G | |
12824 | var Q = G.multiply(k) | |
12825 | var e = BigInteger.fromBuffer(hash) | |
12826 | ||
12827 | var r = Q.affineX.mod(n) | |
12828 | assert.notEqual(r.signum(), 0, 'Invalid R value') | |
12829 | ||
12830 | var s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n) | |
12831 | assert.notEqual(s.signum(), 0, 'Invalid S value') | |
12832 | ||
12833 | var N_OVER_TWO = n.shiftRight(1) | |
12834 | ||
12835 | // enforce low S values, see bip62: 'low s values in signatures' | |
12836 | if (s.compareTo(N_OVER_TWO) > 0) { | |
12837 | s = n.subtract(s) | |
12838 | } | |
12839 | ||
12840 | return new ECSignature(r, s) | |
12841 | } | |
12842 | ||
12843 | function verify(curve, hash, signature, Q) { | |
12844 | var e = BigInteger.fromBuffer(hash) | |
12845 | ||
12846 | return verifyRaw(curve, e, signature, Q) | |
12847 | } | |
12848 | ||
12849 | function verifyRaw(curve, e, signature, Q) { | |
12850 | var n = curve.n | |
12851 | var G = curve.G | |
12852 | ||
12853 | var r = signature.r | |
12854 | var s = signature.s | |
12855 | ||
12856 | if (r.signum() === 0 || r.compareTo(n) >= 0) return false | |
12857 | if (s.signum() === 0 || s.compareTo(n) >= 0) return false | |
12858 | ||
12859 | var c = s.modInverse(n) | |
12860 | ||
12861 | var u1 = e.multiply(c).mod(n) | |
12862 | var u2 = r.multiply(c).mod(n) | |
12863 | ||
12864 | var point = G.multiplyTwo(u1, Q, u2) | |
12865 | var v = point.affineX.mod(n) | |
12866 | ||
12867 | return v.equals(r) | |
12868 | } | |
12869 | ||
12870 | /** | |
12871 | * Recover a public key from a signature. | |
12872 | * | |
12873 | * See SEC 1: Elliptic Curve Cryptography, section 4.1.6, "Public | |
12874 | * Key Recovery Operation". | |
12875 | * | |
12876 | * http://www.secg.org/download/aid-780/sec1-v2.pdf | |
12877 | */ | |
12878 | function recoverPubKey(curve, e, signature, i) { | |
12879 | assert.strictEqual(i & 3, i, 'Recovery param is more than two bits') | |
12880 | ||
12881 | var r = signature.r | |
12882 | var s = signature.s | |
12883 | ||
12884 | // A set LSB signifies that the y-coordinate is odd | |
12885 | var isYOdd = i & 1 | |
12886 | ||
12887 | // The more significant bit specifies whether we should use the | |
12888 | // first or second candidate key. | |
12889 | var isSecondKey = i >> 1 | |
12890 | ||
12891 | var n = curve.n | |
12892 | var G = curve.G | |
12893 | ||
12894 | // 1.1 Let x = r + jn | |
12895 | var x = isSecondKey ? r.add(n) : r | |
12896 | var R = curve.pointFromX(isYOdd, x) | |
12897 | ||
12898 | // 1.4 Check that nR is at infinity | |
12899 | var nR = R.multiply(n) | |
12900 | assert(curve.isInfinity(nR), 'nR is not a valid curve point') | |
12901 | ||
12902 | // Compute -e from e | |
12903 | var eNeg = e.negate().mod(n) | |
12904 | ||
12905 | // 1.6.1 Compute Q = r^-1 (sR - eG) | |
12906 | // Q = r^-1 (sR + -eG) | |
12907 | var rInv = r.modInverse(n) | |
12908 | ||
12909 | var Q = R.multiplyTwo(s, G, eNeg).multiply(rInv) | |
12910 | curve.validate(Q) | |
12911 | ||
12912 | return Q | |
12913 | } | |
12914 | ||
12915 | /** | |
12916 | * Calculate pubkey extraction parameter. | |
12917 | * | |
12918 | * When extracting a pubkey from a signature, we have to | |
12919 | * distinguish four different cases. Rather than putting this | |
12920 | * burden on the verifier, Bitcoin includes a 2-bit value with the | |
12921 | * signature. | |
12922 | * | |
12923 | * This function simply tries all four cases and returns the value | |
12924 | * that resulted in a successful pubkey recovery. | |
12925 | */ | |
12926 | function calcPubKeyRecoveryParam(curve, e, signature, Q) { | |
12927 | for (var i = 0; i < 4; i++) { | |
12928 | var Qprime = recoverPubKey(curve, e, signature, i) | |
12929 | ||
12930 | // 1.6.2 Verify Q | |
12931 | if (Qprime.equals(Q)) { | |
12932 | return i | |
12933 | } | |
12934 | } | |
12935 | ||
12936 | throw new Error('Unable to find valid recovery factor') | |
12937 | } | |
12938 | ||
12939 | module.exports = { | |
12940 | calcPubKeyRecoveryParam: calcPubKeyRecoveryParam, | |
12941 | deterministicGenerateK: deterministicGenerateK, | |
12942 | recoverPubKey: recoverPubKey, | |
12943 | sign: sign, | |
12944 | verify: verify, | |
12945 | verifyRaw: verifyRaw | |
12946 | } | |
12947 | ||
12948 | }).call(this,_dereq_("buffer").Buffer) | |
12949 | },{"./crypto":73,"./ecsignature":77,"assert":4,"bigi":3,"buffer":8,"ecurve":65}],75:[function(_dereq_,module,exports){ | |
12950 | (function (Buffer){ | |
12951 | var assert = _dereq_('assert') | |
12952 | var base58check = _dereq_('./base58check') | |
12953 | var ecdsa = _dereq_('./ecdsa') | |
12954 | var networks = _dereq_('./networks') | |
12955 | var secureRandom = _dereq_('secure-random') | |
12956 | ||
12957 | var BigInteger = _dereq_('bigi') | |
12958 | var ECPubKey = _dereq_('./ecpubkey') | |
12959 | ||
12960 | var ecurve = _dereq_('ecurve') | |
12961 | var curve = ecurve.getCurveByName('secp256k1') | |
12962 | ||
12963 | function ECKey(d, compressed) { | |
12964 | assert(d.signum() > 0, 'Private key must be greater than 0') | |
12965 | assert(d.compareTo(curve.n) < 0, 'Private key must be less than the curve order') | |
12966 | ||
12967 | var Q = curve.G.multiply(d) | |
12968 | ||
12969 | this.d = d | |
12970 | this.pub = new ECPubKey(Q, compressed) | |
12971 | } | |
12972 | ||
12973 | // Static constructors | |
12974 | ECKey.fromWIF = function(string) { | |
12975 | var payload = base58check.decode(string) | |
12976 | var compressed = false | |
12977 | ||
12978 | // Ignore the version byte | |
12979 | payload = payload.slice(1) | |
12980 | ||
12981 | if (payload.length === 33) { | |
12982 | assert.strictEqual(payload[32], 0x01, 'Invalid compression flag') | |
12983 | ||
12984 | // Truncate the compression flag | |
12985 | payload = payload.slice(0, -1) | |
12986 | compressed = true | |
12987 | } | |
12988 | ||
12989 | assert.equal(payload.length, 32, 'Invalid WIF payload length') | |
12990 | ||
12991 | var d = BigInteger.fromBuffer(payload) | |
12992 | return new ECKey(d, compressed) | |
12993 | } | |
12994 | ||
12995 | ECKey.makeRandom = function(compressed, rng) { | |
12996 | rng = rng || secureRandom.randomBuffer | |
12997 | ||
12998 | var buffer = rng(32) | |
12999 | assert(Buffer.isBuffer(buffer), 'Expected Buffer, got ' + buffer) | |
13000 | ||
13001 | var d = BigInteger.fromBuffer(buffer) | |
13002 | d = d.mod(curve.n) | |
13003 | ||
13004 | return new ECKey(d, compressed) | |
13005 | } | |
13006 | ||
13007 | // Export functions | |
13008 | ECKey.prototype.toWIF = function(network) { | |
13009 | network = network || networks.bitcoin | |
13010 | ||
13011 | var bufferLen = this.pub.compressed ? 34 : 33 | |
13012 | var buffer = new Buffer(bufferLen) | |
13013 | ||
13014 | buffer.writeUInt8(network.wif, 0) | |
13015 | this.d.toBuffer(32).copy(buffer, 1) | |
13016 | ||
13017 | if (this.pub.compressed) { | |
13018 | buffer.writeUInt8(0x01, 33) | |
13019 | } | |
13020 | ||
13021 | return base58check.encode(buffer) | |
13022 | } | |
13023 | ||
13024 | // Operations | |
13025 | ECKey.prototype.sign = function(hash) { | |
13026 | return ecdsa.sign(curve, hash, this.d) | |
13027 | } | |
13028 | ||
13029 | module.exports = ECKey | |
13030 | ||
13031 | }).call(this,_dereq_("buffer").Buffer) | |
13032 | },{"./base58check":70,"./ecdsa":74,"./ecpubkey":76,"./networks":81,"assert":4,"bigi":3,"buffer":8,"ecurve":65,"secure-random":68}],76:[function(_dereq_,module,exports){ | |
13033 | (function (Buffer){ | |
13034 | var assert = _dereq_('assert') | |
13035 | var crypto = _dereq_('./crypto') | |
13036 | var ecdsa = _dereq_('./ecdsa') | |
13037 | var networks = _dereq_('./networks') | |
13038 | ||
13039 | var Address = _dereq_('./address') | |
13040 | ||
13041 | var ecurve = _dereq_('ecurve') | |
13042 | var curve = ecurve.getCurveByName('secp256k1') | |
13043 | ||
13044 | function ECPubKey(Q, compressed) { | |
13045 | assert(Q instanceof ecurve.Point, 'Expected Point, got ' + Q) | |
13046 | ||
13047 | if (compressed == undefined) compressed = true | |
13048 | assert.strictEqual(typeof compressed, 'boolean', 'Expected boolean, got ' + compressed) | |
13049 | ||
13050 | this.compressed = compressed | |
13051 | this.Q = Q | |
13052 | } | |
13053 | ||
13054 | // Static constructors | |
13055 | ECPubKey.fromBuffer = function(buffer) { | |
13056 | var Q = ecurve.Point.decodeFrom(curve, buffer) | |
13057 | return new ECPubKey(Q, Q.compressed) | |
13058 | } | |
13059 | ||
13060 | ECPubKey.fromHex = function(hex) { | |
13061 | return ECPubKey.fromBuffer(new Buffer(hex, 'hex')) | |
13062 | } | |
13063 | ||
13064 | // Operations | |
13065 | ECPubKey.prototype.getAddress = function(network) { | |
13066 | network = network || networks.bitcoin | |
13067 | ||
13068 | return new Address(crypto.hash160(this.toBuffer()), network.pubKeyHash) | |
13069 | } | |
13070 | ||
13071 | ECPubKey.prototype.verify = function(hash, signature) { | |
13072 | return ecdsa.verify(curve, hash, signature, this.Q) | |
13073 | } | |
13074 | ||
13075 | // Export functions | |
13076 | ECPubKey.prototype.toBuffer = function() { | |
13077 | return this.Q.getEncoded(this.compressed) | |
13078 | } | |
13079 | ||
13080 | ECPubKey.prototype.toHex = function() { | |
13081 | return this.toBuffer().toString('hex') | |
13082 | } | |
13083 | ||
13084 | module.exports = ECPubKey | |
13085 | ||
13086 | }).call(this,_dereq_("buffer").Buffer) | |
13087 | },{"./address":69,"./crypto":73,"./ecdsa":74,"./networks":81,"assert":4,"buffer":8,"ecurve":65}],77:[function(_dereq_,module,exports){ | |
13088 | (function (Buffer){ | |
13089 | var assert = _dereq_('assert') | |
13090 | var BigInteger = _dereq_('bigi') | |
13091 | ||
13092 | function ECSignature(r, s) { | |
13093 | assert(r instanceof BigInteger, 'Expected BigInteger, got ' + r) | |
13094 | assert(s instanceof BigInteger, 'Expected BigInteger, got ' + s) | |
13095 | this.r = r | |
13096 | this.s = s | |
13097 | } | |
13098 | ||
13099 | // Import operations | |
13100 | ECSignature.parseCompact = function(buffer) { | |
13101 | assert.equal(buffer.length, 65, 'Invalid signature length') | |
13102 | var i = buffer.readUInt8(0) - 27 | |
13103 | ||
13104 | // At most 3 bits | |
13105 | assert.equal(i, i & 7, 'Invalid signature parameter') | |
13106 | var compressed = !!(i & 4) | |
13107 | ||
13108 | // Recovery param only | |
13109 | i = i & 3 | |
13110 | ||
13111 | var r = BigInteger.fromBuffer(buffer.slice(1, 33)) | |
13112 | var s = BigInteger.fromBuffer(buffer.slice(33)) | |
13113 | ||
13114 | return { | |
13115 | compressed: compressed, | |
13116 | i: i, | |
13117 | signature: new ECSignature(r, s) | |
13118 | } | |
13119 | } | |
13120 | ||
13121 | ECSignature.fromDER = function(buffer) { | |
13122 | assert.equal(buffer.readUInt8(0), 0x30, 'Not a DER sequence') | |
13123 | assert.equal(buffer.readUInt8(1), buffer.length - 2, 'Invalid sequence length') | |
13124 | assert.equal(buffer.readUInt8(2), 0x02, 'Expected a DER integer') | |
13125 | ||
13126 | var rLen = buffer.readUInt8(3) | |
13127 | assert(rLen > 0, 'R length is zero') | |
13128 | ||
13129 | var offset = 4 + rLen | |
13130 | assert.equal(buffer.readUInt8(offset), 0x02, 'Expected a DER integer (2)') | |
13131 | ||
13132 | var sLen = buffer.readUInt8(offset + 1) | |
13133 | assert(sLen > 0, 'S length is zero') | |
13134 | ||
13135 | var rB = buffer.slice(4, offset) | |
13136 | var sB = buffer.slice(offset + 2) | |
13137 | offset += 2 + sLen | |
13138 | ||
13139 | if (rLen > 1 && rB.readUInt8(0) === 0x00) { | |
13140 | assert(rB.readUInt8(1) & 0x80, 'R value excessively padded') | |
13141 | } | |
13142 | ||
13143 | if (sLen > 1 && sB.readUInt8(0) === 0x00) { | |
13144 | assert(sB.readUInt8(1) & 0x80, 'S value excessively padded') | |
13145 | } | |
13146 | ||
13147 | assert.equal(offset, buffer.length, 'Invalid DER encoding') | |
13148 | var r = BigInteger.fromDERInteger(rB) | |
13149 | var s = BigInteger.fromDERInteger(sB) | |
13150 | ||
13151 | assert(r.signum() >= 0, 'R value is negative') | |
13152 | assert(s.signum() >= 0, 'S value is negative') | |
13153 | ||
13154 | return new ECSignature(r, s) | |
13155 | } | |
13156 | ||
13157 | // FIXME: 0x00, 0x04, 0x80 are SIGHASH_* boundary constants, importing Transaction causes a circular dependency | |
13158 | ECSignature.parseScriptSignature = function(buffer) { | |
13159 | var hashType = buffer.readUInt8(buffer.length - 1) | |
13160 | var hashTypeMod = hashType & ~0x80 | |
13161 | ||
13162 | assert(hashTypeMod > 0x00 && hashTypeMod < 0x04, 'Invalid hashType') | |
13163 | ||
13164 | return { | |
13165 | signature: ECSignature.fromDER(buffer.slice(0, -1)), | |
13166 | hashType: hashType | |
13167 | } | |
13168 | } | |
13169 | ||
13170 | // Export operations | |
13171 | ECSignature.prototype.toCompact = function(i, compressed) { | |
13172 | if (compressed) i += 4 | |
13173 | i += 27 | |
13174 | ||
13175 | var buffer = new Buffer(65) | |
13176 | buffer.writeUInt8(i, 0) | |
13177 | ||
13178 | this.r.toBuffer(32).copy(buffer, 1) | |
13179 | this.s.toBuffer(32).copy(buffer, 33) | |
13180 | ||
13181 | return buffer | |
13182 | } | |
13183 | ||
13184 | ECSignature.prototype.toDER = function() { | |
13185 | var rBa = this.r.toDERInteger() | |
13186 | var sBa = this.s.toDERInteger() | |
13187 | ||
13188 | var sequence = [] | |
13189 | sequence.push(0x02) // INTEGER | |
13190 | sequence.push(rBa.length) | |
13191 | sequence = sequence.concat(rBa) | |
13192 | ||
13193 | sequence.push(0x02) // INTEGER | |
13194 | sequence.push(sBa.length) | |
13195 | sequence = sequence.concat(sBa) | |
13196 | ||
13197 | sequence.unshift(sequence.length) | |
13198 | sequence.unshift(0x30) // SEQUENCE | |
13199 | ||
13200 | return new Buffer(sequence) | |
13201 | } | |
13202 | ||
13203 | ECSignature.prototype.toScriptSignature = function(hashType) { | |
13204 | var hashTypeBuffer = new Buffer(1) | |
13205 | hashTypeBuffer.writeUInt8(hashType, 0) | |
13206 | ||
13207 | return Buffer.concat([this.toDER(), hashTypeBuffer]) | |
13208 | } | |
13209 | ||
13210 | module.exports = ECSignature | |
13211 | ||
13212 | }).call(this,_dereq_("buffer").Buffer) | |
13213 | },{"assert":4,"bigi":3,"buffer":8}],78:[function(_dereq_,module,exports){ | |
13214 | (function (Buffer){ | |
13215 | var assert = _dereq_('assert') | |
13216 | var base58check = _dereq_('./base58check') | |
13217 | var crypto = _dereq_('./crypto') | |
13218 | var networks = _dereq_('./networks') | |
13219 | ||
13220 | var BigInteger = _dereq_('bigi') | |
13221 | var ECKey = _dereq_('./eckey') | |
13222 | var ECPubKey = _dereq_('./ecpubkey') | |
13223 | ||
13224 | var ecurve = _dereq_('ecurve') | |
13225 | var curve = ecurve.getCurveByName('secp256k1') | |
13226 | ||
13227 | function findBIP32ParamsByVersion(version) { | |
13228 | for (var name in networks) { | |
13229 | var network = networks[name] | |
13230 | ||
13231 | for (var type in network.bip32) { | |
13232 | if (version != network.bip32[type]) continue | |
13233 | ||
13234 | return { | |
13235 | isPrivate: (type === 'private'), | |
13236 | network: network | |
13237 | } | |
13238 | } | |
13239 | } | |
13240 | ||
13241 | assert(false, 'Could not find version ' + version.toString(16)) | |
13242 | } | |
13243 | ||
13244 | function HDNode(K, chainCode, network) { | |
13245 | network = network || networks.bitcoin | |
13246 | ||
13247 | assert(Buffer.isBuffer(chainCode), 'Expected Buffer, got ' + chainCode) | |
13248 | assert(network.bip32, 'Unknown BIP32 constants for network') | |
13249 | ||
13250 | this.chainCode = chainCode | |
13251 | this.depth = 0 | |
13252 | this.index = 0 | |
13253 | this.network = network | |
13254 | ||
13255 | if (K instanceof BigInteger) { | |
13256 | this.privKey = new ECKey(K, true) | |
13257 | this.pubKey = this.privKey.pub | |
13258 | } else { | |
13259 | this.pubKey = new ECPubKey(K, true) | |
13260 | } | |
13261 | } | |
13262 | ||
13263 | HDNode.MASTER_SECRET = new Buffer('Bitcoin seed') | |
13264 | HDNode.HIGHEST_BIT = 0x80000000 | |
13265 | HDNode.LENGTH = 78 | |
13266 | ||
13267 | HDNode.fromSeedBuffer = function(seed, network) { | |
13268 | var I = crypto.HmacSHA512(seed, HDNode.MASTER_SECRET) | |
13269 | var IL = I.slice(0, 32) | |
13270 | var IR = I.slice(32) | |
13271 | ||
13272 | // In case IL is 0 or >= n, the master key is invalid | |
13273 | // This is handled by `new ECKey` in the HDNode constructor | |
13274 | var pIL = BigInteger.fromBuffer(IL) | |
13275 | ||
13276 | return new HDNode(pIL, IR, network) | |
13277 | } | |
13278 | ||
13279 | HDNode.fromSeedHex = function(hex, network) { | |
13280 | return HDNode.fromSeedBuffer(new Buffer(hex, 'hex'), network) | |
13281 | } | |
13282 | ||
13283 | HDNode.fromBase58 = function(string) { | |
13284 | return HDNode.fromBuffer(base58check.decode(string)) | |
13285 | } | |
13286 | ||
13287 | HDNode.fromBuffer = function(buffer) { | |
13288 | assert.strictEqual(buffer.length, HDNode.LENGTH, 'Invalid buffer length') | |
13289 | ||
13290 | // 4 byte: version bytes | |
13291 | var version = buffer.readUInt32BE(0) | |
13292 | var params = findBIP32ParamsByVersion(version) | |
13293 | ||
13294 | // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ... | |
13295 | var depth = buffer.readUInt8(4) | |
13296 | ||
13297 | // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key) | |
13298 | var parentFingerprint = buffer.readUInt32BE(5) | |
13299 | if (depth === 0) { | |
13300 | assert.strictEqual(parentFingerprint, 0x00000000, 'Invalid parent fingerprint') | |
13301 | } | |
13302 | ||
13303 | // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized. | |
13304 | // This is encoded in MSB order. (0x00000000 if master key) | |
13305 | var index = buffer.readUInt32BE(9) | |
13306 | assert(depth > 0 || index === 0, 'Invalid index') | |
13307 | ||
13308 | // 32 bytes: the chain code | |
13309 | var chainCode = buffer.slice(13, 45) | |
13310 | var hd | |
13311 | ||
13312 | // 33 bytes: private key data (0x00 + k) | |
13313 | if (params.isPrivate) { | |
13314 | assert.strictEqual(buffer.readUInt8(45), 0x00, 'Invalid private key') | |
13315 | var data = buffer.slice(46, 78) | |
13316 | var d = BigInteger.fromBuffer(data) | |
13317 | hd = new HDNode(d, chainCode, params.network) | |
13318 | ||
13319 | // 33 bytes: public key data (0x02 + X or 0x03 + X) | |
13320 | } else { | |
13321 | var data = buffer.slice(45, 78) | |
13322 | var Q = ecurve.Point.decodeFrom(curve, data) | |
13323 | assert.equal(Q.compressed, true, 'Invalid public key') | |
13324 | ||
13325 | // Verify that the X coordinate in the public point corresponds to a point on the curve. | |
13326 | // If not, the extended public key is invalid. | |
13327 | curve.validate(Q) | |
13328 | ||
13329 | hd = new HDNode(Q, chainCode, params.network) | |
13330 | } | |
13331 | ||
13332 | hd.depth = depth | |
13333 | hd.index = index | |
13334 | hd.parentFingerprint = parentFingerprint | |
13335 | ||
13336 | return hd | |
13337 | } | |
13338 | ||
13339 | HDNode.fromHex = function(hex) { | |
13340 | return HDNode.fromBuffer(new Buffer(hex, 'hex')) | |
13341 | } | |
13342 | ||
13343 | HDNode.prototype.getIdentifier = function() { | |
13344 | return crypto.hash160(this.pubKey.toBuffer()) | |
13345 | } | |
13346 | ||
13347 | HDNode.prototype.getFingerprint = function() { | |
13348 | return this.getIdentifier().slice(0, 4) | |
13349 | } | |
13350 | ||
13351 | HDNode.prototype.getAddress = function() { | |
13352 | return this.pubKey.getAddress(this.network) | |
13353 | } | |
13354 | ||
13355 | HDNode.prototype.toBase58 = function(isPrivate) { | |
13356 | return base58check.encode(this.toBuffer(isPrivate)) | |
13357 | } | |
13358 | ||
13359 | HDNode.prototype.toBuffer = function(isPrivate) { | |
13360 | if (isPrivate == undefined) isPrivate = !!this.privKey | |
13361 | ||
13362 | // Version | |
13363 | var version = isPrivate ? this.network.bip32.private : this.network.bip32.public | |
13364 | var buffer = new Buffer(HDNode.LENGTH) | |
13365 | ||
13366 | // 4 bytes: version bytes | |
13367 | buffer.writeUInt32BE(version, 0) | |
13368 | ||
13369 | // Depth | |
13370 | // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, .... | |
13371 | buffer.writeUInt8(this.depth, 4) | |
13372 | ||
13373 | // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key) | |
13374 | var fingerprint = (this.depth === 0) ? 0x00000000 : this.parentFingerprint | |
13375 | buffer.writeUInt32BE(fingerprint, 5) | |
13376 | ||
13377 | // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized. | |
13378 | // This is encoded in Big endian. (0x00000000 if master key) | |
13379 | buffer.writeUInt32BE(this.index, 9) | |
13380 | ||
13381 | // 32 bytes: the chain code | |
13382 | this.chainCode.copy(buffer, 13) | |
13383 | ||
13384 | // 33 bytes: the public key or private key data | |
13385 | if (isPrivate) { | |
13386 | assert(this.privKey, 'Missing private key') | |
13387 | ||
13388 | // 0x00 + k for private keys | |
13389 | buffer.writeUInt8(0, 45) | |
13390 | this.privKey.d.toBuffer(32).copy(buffer, 46) | |
13391 | } else { | |
13392 | ||
13393 | // X9.62 encoding for public keys | |
13394 | this.pubKey.toBuffer().copy(buffer, 45) | |
13395 | } | |
13396 | ||
13397 | return buffer | |
13398 | } | |
13399 | ||
13400 | HDNode.prototype.toHex = function(isPrivate) { | |
13401 | return this.toBuffer(isPrivate).toString('hex') | |
13402 | } | |
13403 | ||
13404 | // https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#child-key-derivation-ckd-functions | |
13405 | HDNode.prototype.derive = function(index) { | |
13406 | var isHardened = index >= HDNode.HIGHEST_BIT | |
13407 | var indexBuffer = new Buffer(4) | |
13408 | indexBuffer.writeUInt32BE(index, 0) | |
13409 | ||
13410 | var data | |
13411 | ||
13412 | // Hardened child | |
13413 | if (isHardened) { | |
13414 | assert(this.privKey, 'Could not derive hardened child key') | |
13415 | ||
13416 | // data = 0x00 || ser256(kpar) || ser32(index) | |
13417 | data = Buffer.concat([ | |
13418 | this.privKey.d.toBuffer(33), | |
13419 | indexBuffer | |
13420 | ]) | |
13421 | ||
13422 | // Normal child | |
13423 | } else { | |
13424 | // data = serP(point(kpar)) || ser32(index) | |
13425 | // = serP(Kpar) || ser32(index) | |
13426 | data = Buffer.concat([ | |
13427 | this.pubKey.toBuffer(), | |
13428 | indexBuffer | |
13429 | ]) | |
13430 | } | |
13431 | ||
13432 | var I = crypto.HmacSHA512(data, this.chainCode) | |
13433 | var IL = I.slice(0, 32) | |
13434 | var IR = I.slice(32) | |
13435 | ||
13436 | var pIL = BigInteger.fromBuffer(IL) | |
13437 | ||
13438 | // In case parse256(IL) >= n, proceed with the next value for i | |
13439 | if (pIL.compareTo(curve.n) >= 0) { | |
13440 | return this.derive(index + 1) | |
13441 | } | |
13442 | ||
13443 | // Private parent key -> private child key | |
13444 | var hd | |
13445 | if (this.privKey) { | |
13446 | // ki = parse256(IL) + kpar (mod n) | |
13447 | var ki = pIL.add(this.privKey.d).mod(curve.n) | |
13448 | ||
13449 | // In case ki == 0, proceed with the next value for i | |
13450 | if (ki.signum() === 0) { | |
13451 | return this.derive(index + 1) | |
13452 | } | |
13453 | ||
13454 | hd = new HDNode(ki, IR, this.network) | |
13455 | ||
13456 | // Public parent key -> public child key | |
13457 | } else { | |
13458 | // Ki = point(parse256(IL)) + Kpar | |
13459 | // = G*IL + Kpar | |
13460 | var Ki = curve.G.multiply(pIL).add(this.pubKey.Q) | |
13461 | ||
13462 | // In case Ki is the point at infinity, proceed with the next value for i | |
13463 | if (curve.isInfinity(Ki)) { | |
13464 | return this.derive(index + 1) | |
13465 | } | |
13466 | ||
13467 | hd = new HDNode(Ki, IR, this.network) | |
13468 | } | |
13469 | ||
13470 | hd.depth = this.depth + 1 | |
13471 | hd.index = index | |
13472 | hd.parentFingerprint = this.getFingerprint().readUInt32BE(0) | |
13473 | ||
13474 | return hd | |
13475 | } | |
13476 | ||
13477 | HDNode.prototype.deriveHardened = function(index) { | |
13478 | // Only derives hardened private keys by default | |
13479 | return this.derive(index + HDNode.HIGHEST_BIT) | |
13480 | } | |
13481 | ||
13482 | HDNode.prototype.toString = HDNode.prototype.toBase58 | |
13483 | ||
13484 | module.exports = HDNode | |
13485 | ||
13486 | }).call(this,_dereq_("buffer").Buffer) | |
13487 | },{"./base58check":70,"./crypto":73,"./eckey":75,"./ecpubkey":76,"./networks":81,"assert":4,"bigi":3,"buffer":8,"ecurve":65}],79:[function(_dereq_,module,exports){ | |
13488 | module.exports = { | |
13489 | Address: _dereq_('./address'), | |
13490 | base58check: _dereq_('./base58check'), | |
13491 | bufferutils: _dereq_('./bufferutils'), | |
13492 | convert: _dereq_('./convert'), | |
13493 | crypto: _dereq_('./crypto'), | |
13494 | ecdsa: _dereq_('./ecdsa'), | |
13495 | ECKey: _dereq_('./eckey'), | |
13496 | ECPubKey: _dereq_('./ecpubkey'), | |
13497 | ECSignature: _dereq_('./ecsignature'), | |
13498 | Message: _dereq_('./message'), | |
13499 | opcodes: _dereq_('./opcodes'), | |
13500 | HDNode: _dereq_('./hdnode'), | |
13501 | Script: _dereq_('./script'), | |
13502 | scripts: _dereq_('./scripts'), | |
13503 | Transaction: _dereq_('./transaction'), | |
13504 | networks: _dereq_('./networks'), | |
13505 | Wallet: _dereq_('./wallet') | |
13506 | } | |
13507 | ||
13508 | },{"./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){ | |
13509 | (function (Buffer){ | |
13510 | /// Implements Bitcoin's feature for signing arbitrary messages. | |
13511 | var Address = _dereq_('./address') | |
13512 | var BigInteger = _dereq_('bigi') | |
13513 | var bufferutils = _dereq_('./bufferutils') | |
13514 | var crypto = _dereq_('./crypto') | |
13515 | var ecdsa = _dereq_('./ecdsa') | |
13516 | var networks = _dereq_('./networks') | |
13517 | ||
13518 | var Address = _dereq_('./address') | |
13519 | var ECPubKey = _dereq_('./ecpubkey') | |
13520 | var ECSignature = _dereq_('./ecsignature') | |
13521 | ||
13522 | var ecurve = _dereq_('ecurve') | |
13523 | var ecparams = ecurve.getCurveByName('secp256k1') | |
13524 | ||
13525 | function magicHash(message, network) { | |
13526 | var magicPrefix = new Buffer(network.magicPrefix) | |
13527 | var messageBuffer = new Buffer(message) | |
13528 | var lengthBuffer = new Buffer(bufferutils.varIntSize(messageBuffer.length)) | |
13529 | bufferutils.writeVarInt(lengthBuffer, messageBuffer.length, 0) | |
13530 | ||
13531 | var buffer = Buffer.concat([magicPrefix, lengthBuffer, messageBuffer]) | |
13532 | return crypto.hash256(buffer) | |
13533 | } | |
13534 | ||
13535 | function sign(privKey, message, network) { | |
13536 | network = network || networks.bitcoin | |
13537 | ||
13538 | var hash = magicHash(message, network) | |
13539 | var signature = privKey.sign(hash) | |
13540 | var e = BigInteger.fromBuffer(hash) | |
13541 | var i = ecdsa.calcPubKeyRecoveryParam(ecparams, e, signature, privKey.pub.Q) | |
13542 | ||
13543 | return signature.toCompact(i, privKey.pub.compressed) | |
13544 | } | |
13545 | ||
13546 | // TODO: network could be implied from address | |
13547 | function verify(address, signatureBuffer, message, network) { | |
13548 | if (address instanceof Address) { | |
13549 | address = address.toString() | |
13550 | } | |
13551 | network = network || networks.bitcoin | |
13552 | ||
13553 | var hash = magicHash(message, network) | |
13554 | var parsed = ECSignature.parseCompact(signatureBuffer) | |
13555 | var e = BigInteger.fromBuffer(hash) | |
13556 | var Q = ecdsa.recoverPubKey(ecparams, e, parsed.signature, parsed.i) | |
13557 | ||
13558 | var pubKey = new ECPubKey(Q, parsed.compressed) | |
13559 | return pubKey.getAddress(network).toString() === address | |
13560 | } | |
13561 | ||
13562 | module.exports = { | |
13563 | magicHash: magicHash, | |
13564 | sign: sign, | |
13565 | verify: verify | |
13566 | } | |
13567 | ||
13568 | }).call(this,_dereq_("buffer").Buffer) | |
13569 | },{"./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){ | |
13570 | // https://en.bitcoin.it/wiki/List_of_address_prefixes | |
13571 | // Dogecoin BIP32 is a proposed standard: https://bitcointalk.org/index.php?topic=409731 | |
13572 | ||
13573 | var networks = { | |
13574 | bitcoin: { | |
13575 | magicPrefix: '\x18Bitcoin Signed Message:\n', | |
13576 | bip32: { | |
13577 | public: 0x0488b21e, | |
13578 | private: 0x0488ade4 | |
13579 | }, | |
13580 | pubKeyHash: 0x00, | |
13581 | scriptHash: 0x05, | |
13582 | wif: 0x80, | |
13583 | dustThreshold: 546, // https://github.com/bitcoin/bitcoin/blob/v0.9.2/src/core.h#L151-L162 | |
13584 | feePerKb: 10000, // https://github.com/bitcoin/bitcoin/blob/v0.9.2/src/main.cpp#L53 | |
13585 | estimateFee: estimateFee('bitcoin') | |
13586 | }, | |
13587 | dogecoin: { | |
13588 | magicPrefix: '\x19Dogecoin Signed Message:\n', | |
13589 | bip32: { | |
13590 | public: 0x02facafd, | |
13591 | private: 0x02fac398 | |
13592 | }, | |
13593 | pubKeyHash: 0x1e, | |
13594 | scriptHash: 0x16, | |
13595 | wif: 0x9e, | |
13596 | dustThreshold: 0, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/core.h#L155-L160 | |
13597 | dustSoftThreshold: 100000000, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/main.h#L62 | |
13598 | feePerKb: 100000000, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/main.cpp#L58 | |
13599 | estimateFee: estimateFee('dogecoin') | |
13600 | }, | |
13601 | litecoin: { | |
13602 | magicPrefix: '\x19Litecoin Signed Message:\n', | |
13603 | bip32: { | |
13604 | public: 0x019da462, | |
13605 | private: 0x019d9cfe | |
13606 | }, | |
13607 | pubKeyHash: 0x30, | |
13608 | scriptHash: 0x05, | |
13609 | wif: 0xb0, | |
13610 | dustThreshold: 0, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L360-L365 | |
13611 | dustSoftThreshold: 100000, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.h#L53 | |
13612 | feePerKb: 100000, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L56 | |
13613 | estimateFee: estimateFee('litecoin') | |
13614 | }, | |
13615 | testnet: { | |
13616 | magicPrefix: '\x18Bitcoin Signed Message:\n', | |
13617 | bip32: { | |
13618 | public: 0x043587cf, | |
13619 | private: 0x04358394 | |
13620 | }, | |
13621 | pubKeyHash: 0x6f, | |
13622 | scriptHash: 0xc4, | |
13623 | wif: 0xef, | |
13624 | dustThreshold: 546, | |
13625 | feePerKb: 10000, | |
13626 | estimateFee: estimateFee('testnet') | |
13627 | } | |
13628 | } | |
13629 | ||
13630 | function estimateFee(type) { | |
13631 | return function(tx) { | |
13632 | var network = networks[type] | |
13633 | var baseFee = network.feePerKb | |
13634 | var byteSize = tx.toBuffer().length | |
13635 | ||
13636 | var fee = baseFee * Math.ceil(byteSize / 1000) | |
13637 | if (network.dustSoftThreshold == undefined) return fee | |
13638 | ||
13639 | tx.outs.forEach(function(e){ | |
13640 | if (e.value < network.dustSoftThreshold) { | |
13641 | fee += baseFee | |
13642 | } | |
13643 | }) | |
13644 | ||
13645 | return fee | |
13646 | } | |
13647 | } | |
13648 | ||
13649 | module.exports = networks | |
13650 | ||
13651 | },{}],82:[function(_dereq_,module,exports){ | |
13652 | module.exports = { | |
13653 | // push value | |
13654 | OP_FALSE : 0, | |
13655 | OP_0 : 0, | |
13656 | OP_PUSHDATA1 : 76, | |
13657 | OP_PUSHDATA2 : 77, | |
13658 | OP_PUSHDATA4 : 78, | |
13659 | OP_1NEGATE : 79, | |
13660 | OP_RESERVED : 80, | |
13661 | OP_1 : 81, | |
13662 | OP_TRUE : 81, | |
13663 | OP_2 : 82, | |
13664 | OP_3 : 83, | |
13665 | OP_4 : 84, | |
13666 | OP_5 : 85, | |
13667 | OP_6 : 86, | |
13668 | OP_7 : 87, | |
13669 | OP_8 : 88, | |
13670 | OP_9 : 89, | |
13671 | OP_10 : 90, | |
13672 | OP_11 : 91, | |
13673 | OP_12 : 92, | |
13674 | OP_13 : 93, | |
13675 | OP_14 : 94, | |
13676 | OP_15 : 95, | |
13677 | OP_16 : 96, | |
13678 | ||
13679 | // control | |
13680 | OP_NOP : 97, | |
13681 | OP_VER : 98, | |
13682 | OP_IF : 99, | |
13683 | OP_NOTIF : 100, | |
13684 | OP_VERIF : 101, | |
13685 | OP_VERNOTIF : 102, | |
13686 | OP_ELSE : 103, | |
13687 | OP_ENDIF : 104, | |
13688 | OP_VERIFY : 105, | |
13689 | OP_RETURN : 106, | |
13690 | ||
13691 | // stack ops | |
13692 | OP_TOALTSTACK : 107, | |
13693 | OP_FROMALTSTACK : 108, | |
13694 | OP_2DROP : 109, | |
13695 | OP_2DUP : 110, | |
13696 | OP_3DUP : 111, | |
13697 | OP_2OVER : 112, | |
13698 | OP_2ROT : 113, | |
13699 | OP_2SWAP : 114, | |
13700 | OP_IFDUP : 115, | |
13701 | OP_DEPTH : 116, | |
13702 | OP_DROP : 117, | |
13703 | OP_DUP : 118, | |
13704 | OP_NIP : 119, | |
13705 | OP_OVER : 120, | |
13706 | OP_PICK : 121, | |
13707 | OP_ROLL : 122, | |
13708 | OP_ROT : 123, | |
13709 | OP_SWAP : 124, | |
13710 | OP_TUCK : 125, | |
13711 | ||
13712 | // splice ops | |
13713 | OP_CAT : 126, | |
13714 | OP_SUBSTR : 127, | |
13715 | OP_LEFT : 128, | |
13716 | OP_RIGHT : 129, | |
13717 | OP_SIZE : 130, | |
13718 | ||
13719 | // bit logic | |
13720 | OP_INVERT : 131, | |
13721 | OP_AND : 132, | |
13722 | OP_OR : 133, | |
13723 | OP_XOR : 134, | |
13724 | OP_EQUAL : 135, | |
13725 | OP_EQUALVERIFY : 136, | |
13726 | OP_RESERVED1 : 137, | |
13727 | OP_RESERVED2 : 138, | |
13728 | ||
13729 | // numeric | |
13730 | OP_1ADD : 139, | |
13731 | OP_1SUB : 140, | |
13732 | OP_2MUL : 141, | |
13733 | OP_2DIV : 142, | |
13734 | OP_NEGATE : 143, | |
13735 | OP_ABS : 144, | |
13736 | OP_NOT : 145, | |
13737 | OP_0NOTEQUAL : 146, | |
13738 | ||
13739 | OP_ADD : 147, | |
13740 | OP_SUB : 148, | |
13741 | OP_MUL : 149, | |
13742 | OP_DIV : 150, | |
13743 | OP_MOD : 151, | |
13744 | OP_LSHIFT : 152, | |
13745 | OP_RSHIFT : 153, | |
13746 | ||
13747 | OP_BOOLAND : 154, | |
13748 | OP_BOOLOR : 155, | |
13749 | OP_NUMEQUAL : 156, | |
13750 | OP_NUMEQUALVERIFY : 157, | |
13751 | OP_NUMNOTEQUAL : 158, | |
13752 | OP_LESSTHAN : 159, | |
13753 | OP_GREATERTHAN : 160, | |
13754 | OP_LESSTHANOREQUAL : 161, | |
13755 | OP_GREATERTHANOREQUAL : 162, | |
13756 | OP_MIN : 163, | |
13757 | OP_MAX : 164, | |
13758 | ||
13759 | OP_WITHIN : 165, | |
13760 | ||
13761 | // crypto | |
13762 | OP_RIPEMD160 : 166, | |
13763 | OP_SHA1 : 167, | |
13764 | OP_SHA256 : 168, | |
13765 | OP_HASH160 : 169, | |
13766 | OP_HASH256 : 170, | |
13767 | OP_CODESEPARATOR : 171, | |
13768 | OP_CHECKSIG : 172, | |
13769 | OP_CHECKSIGVERIFY : 173, | |
13770 | OP_CHECKMULTISIG : 174, | |
13771 | OP_CHECKMULTISIGVERIFY : 175, | |
13772 | ||
13773 | // expansion | |
13774 | OP_NOP1 : 176, | |
13775 | OP_NOP2 : 177, | |
13776 | OP_NOP3 : 178, | |
13777 | OP_NOP4 : 179, | |
13778 | OP_NOP5 : 180, | |
13779 | OP_NOP6 : 181, | |
13780 | OP_NOP7 : 182, | |
13781 | OP_NOP8 : 183, | |
13782 | OP_NOP9 : 184, | |
13783 | OP_NOP10 : 185, | |
13784 | ||
13785 | // template matching params | |
13786 | OP_PUBKEYHASH : 253, | |
13787 | OP_PUBKEY : 254, | |
13788 | OP_INVALIDOPCODE : 255 | |
13789 | } | |
13790 | ||
13791 | },{}],83:[function(_dereq_,module,exports){ | |
13792 | (function (Buffer){ | |
13793 | var assert = _dereq_('assert') | |
13794 | var bufferutils = _dereq_('./bufferutils') | |
13795 | var crypto = _dereq_('./crypto') | |
13796 | var opcodes = _dereq_('./opcodes') | |
13797 | ||
13798 | function Script(buffer, chunks) { | |
13799 | assert(Buffer.isBuffer(buffer), 'Expected Buffer, got ' + buffer) | |
13800 | assert(Array.isArray(chunks), 'Expected Array, got ' + chunks) | |
13801 | ||
13802 | this.buffer = buffer | |
13803 | this.chunks = chunks | |
13804 | } | |
13805 | ||
13806 | // Import operations | |
13807 | Script.fromASM = function(asm) { | |
13808 | var strChunks = asm.split(' ') | |
13809 | ||
13810 | var chunks = strChunks.map(function(strChunk) { | |
13811 | if (strChunk in opcodes) { | |
13812 | return opcodes[strChunk] | |
13813 | ||
13814 | } else { | |
13815 | return new Buffer(strChunk, 'hex') | |
13816 | } | |
13817 | }) | |
13818 | ||
13819 | return Script.fromChunks(chunks) | |
13820 | } | |
13821 | ||
13822 | Script.fromBuffer = function(buffer) { | |
13823 | var chunks = [] | |
13824 | ||
13825 | var i = 0 | |
13826 | ||
13827 | while (i < buffer.length) { | |
13828 | var opcode = buffer.readUInt8(i) | |
13829 | ||
13830 | if ((opcode > opcodes.OP_0) && (opcode <= opcodes.OP_PUSHDATA4)) { | |
13831 | var d = bufferutils.readPushDataInt(buffer, i) | |
13832 | i += d.size | |
13833 | ||
13834 | var data = buffer.slice(i, i + d.number) | |
13835 | i += d.number | |
13836 | ||
13837 | chunks.push(data) | |
13838 | ||
13839 | } else { | |
13840 | chunks.push(opcode) | |
13841 | ||
13842 | i += 1 | |
13843 | } | |
13844 | } | |
13845 | ||
13846 | return new Script(buffer, chunks) | |
13847 | } | |
13848 | ||
13849 | Script.fromChunks = function(chunks) { | |
13850 | assert(Array.isArray(chunks), 'Expected Array, got ' + chunks) | |
13851 | ||
13852 | var bufferSize = chunks.reduce(function(accum, chunk) { | |
13853 | if (Buffer.isBuffer(chunk)) { | |
13854 | return accum + bufferutils.pushDataSize(chunk.length) + chunk.length | |
13855 | } | |
13856 | ||
13857 | return accum + 1 | |
13858 | }, 0.0) | |
13859 | ||
13860 | var buffer = new Buffer(bufferSize) | |
13861 | var offset = 0 | |
13862 | ||
13863 | chunks.forEach(function(chunk) { | |
13864 | if (Buffer.isBuffer(chunk)) { | |
13865 | offset += bufferutils.writePushDataInt(buffer, chunk.length, offset) | |
13866 | ||
13867 | chunk.copy(buffer, offset) | |
13868 | offset += chunk.length | |
13869 | ||
13870 | } else { | |
13871 | buffer.writeUInt8(chunk, offset) | |
13872 | offset += 1 | |
13873 | } | |
13874 | }) | |
13875 | ||
13876 | assert.equal(offset, buffer.length, 'Could not decode chunks') | |
13877 | return new Script(buffer, chunks) | |
13878 | } | |
13879 | ||
13880 | Script.fromHex = function(hex) { | |
13881 | return Script.fromBuffer(new Buffer(hex, 'hex')) | |
13882 | } | |
13883 | ||
13884 | // Constants | |
13885 | Script.EMPTY = Script.fromChunks([]) | |
13886 | ||
13887 | // Operations | |
13888 | Script.prototype.getHash = function() { | |
13889 | return crypto.hash160(this.buffer) | |
13890 | } | |
13891 | ||
13892 | // FIXME: doesn't work for data chunks, maybe time to use buffertools.compare... | |
13893 | Script.prototype.without = function(needle) { | |
13894 | return Script.fromChunks(this.chunks.filter(function(op) { | |
13895 | return op !== needle | |
13896 | })) | |
13897 | } | |
13898 | ||
13899 | // Export operations | |
13900 | var reverseOps = [] | |
13901 | for (var op in opcodes) { | |
13902 | var code = opcodes[op] | |
13903 | reverseOps[code] = op | |
13904 | } | |
13905 | ||
13906 | Script.prototype.toASM = function() { | |
13907 | return this.chunks.map(function(chunk) { | |
13908 | if (Buffer.isBuffer(chunk)) { | |
13909 | return chunk.toString('hex') | |
13910 | ||
13911 | } else { | |
13912 | return reverseOps[chunk] | |
13913 | } | |
13914 | }).join(' ') | |
13915 | } | |
13916 | ||
13917 | Script.prototype.toBuffer = function() { | |
13918 | return this.buffer | |
13919 | } | |
13920 | ||
13921 | Script.prototype.toHex = function() { | |
13922 | return this.toBuffer().toString('hex') | |
13923 | } | |
13924 | ||
13925 | module.exports = Script | |
13926 | ||
13927 | }).call(this,_dereq_("buffer").Buffer) | |
13928 | },{"./bufferutils":71,"./crypto":73,"./opcodes":82,"assert":4,"buffer":8}],84:[function(_dereq_,module,exports){ | |
13929 | (function (Buffer){ | |
13930 | var assert = _dereq_('assert') | |
13931 | var opcodes = _dereq_('./opcodes') | |
13932 | ||
13933 | // FIXME: use ECPubKey, currently the circular dependency breaks everything. | |
13934 | // | |
13935 | // Solutions: | |
13936 | // * Remove ECPubKey.getAddress | |
13937 | // - Minimal change, but likely unpopular | |
13938 | // * Move all script related functionality out of Address | |
13939 | // - Means a lot of changes to Transaction/Wallet | |
13940 | // * Ignore it (existing solution) | |
13941 | // * Some form of hackery with commonjs | |
13942 | // | |
13943 | var ecurve = _dereq_('ecurve') | |
13944 | var curve = ecurve.getCurveByName('secp256k1') | |
13945 | ||
13946 | var ECSignature = _dereq_('./ecsignature') | |
13947 | var Script = _dereq_('./script') | |
13948 | ||
13949 | function classifyOutput(script) { | |
13950 | assert(script instanceof Script, 'Expected Script, got ', script) | |
13951 | ||
13952 | if (isPubKeyHashOutput.call(script)) { | |
13953 | return 'pubkeyhash' | |
13954 | } else if (isScriptHashOutput.call(script)) { | |
13955 | return 'scripthash' | |
13956 | } else if (isMultisigOutput.call(script)) { | |
13957 | return 'multisig' | |
13958 | } else if (isPubKeyOutput.call(script)) { | |
13959 | return 'pubkey' | |
13960 | } else if (isNulldataOutput.call(script)) { | |
13961 | return 'nulldata' | |
13962 | } else { | |
13963 | return 'nonstandard' | |
13964 | } | |
13965 | } | |
13966 | ||
13967 | function classifyInput(script) { | |
13968 | assert(script instanceof Script, 'Expected Script, got ', script) | |
13969 | ||
13970 | if (isPubKeyHashInput.call(script)) { | |
13971 | return 'pubkeyhash' | |
13972 | } else if (isScriptHashInput.call(script)) { | |
13973 | return 'scripthash' | |
13974 | } else if (isMultisigInput.call(script)) { | |
13975 | return 'multisig' | |
13976 | } else if (isPubKeyInput.call(script)) { | |
13977 | return 'pubkey' | |
13978 | } else { | |
13979 | return 'nonstandard' | |
13980 | } | |
13981 | } | |
13982 | ||
13983 | function isCanonicalPubKey(buffer) { | |
13984 | if (!Buffer.isBuffer(buffer)) return false | |
13985 | ||
13986 | try { | |
13987 | // FIXME: boo | |
13988 | ecurve.Point.decodeFrom(curve, buffer) | |
13989 | } catch (e) { | |
13990 | if (!(e.message.match(/Invalid sequence (length|tag)/))) throw e | |
13991 | ||
13992 | return false | |
13993 | } | |
13994 | ||
13995 | return true | |
13996 | } | |
13997 | ||
13998 | function isCanonicalSignature(buffer) { | |
13999 | if (!Buffer.isBuffer(buffer)) return false | |
14000 | ||
14001 | try { | |
14002 | ECSignature.parseScriptSignature(buffer) | |
14003 | } catch(e) { | |
14004 | 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 | |
14005 | ||
14006 | return false | |
14007 | } | |
14008 | ||
14009 | return true | |
14010 | } | |
14011 | ||
14012 | function isPubKeyHashInput() { | |
14013 | return this.chunks.length === 2 && | |
14014 | isCanonicalSignature(this.chunks[0]) && | |
14015 | isCanonicalPubKey(this.chunks[1]) | |
14016 | } | |
14017 | ||
14018 | function isPubKeyHashOutput() { | |
14019 | return this.chunks.length === 5 && | |
14020 | this.chunks[0] === opcodes.OP_DUP && | |
14021 | this.chunks[1] === opcodes.OP_HASH160 && | |
14022 | Buffer.isBuffer(this.chunks[2]) && | |
14023 | this.chunks[2].length === 20 && | |
14024 | this.chunks[3] === opcodes.OP_EQUALVERIFY && | |
14025 | this.chunks[4] === opcodes.OP_CHECKSIG | |
14026 | } | |
14027 | ||
14028 | function isPubKeyInput() { | |
14029 | return this.chunks.length === 1 && | |
14030 | isCanonicalSignature(this.chunks[0]) | |
14031 | } | |
14032 | ||
14033 | function isPubKeyOutput() { | |
14034 | return this.chunks.length === 2 && | |
14035 | isCanonicalPubKey(this.chunks[0]) && | |
14036 | this.chunks[1] === opcodes.OP_CHECKSIG | |
14037 | } | |
14038 | ||
14039 | function isScriptHashInput() { | |
14040 | if (this.chunks.length < 2) return false | |
14041 | var lastChunk = this.chunks[this.chunks.length - 1] | |
14042 | ||
14043 | if (!Buffer.isBuffer(lastChunk)) return false | |
14044 | ||
14045 | var scriptSig = Script.fromChunks(this.chunks.slice(0, -1)) | |
14046 | var scriptPubKey = Script.fromBuffer(lastChunk) | |
14047 | ||
14048 | return classifyInput(scriptSig) === classifyOutput(scriptPubKey) | |
14049 | } | |
14050 | ||
14051 | function isScriptHashOutput() { | |
14052 | return this.chunks.length === 3 && | |
14053 | this.chunks[0] === opcodes.OP_HASH160 && | |
14054 | Buffer.isBuffer(this.chunks[1]) && | |
14055 | this.chunks[1].length === 20 && | |
14056 | this.chunks[2] === opcodes.OP_EQUAL | |
14057 | } | |
14058 | ||
14059 | function isMultisigInput() { | |
14060 | return this.chunks[0] === opcodes.OP_0 && | |
14061 | this.chunks.slice(1).every(isCanonicalSignature) | |
14062 | } | |
14063 | ||
14064 | function isMultisigOutput() { | |
14065 | if (this.chunks < 4) return false | |
14066 | if (this.chunks[this.chunks.length - 1] !== opcodes.OP_CHECKMULTISIG) return false | |
14067 | ||
14068 | var mOp = this.chunks[0] | |
14069 | if (mOp === opcodes.OP_0) return false | |
14070 | if (mOp < opcodes.OP_1) return false | |
14071 | if (mOp > opcodes.OP_16) return false | |
14072 | ||
14073 | var nOp = this.chunks[this.chunks.length - 2] | |
14074 | if (nOp === opcodes.OP_0) return false | |
14075 | if (nOp < opcodes.OP_1) return false | |
14076 | if (nOp > opcodes.OP_16) return false | |
14077 | ||
14078 | var m = mOp - (opcodes.OP_1 - 1) | |
14079 | var n = nOp - (opcodes.OP_1 - 1) | |
14080 | if (n < m) return false | |
14081 | ||
14082 | var pubKeys = this.chunks.slice(1, -2) | |
14083 | if (n < pubKeys.length) return false | |
14084 | ||
14085 | return pubKeys.every(isCanonicalPubKey) | |
14086 | } | |
14087 | ||
14088 | function isNulldataOutput() { | |
14089 | return this.chunks[0] === opcodes.OP_RETURN | |
14090 | } | |
14091 | ||
14092 | // Standard Script Templates | |
14093 | // {pubKey} OP_CHECKSIG | |
14094 | function pubKeyOutput(pubKey) { | |
14095 | return Script.fromChunks([ | |
14096 | pubKey.toBuffer(), | |
14097 | opcodes.OP_CHECKSIG | |
14098 | ]) | |
14099 | } | |
14100 | ||
14101 | // OP_DUP OP_HASH160 {pubKeyHash} OP_EQUALVERIFY OP_CHECKSIG | |
14102 | function pubKeyHashOutput(hash) { | |
14103 | assert(Buffer.isBuffer(hash), 'Expected Buffer, got ' + hash) | |
14104 | ||
14105 | return Script.fromChunks([ | |
14106 | opcodes.OP_DUP, | |
14107 | opcodes.OP_HASH160, | |
14108 | hash, | |
14109 | opcodes.OP_EQUALVERIFY, | |
14110 | opcodes.OP_CHECKSIG | |
14111 | ]) | |
14112 | } | |
14113 | ||
14114 | // OP_HASH160 {scriptHash} OP_EQUAL | |
14115 | function scriptHashOutput(hash) { | |
14116 | assert(Buffer.isBuffer(hash), 'Expected Buffer, got ' + hash) | |
14117 | ||
14118 | return Script.fromChunks([ | |
14119 | opcodes.OP_HASH160, | |
14120 | hash, | |
14121 | opcodes.OP_EQUAL | |
14122 | ]) | |
14123 | } | |
14124 | ||
14125 | // m [pubKeys ...] n OP_CHECKMULTISIG | |
14126 | function multisigOutput(m, pubKeys) { | |
14127 | assert(Array.isArray(pubKeys), 'Expected Array, got ' + pubKeys) | |
14128 | assert(pubKeys.length >= m, 'Not enough pubKeys provided') | |
14129 | ||
14130 | var pubKeyBuffers = pubKeys.map(function(pubKey) { | |
14131 | return pubKey.toBuffer() | |
14132 | }) | |
14133 | var n = pubKeys.length | |
14134 | ||
14135 | return Script.fromChunks([].concat( | |
14136 | (opcodes.OP_1 - 1) + m, | |
14137 | pubKeyBuffers, | |
14138 | (opcodes.OP_1 - 1) + n, | |
14139 | opcodes.OP_CHECKMULTISIG | |
14140 | )) | |
14141 | } | |
14142 | ||
14143 | // {signature} | |
14144 | function pubKeyInput(signature) { | |
14145 | assert(Buffer.isBuffer(signature), 'Expected Buffer, got ' + signature) | |
14146 | ||
14147 | return Script.fromChunks([signature]) | |
14148 | } | |
14149 | ||
14150 | // {signature} {pubKey} | |
14151 | function pubKeyHashInput(signature, pubKey) { | |
14152 | assert(Buffer.isBuffer(signature), 'Expected Buffer, got ' + signature) | |
14153 | ||
14154 | return Script.fromChunks([signature, pubKey.toBuffer()]) | |
14155 | } | |
14156 | ||
14157 | // <scriptSig> {serialized scriptPubKey script} | |
14158 | function scriptHashInput(scriptSig, scriptPubKey) { | |
14159 | return Script.fromChunks([].concat( | |
14160 | scriptSig.chunks, | |
14161 | scriptPubKey.toBuffer() | |
14162 | )) | |
14163 | } | |
14164 | ||
14165 | // OP_0 [signatures ...] | |
14166 | function multisigInput(signatures, scriptPubKey) { | |
14167 | if (scriptPubKey) { | |
14168 | assert(isMultisigOutput.call(scriptPubKey)) | |
14169 | ||
14170 | var m = scriptPubKey.chunks[0] | |
14171 | var k = m - (opcodes.OP_1 - 1) | |
14172 | assert(k <= signatures.length, 'Not enough signatures provided') | |
14173 | } | |
14174 | ||
14175 | return Script.fromChunks([].concat(opcodes.OP_0, signatures)) | |
14176 | } | |
14177 | ||
14178 | module.exports = { | |
14179 | classifyInput: classifyInput, | |
14180 | classifyOutput: classifyOutput, | |
14181 | multisigInput: multisigInput, | |
14182 | multisigOutput: multisigOutput, | |
14183 | pubKeyHashInput: pubKeyHashInput, | |
14184 | pubKeyHashOutput: pubKeyHashOutput, | |
14185 | pubKeyInput: pubKeyInput, | |
14186 | pubKeyOutput: pubKeyOutput, | |
14187 | scriptHashInput: scriptHashInput, | |
14188 | scriptHashOutput: scriptHashOutput | |
14189 | } | |
14190 | ||
14191 | }).call(this,_dereq_("buffer").Buffer) | |
14192 | },{"./ecsignature":77,"./opcodes":82,"./script":83,"assert":4,"buffer":8,"ecurve":65}],85:[function(_dereq_,module,exports){ | |
14193 | (function (Buffer){ | |
14194 | var assert = _dereq_('assert') | |
14195 | var bufferutils = _dereq_('./bufferutils') | |
14196 | var crypto = _dereq_('./crypto') | |
14197 | var opcodes = _dereq_('./opcodes') | |
14198 | var scripts = _dereq_('./scripts') | |
14199 | ||
14200 | var Address = _dereq_('./address') | |
14201 | var ECKey = _dereq_('./eckey') | |
14202 | var ECSignature = _dereq_('./ecsignature') | |
14203 | var Script = _dereq_('./script') | |
14204 | ||
14205 | Transaction.DEFAULT_SEQUENCE = 0xffffffff | |
14206 | Transaction.SIGHASH_ALL = 0x01 | |
14207 | Transaction.SIGHASH_NONE = 0x02 | |
14208 | Transaction.SIGHASH_SINGLE = 0x03 | |
14209 | Transaction.SIGHASH_ANYONECANPAY = 0x80 | |
14210 | ||
14211 | function Transaction() { | |
14212 | this.version = 1 | |
14213 | this.locktime = 0 | |
14214 | this.ins = [] | |
14215 | this.outs = [] | |
14216 | } | |
14217 | ||
14218 | /** | |
14219 | * Create a new txin. | |
14220 | * | |
14221 | * Can be called with any of: | |
14222 | * | |
14223 | * - A transaction and an index | |
14224 | * - A transaction hash and an index | |
14225 | * | |
14226 | * Note that this method does not sign the created input. | |
14227 | */ | |
14228 | Transaction.prototype.addInput = function(tx, index, sequence) { | |
14229 | if (sequence == undefined) sequence = Transaction.DEFAULT_SEQUENCE | |
14230 | ||
14231 | var hash | |
14232 | ||
14233 | if (typeof tx === 'string') { | |
14234 | hash = new Buffer(tx, 'hex') | |
14235 | ||
14236 | // TxId hex is big-endian, we need little-endian | |
14237 | Array.prototype.reverse.call(hash) | |
14238 | ||
14239 | } else if (tx instanceof Transaction) { | |
14240 | hash = tx.getHash() | |
14241 | ||
14242 | } else { | |
14243 | hash = tx | |
14244 | } | |
14245 | ||
14246 | assert(Buffer.isBuffer(hash), 'Expected Transaction, txId or txHash, got ' + tx) | |
14247 | assert.equal(hash.length, 32, 'Expected hash length of 32, got ' + hash.length) | |
14248 | assert.equal(typeof index, 'number', 'Expected number index, got ' + index) | |
14249 | ||
14250 | return (this.ins.push({ | |
14251 | hash: hash, | |
14252 | index: index, | |
14253 | script: Script.EMPTY, | |
14254 | sequence: sequence | |
14255 | }) - 1) | |
14256 | } | |
14257 | ||
14258 | /** | |
14259 | * Create a new txout. | |
14260 | * | |
14261 | * Can be called with: | |
14262 | * | |
14263 | * - A base58 address string and a value | |
14264 | * - An Address object and a value | |
14265 | * - A scriptPubKey Script and a value | |
14266 | */ | |
14267 | Transaction.prototype.addOutput = function(scriptPubKey, value) { | |
14268 | // Attempt to get a valid address if it's a base58 address string | |
14269 | if (typeof scriptPubKey === 'string') { | |
14270 | scriptPubKey = Address.fromBase58Check(scriptPubKey) | |
14271 | } | |
14272 | ||
14273 | // Attempt to get a valid script if it's an Address object | |
14274 | if (scriptPubKey instanceof Address) { | |
14275 | var address = scriptPubKey | |
14276 | ||
14277 | scriptPubKey = address.toOutputScript() | |
14278 | } | |
14279 | ||
14280 | return (this.outs.push({ | |
14281 | script: scriptPubKey, | |
14282 | value: value, | |
14283 | }) - 1) | |
14284 | } | |
14285 | ||
14286 | Transaction.prototype.toBuffer = function () { | |
14287 | var txInSize = this.ins.reduce(function(a, x) { | |
14288 | return a + (40 + bufferutils.varIntSize(x.script.buffer.length) + x.script.buffer.length) | |
14289 | }, 0) | |
14290 | ||
14291 | var txOutSize = this.outs.reduce(function(a, x) { | |
14292 | return a + (8 + bufferutils.varIntSize(x.script.buffer.length) + x.script.buffer.length) | |
14293 | }, 0) | |
14294 | ||
14295 | var buffer = new Buffer( | |
14296 | 8 + | |
14297 | bufferutils.varIntSize(this.ins.length) + | |
14298 | bufferutils.varIntSize(this.outs.length) + | |
14299 | txInSize + | |
14300 | txOutSize | |
14301 | ) | |
14302 | ||
14303 | var offset = 0 | |
14304 | function writeSlice(slice) { | |
14305 | slice.copy(buffer, offset) | |
14306 | offset += slice.length | |
14307 | } | |
14308 | function writeUInt32(i) { | |
14309 | buffer.writeUInt32LE(i, offset) | |
14310 | offset += 4 | |
14311 | } | |
14312 | function writeUInt64(i) { | |
14313 | bufferutils.writeUInt64LE(buffer, i, offset) | |
14314 | offset += 8 | |
14315 | } | |
14316 | function writeVarInt(i) { | |
14317 | var n = bufferutils.writeVarInt(buffer, i, offset) | |
14318 | offset += n | |
14319 | } | |
14320 | ||
14321 | writeUInt32(this.version) | |
14322 | writeVarInt(this.ins.length) | |
14323 | ||
14324 | this.ins.forEach(function(txin) { | |
14325 | writeSlice(txin.hash) | |
14326 | writeUInt32(txin.index) | |
14327 | writeVarInt(txin.script.buffer.length) | |
14328 | writeSlice(txin.script.buffer) | |
14329 | writeUInt32(txin.sequence) | |
14330 | }) | |
14331 | ||
14332 | writeVarInt(this.outs.length) | |
14333 | this.outs.forEach(function(txout) { | |
14334 | writeUInt64(txout.value) | |
14335 | writeVarInt(txout.script.buffer.length) | |
14336 | writeSlice(txout.script.buffer) | |
14337 | }) | |
14338 | ||
14339 | writeUInt32(this.locktime) | |
14340 | ||
14341 | return buffer | |
14342 | } | |
14343 | ||
14344 | Transaction.prototype.toHex = function() { | |
14345 | return this.toBuffer().toString('hex') | |
14346 | } | |
14347 | ||
14348 | /** | |
14349 | * Hash transaction for signing a specific input. | |
14350 | * | |
14351 | * Bitcoin uses a different hash for each signed transaction input. This | |
14352 | * method copies the transaction, makes the necessary changes based on the | |
14353 | * hashType, serializes and finally hashes the result. This hash can then be | |
14354 | * used to sign the transaction input in question. | |
14355 | */ | |
14356 | Transaction.prototype.hashForSignature = function(prevOutScript, inIndex, hashType) { | |
14357 | assert(inIndex >= 0, 'Invalid vin index') | |
14358 | assert(inIndex < this.ins.length, 'Invalid vin index') | |
14359 | assert(prevOutScript instanceof Script, 'Invalid Script object') | |
14360 | ||
14361 | var txTmp = this.clone() | |
14362 | var hashScript = prevOutScript.without(opcodes.OP_CODESEPARATOR) | |
14363 | ||
14364 | // Blank out other inputs' signatures | |
14365 | txTmp.ins.forEach(function(txin) { | |
14366 | txin.script = Script.EMPTY | |
14367 | }) | |
14368 | txTmp.ins[inIndex].script = hashScript | |
14369 | ||
14370 | var hashTypeModifier = hashType & 0x1f | |
14371 | if (hashTypeModifier === Transaction.SIGHASH_NONE) { | |
14372 | assert(false, 'SIGHASH_NONE not yet supported') | |
14373 | ||
14374 | } else if (hashTypeModifier === Transaction.SIGHASH_SINGLE) { | |
14375 | assert(false, 'SIGHASH_SINGLE not yet supported') | |
14376 | ||
14377 | } | |
14378 | ||
14379 | if (hashType & Transaction.SIGHASH_ANYONECANPAY) { | |
14380 | assert(false, 'SIGHASH_ANYONECANPAY not yet supported') | |
14381 | } | |
14382 | ||
14383 | var hashTypeBuffer = new Buffer(4) | |
14384 | hashTypeBuffer.writeInt32LE(hashType, 0) | |
14385 | ||
14386 | var buffer = Buffer.concat([txTmp.toBuffer(), hashTypeBuffer]) | |
14387 | return crypto.hash256(buffer) | |
14388 | } | |
14389 | ||
14390 | Transaction.prototype.getHash = function () { | |
14391 | return crypto.hash256(this.toBuffer()) | |
14392 | } | |
14393 | ||
14394 | Transaction.prototype.getId = function () { | |
14395 | var buffer = this.getHash() | |
14396 | ||
14397 | // Big-endian is used for TxHash | |
14398 | Array.prototype.reverse.call(buffer) | |
14399 | ||
14400 | return buffer.toString('hex') | |
14401 | } | |
14402 | ||
14403 | Transaction.prototype.clone = function () { | |
14404 | var newTx = new Transaction() | |
14405 | newTx.version = this.version | |
14406 | newTx.locktime = this.locktime | |
14407 | ||
14408 | newTx.ins = this.ins.map(function(txin) { | |
14409 | return { | |
14410 | hash: txin.hash, | |
14411 | index: txin.index, | |
14412 | script: txin.script, | |
14413 | sequence: txin.sequence | |
14414 | } | |
14415 | }) | |
14416 | ||
14417 | newTx.outs = this.outs.map(function(txout) { | |
14418 | return { | |
14419 | script: txout.script, | |
14420 | value: txout.value | |
14421 | } | |
14422 | }) | |
14423 | ||
14424 | return newTx | |
14425 | } | |
14426 | ||
14427 | Transaction.fromBuffer = function(buffer) { | |
14428 | var offset = 0 | |
14429 | function readSlice(n) { | |
14430 | offset += n | |
14431 | return buffer.slice(offset - n, offset) | |
14432 | } | |
14433 | function readUInt32() { | |
14434 | var i = buffer.readUInt32LE(offset) | |
14435 | offset += 4 | |
14436 | return i | |
14437 | } | |
14438 | function readUInt64() { | |
14439 | var i = bufferutils.readUInt64LE(buffer, offset) | |
14440 | offset += 8 | |
14441 | return i | |
14442 | } | |
14443 | function readVarInt() { | |
14444 | var vi = bufferutils.readVarInt(buffer, offset) | |
14445 | offset += vi.size | |
14446 | return vi.number | |
14447 | } | |
14448 | ||
14449 | var tx = new Transaction() | |
14450 | tx.version = readUInt32() | |
14451 | ||
14452 | var vinLen = readVarInt() | |
14453 | for (var i = 0; i < vinLen; ++i) { | |
14454 | var hash = readSlice(32) | |
14455 | var vout = readUInt32() | |
14456 | var scriptLen = readVarInt() | |
14457 | var script = readSlice(scriptLen) | |
14458 | var sequence = readUInt32() | |
14459 | ||
14460 | tx.ins.push({ | |
14461 | hash: hash, | |
14462 | index: vout, | |
14463 | script: Script.fromBuffer(script), | |
14464 | sequence: sequence | |
14465 | }) | |
14466 | } | |
14467 | ||
14468 | var voutLen = readVarInt() | |
14469 | for (i = 0; i < voutLen; ++i) { | |
14470 | var value = readUInt64() | |
14471 | var scriptLen = readVarInt() | |
14472 | var script = readSlice(scriptLen) | |
14473 | ||
14474 | tx.outs.push({ | |
14475 | value: value, | |
14476 | script: Script.fromBuffer(script) | |
14477 | }) | |
14478 | } | |
14479 | ||
14480 | tx.locktime = readUInt32() | |
14481 | assert.equal(offset, buffer.length, 'Transaction has unexpected data') | |
14482 | ||
14483 | return tx | |
14484 | } | |
14485 | ||
14486 | Transaction.fromHex = function(hex) { | |
14487 | return Transaction.fromBuffer(new Buffer(hex, 'hex')) | |
14488 | } | |
14489 | ||
14490 | /** | |
14491 | * Signs a pubKeyHash output at some index with the given key | |
14492 | */ | |
14493 | Transaction.prototype.sign = function(index, privKey, hashType) { | |
14494 | var prevOutScript = privKey.pub.getAddress().toOutputScript() | |
14495 | var signature = this.signInput(index, prevOutScript, privKey, hashType) | |
14496 | ||
14497 | // FIXME: Assumed prior TX was pay-to-pubkey-hash | |
14498 | var scriptSig = scripts.pubKeyHashInput(signature, privKey.pub) | |
14499 | this.setInputScript(index, scriptSig) | |
14500 | } | |
14501 | ||
14502 | Transaction.prototype.signInput = function(index, prevOutScript, privKey, hashType) { | |
14503 | hashType = hashType || Transaction.SIGHASH_ALL | |
14504 | ||
14505 | var hash = this.hashForSignature(prevOutScript, index, hashType) | |
14506 | var signature = privKey.sign(hash) | |
14507 | ||
14508 | return signature.toScriptSignature(hashType) | |
14509 | } | |
14510 | ||
14511 | Transaction.prototype.setInputScript = function(index, script) { | |
14512 | this.ins[index].script = script | |
14513 | } | |
14514 | ||
14515 | // FIXME: could be validateInput(index, prevTxOut, pub) | |
14516 | Transaction.prototype.validateInput = function(index, prevOutScript, pubKey, buffer) { | |
14517 | var parsed = ECSignature.parseScriptSignature(buffer) | |
14518 | var hash = this.hashForSignature(prevOutScript, index, parsed.hashType) | |
14519 | ||
14520 | return pubKey.verify(hash, parsed.signature) | |
14521 | } | |
14522 | ||
14523 | module.exports = Transaction | |
14524 | ||
14525 | }).call(this,_dereq_("buffer").Buffer) | |
14526 | },{"./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){ | |
14527 | (function (Buffer){ | |
14528 | var assert = _dereq_('assert') | |
14529 | var networks = _dereq_('./networks') | |
14530 | var rng = _dereq_('secure-random') | |
14531 | ||
14532 | var Address = _dereq_('./address') | |
14533 | var HDNode = _dereq_('./hdnode') | |
14534 | var Transaction = _dereq_('./transaction') | |
14535 | ||
14536 | function Wallet(seed, network) { | |
14537 | network = network || networks.bitcoin | |
14538 | ||
14539 | // Stored in a closure to make accidental serialization less likely | |
14540 | var masterkey = null | |
14541 | var me = this | |
14542 | var accountZero = null | |
14543 | var internalAccount = null | |
14544 | var externalAccount = null | |
14545 | ||
14546 | // Addresses | |
14547 | this.addresses = [] | |
14548 | this.changeAddresses = [] | |
14549 | ||
14550 | // Transaction output data | |
14551 | this.outputs = {} | |
14552 | ||
14553 | // Make a new master key | |
14554 | this.newMasterKey = function(seed) { | |
14555 | seed = seed || new Buffer(rng(32)) | |
14556 | masterkey = HDNode.fromSeedBuffer(seed, network) | |
14557 | ||
14558 | // HD first-level child derivation method should be hardened | |
14559 | // See https://bitcointalk.org/index.php?topic=405179.msg4415254#msg4415254 | |
14560 | accountZero = masterkey.deriveHardened(0) | |
14561 | externalAccount = accountZero.derive(0) | |
14562 | internalAccount = accountZero.derive(1) | |
14563 | ||
14564 | me.addresses = [] | |
14565 | me.changeAddresses = [] | |
14566 | ||
14567 | me.outputs = {} | |
14568 | } | |
14569 | ||
14570 | this.newMasterKey(seed) | |
14571 | ||
14572 | this.generateAddress = function() { | |
14573 | var key = externalAccount.derive(this.addresses.length) | |
14574 | this.addresses.push(key.getAddress().toString()) | |
14575 | return this.addresses[this.addresses.length - 1] | |
14576 | } | |
14577 | ||
14578 | this.generateChangeAddress = function() { | |
14579 | var key = internalAccount.derive(this.changeAddresses.length) | |
14580 | this.changeAddresses.push(key.getAddress().toString()) | |
14581 | return this.changeAddresses[this.changeAddresses.length - 1] | |
14582 | } | |
14583 | ||
14584 | this.getBalance = function() { | |
14585 | return this.getUnspentOutputs().reduce(function(memo, output){ | |
14586 | return memo + output.value | |
14587 | }, 0) | |
14588 | } | |
14589 | ||
14590 | this.getUnspentOutputs = function() { | |
14591 | var utxo = [] | |
14592 | ||
14593 | for(var key in this.outputs){ | |
14594 | var output = this.outputs[key] | |
14595 | if(!output.to) utxo.push(outputToUnspentOutput(output)) | |
14596 | } | |
14597 | ||
14598 | return utxo | |
14599 | } | |
14600 | ||
14601 | this.setUnspentOutputs = function(utxo) { | |
14602 | var outputs = {} | |
14603 | ||
14604 | utxo.forEach(function(uo){ | |
14605 | validateUnspentOutput(uo) | |
14606 | var o = unspentOutputToOutput(uo) | |
14607 | outputs[o.from] = o | |
14608 | }) | |
14609 | ||
14610 | this.outputs = outputs | |
14611 | } | |
14612 | ||
14613 | function outputToUnspentOutput(output){ | |
14614 | var hashAndIndex = output.from.split(":") | |
14615 | ||
14616 | return { | |
14617 | hash: hashAndIndex[0], | |
14618 | outputIndex: parseInt(hashAndIndex[1]), | |
14619 | address: output.address, | |
14620 | value: output.value, | |
14621 | pending: output.pending | |
14622 | } | |
14623 | } | |
14624 | ||
14625 | function unspentOutputToOutput(o) { | |
14626 | var hash = o.hash | |
14627 | var key = hash + ":" + o.outputIndex | |
14628 | return { | |
14629 | from: key, | |
14630 | address: o.address, | |
14631 | value: o.value, | |
14632 | pending: o.pending | |
14633 | } | |
14634 | } | |
14635 | ||
14636 | function validateUnspentOutput(uo) { | |
14637 | var missingField | |
14638 | ||
14639 | if (isNullOrUndefined(uo.hash)) { | |
14640 | missingField = "hash" | |
14641 | } | |
14642 | ||
14643 | var requiredKeys = ['outputIndex', 'address', 'value'] | |
14644 | requiredKeys.forEach(function (key) { | |
14645 | if (isNullOrUndefined(uo[key])){ | |
14646 | missingField = key | |
14647 | } | |
14648 | }) | |
14649 | ||
14650 | if (missingField) { | |
14651 | var message = [ | |
14652 | 'Invalid unspent output: key', missingField, 'is missing.', | |
14653 | 'A valid unspent output must contain' | |
14654 | ] | |
14655 | message.push(requiredKeys.join(', ')) | |
14656 | message.push("and hash") | |
14657 | throw new Error(message.join(' ')) | |
14658 | } | |
14659 | } | |
14660 | ||
14661 | function isNullOrUndefined(value) { | |
14662 | return value == undefined | |
14663 | } | |
14664 | ||
14665 | this.processPendingTx = function(tx){ | |
14666 | processTx(tx, true) | |
14667 | } | |
14668 | ||
14669 | this.processConfirmedTx = function(tx){ | |
14670 | processTx(tx, false) | |
14671 | } | |
14672 | ||
14673 | function processTx(tx, isPending) { | |
14674 | var txid = tx.getId() | |
14675 | ||
14676 | tx.outs.forEach(function(txOut, i) { | |
14677 | var address | |
14678 | ||
14679 | try { | |
14680 | address = Address.fromOutputScript(txOut.script, network).toString() | |
14681 | } catch(e) { | |
14682 | if (!(e.message.match(/has no matching Address/))) throw e | |
14683 | } | |
14684 | ||
14685 | if (isMyAddress(address)) { | |
14686 | var output = txid + ':' + i | |
14687 | ||
14688 | me.outputs[output] = { | |
14689 | from: output, | |
14690 | value: txOut.value, | |
14691 | address: address, | |
14692 | pending: isPending | |
14693 | } | |
14694 | } | |
14695 | }) | |
14696 | ||
14697 | tx.ins.forEach(function(txIn, i) { | |
14698 | // copy and convert to big-endian hex | |
14699 | var txinId = new Buffer(txIn.hash) | |
14700 | Array.prototype.reverse.call(txinId) | |
14701 | txinId = txinId.toString('hex') | |
14702 | ||
14703 | var output = txinId + ':' + txIn.index | |
14704 | ||
14705 | if (!(output in me.outputs)) return | |
14706 | ||
14707 | if (isPending) { | |
14708 | me.outputs[output].to = txid + ':' + i | |
14709 | me.outputs[output].pending = true | |
14710 | } else { | |
14711 | delete me.outputs[output] | |
14712 | } | |
14713 | }) | |
14714 | } | |
14715 | ||
14716 | this.createTx = function(to, value, fixedFee, changeAddress) { | |
14717 | assert(value > network.dustThreshold, value + ' must be above dust threshold (' + network.dustThreshold + ' Satoshis)') | |
14718 | ||
14719 | var utxos = getCandidateOutputs(value) | |
14720 | var accum = 0 | |
14721 | var subTotal = value | |
14722 | var addresses = [] | |
14723 | ||
14724 | var tx = new Transaction() | |
14725 | tx.addOutput(to, value) | |
14726 | ||
14727 | for (var i = 0; i < utxos.length; ++i) { | |
14728 | var utxo = utxos[i] | |
14729 | addresses.push(utxo.address) | |
14730 | ||
14731 | var outpoint = utxo.from.split(':') | |
14732 | tx.addInput(outpoint[0], parseInt(outpoint[1])) | |
14733 | ||
14734 | var fee = fixedFee == undefined ? estimateFeePadChangeOutput(tx) : fixedFee | |
14735 | ||
14736 | accum += utxo.value | |
14737 | subTotal = value + fee | |
14738 | if (accum >= subTotal) { | |
14739 | var change = accum - subTotal | |
14740 | ||
14741 | if (change > network.dustThreshold) { | |
14742 | tx.addOutput(changeAddress || getChangeAddress(), change) | |
14743 | } | |
14744 | ||
14745 | break | |
14746 | } | |
14747 | } | |
14748 | ||
14749 | assert(accum >= subTotal, 'Not enough funds (incl. fee): ' + accum + ' < ' + subTotal) | |
14750 | ||
14751 | this.signWith(tx, addresses) | |
14752 | return tx | |
14753 | } | |
14754 | ||
14755 | function getCandidateOutputs() { | |
14756 | var unspent = [] | |
14757 | ||
14758 | for (var key in me.outputs) { | |
14759 | var output = me.outputs[key] | |
14760 | if (!output.pending) unspent.push(output) | |
14761 | } | |
14762 | ||
14763 | var sortByValueDesc = unspent.sort(function(o1, o2){ | |
14764 | return o2.value - o1.value | |
14765 | }) | |
14766 | ||
14767 | return sortByValueDesc | |
14768 | } | |
14769 | ||
14770 | function estimateFeePadChangeOutput(tx) { | |
14771 | var tmpTx = tx.clone() | |
14772 | tmpTx.addOutput(getChangeAddress(), network.dustSoftThreshold || 0) | |
14773 | ||
14774 | return network.estimateFee(tmpTx) | |
14775 | } | |
14776 | ||
14777 | function getChangeAddress() { | |
14778 | if(me.changeAddresses.length === 0) me.generateChangeAddress(); | |
14779 | return me.changeAddresses[me.changeAddresses.length - 1] | |
14780 | } | |
14781 | ||
14782 | this.signWith = function(tx, addresses) { | |
14783 | assert.equal(tx.ins.length, addresses.length, 'Number of addresses must match number of transaction inputs') | |
14784 | ||
14785 | addresses.forEach(function(address, i) { | |
14786 | var key = me.getPrivateKeyForAddress(address) | |
14787 | ||
14788 | tx.sign(i, key) | |
14789 | }) | |
14790 | ||
14791 | return tx | |
14792 | } | |
14793 | ||
14794 | this.getMasterKey = function() { return masterkey } | |
14795 | this.getAccountZero = function() { return accountZero } | |
14796 | this.getInternalAccount = function() { return internalAccount } | |
14797 | this.getExternalAccount = function() { return externalAccount } | |
14798 | ||
14799 | this.getPrivateKey = function(index) { | |
14800 | return externalAccount.derive(index).privKey | |
14801 | } | |
14802 | ||
14803 | this.getInternalPrivateKey = function(index) { | |
14804 | return internalAccount.derive(index).privKey | |
14805 | } | |
14806 | ||
14807 | this.getPrivateKeyForAddress = function(address) { | |
14808 | var index | |
14809 | if((index = this.addresses.indexOf(address)) > -1) { | |
14810 | return this.getPrivateKey(index) | |
14811 | } else if((index = this.changeAddresses.indexOf(address)) > -1) { | |
14812 | return this.getInternalPrivateKey(index) | |
14813 | } else { | |
14814 | throw new Error('Unknown address. Make sure the address is from the keychain and has been generated.') | |
14815 | } | |
14816 | } | |
14817 | ||
14818 | function isReceiveAddress(address){ | |
14819 | return me.addresses.indexOf(address) > -1 | |
14820 | } | |
14821 | ||
14822 | function isChangeAddress(address){ | |
14823 | return me.changeAddresses.indexOf(address) > -1 | |
14824 | } | |
14825 | ||
14826 | function isMyAddress(address) { | |
14827 | return isReceiveAddress(address) || isChangeAddress(address) | |
14828 | } | |
14829 | } | |
14830 | ||
14831 | module.exports = Wallet | |
14832 | ||
14833 | }).call(this,_dereq_("buffer").Buffer) | |
14834 | },{"./address":69,"./hdnode":78,"./networks":81,"./transaction":85,"assert":4,"buffer":8,"secure-random":68}]},{},[79]) | |
14835 | (79) | |
14836 | }); | |
14837 | </script> | |
14838 | ||
14839 | <!--<script src="/js/asmcrypto.js"></script>--> | |
14840 | <script> | |
14841 | // INCLUDE ASMCRYPTO | |
14842 | // https://rawgit.com/tresorit/asmcrypto.js/598a1098504f1b2d0e615bc51dd8404afd2d338b/asmcrypto.js | |
14843 | // Provides PBKDF2 functionality | |
14844 | // It's faster than CryptoJS | |
14845 | // Couldn't get SJCL working as desired | |
14846 | ||
14847 | ||
14848 | (function(exports, global) { | |
14849 | "use strict"; | |
14850 | global["asmCrypto"] = exports; | |
14851 | function string_to_bytes(str) { | |
14852 | var i, len = str.length, arr = new Uint8Array(len); | |
14853 | for (i = 0; i < len; i += 1) { | |
14854 | arr[i] = str.charCodeAt(i); | |
14855 | } | |
14856 | return arr; | |
14857 | } | |
14858 | function hex_to_bytes(str) { | |
14859 | var arr = [], len = str.length, i; | |
14860 | if (len & 1) { | |
14861 | str = "0" + str; | |
14862 | len++; | |
14863 | } | |
14864 | for (i = 0; i < len; i += 2) { | |
14865 | arr.push(parseInt(str.substr(i, 2), 16)); | |
14866 | } | |
14867 | return new Uint8Array(arr); | |
14868 | } | |
14869 | function base64_to_bytes(str) { | |
14870 | return string_to_bytes(atob(str)); | |
14871 | } | |
14872 | function bytes_to_string(arr) { | |
14873 | var str = ""; | |
14874 | for (var i = 0; i < arr.length; i++) str += String.fromCharCode(arr[i]); | |
14875 | return str; | |
14876 | } | |
14877 | function bytes_to_hex(arr) { | |
14878 | var sz = (arr.byteLength || arr.length) / arr.length, str = ""; | |
14879 | for (var i = 0; i < arr.length; i++) { | |
14880 | var h = arr[i].toString(16); | |
14881 | if (h.length < 2 * sz) str += "00000000000000".substr(0, 2 * sz - h.length); | |
14882 | str += h; | |
14883 | } | |
14884 | return str; | |
14885 | } | |
14886 | function bytes_to_base64(arr) { | |
14887 | return btoa(bytes_to_string(arr)); | |
14888 | } | |
14889 | function pow2_ceil(a) { | |
14890 | a -= 1; | |
14891 | a |= a >>> 1; | |
14892 | a |= a >>> 2; | |
14893 | a |= a >>> 4; | |
14894 | a |= a >>> 8; | |
14895 | a |= a >>> 16; | |
14896 | a += 1; | |
14897 | return a; | |
14898 | } | |
14899 | function is_number(a) { | |
14900 | return typeof a === "number"; | |
14901 | } | |
14902 | function is_string(a) { | |
14903 | return typeof a === "string"; | |
14904 | } | |
14905 | function is_buffer(a) { | |
14906 | return a instanceof ArrayBuffer; | |
14907 | } | |
14908 | function is_bytes(a) { | |
14909 | return a instanceof Uint8Array; | |
14910 | } | |
14911 | function is_typed_array(a) { | |
14912 | 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; | |
14913 | } | |
14914 | function IllegalStateError() { | |
14915 | Error.apply(this, arguments); | |
14916 | } | |
14917 | IllegalStateError.prototype = new Error(); | |
14918 | function IllegalArgumentError() { | |
14919 | Error.apply(this, arguments); | |
14920 | } | |
14921 | IllegalArgumentError.prototype = new Error(); | |
14922 | function SecurityError() { | |
14923 | Error.apply(this, arguments); | |
14924 | } | |
14925 | IllegalArgumentError.prototype = new Error(); | |
14926 | 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 ]; | |
14927 | var _aes_heap_start = 2048; | |
14928 | function _aes_asm(stdlib, foreign, buffer) { | |
14929 | // Closure Compiler warning - commented out | |
14930 | //"use asm"; | |
14931 | 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; | |
14932 | var keySize = 0; | |
14933 | 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; | |
14934 | var HEAP = new stdlib.Uint8Array(buffer); | |
14935 | function _expand_key_128() { | |
14936 | var sbox = 0; | |
14937 | R10 = R00 ^ HEAP[sbox | R0D] ^ 1; | |
14938 | R11 = R01 ^ HEAP[sbox | R0E]; | |
14939 | R12 = R02 ^ HEAP[sbox | R0F]; | |
14940 | R13 = R03 ^ HEAP[sbox | R0C]; | |
14941 | R14 = R04 ^ R10; | |
14942 | R15 = R05 ^ R11; | |
14943 | R16 = R06 ^ R12; | |
14944 | R17 = R07 ^ R13; | |
14945 | R18 = R08 ^ R14; | |
14946 | R19 = R09 ^ R15; | |
14947 | R1A = R0A ^ R16; | |
14948 | R1B = R0B ^ R17; | |
14949 | R1C = R0C ^ R18; | |
14950 | R1D = R0D ^ R19; | |
14951 | R1E = R0E ^ R1A; | |
14952 | R1F = R0F ^ R1B; | |
14953 | R20 = R10 ^ HEAP[sbox | R1D] ^ 2; | |
14954 | R21 = R11 ^ HEAP[sbox | R1E]; | |
14955 | R22 = R12 ^ HEAP[sbox | R1F]; | |
14956 | R23 = R13 ^ HEAP[sbox | R1C]; | |
14957 | R24 = R14 ^ R20; | |
14958 | R25 = R15 ^ R21; | |
14959 | R26 = R16 ^ R22; | |
14960 | R27 = R17 ^ R23; | |
14961 | R28 = R18 ^ R24; | |
14962 | R29 = R19 ^ R25; | |
14963 | R2A = R1A ^ R26; | |
14964 | R2B = R1B ^ R27; | |
14965 | R2C = R1C ^ R28; | |
14966 | R2D = R1D ^ R29; | |
14967 | R2E = R1E ^ R2A; | |
14968 | R2F = R1F ^ R2B; | |
14969 | R30 = R20 ^ HEAP[sbox | R2D] ^ 4; | |
14970 | R31 = R21 ^ HEAP[sbox | R2E]; | |
14971 | R32 = R22 ^ HEAP[sbox | R2F]; | |
14972 | R33 = R23 ^ HEAP[sbox | R2C]; | |
14973 | R34 = R24 ^ R30; | |
14974 | R35 = R25 ^ R31; | |
14975 | R36 = R26 ^ R32; | |
14976 | R37 = R27 ^ R33; | |
14977 | R38 = R28 ^ R34; | |
14978 | R39 = R29 ^ R35; | |
14979 | R3A = R2A ^ R36; | |
14980 | R3B = R2B ^ R37; | |
14981 | R3C = R2C ^ R38; | |
14982 | R3D = R2D ^ R39; | |
14983 | R3E = R2E ^ R3A; | |
14984 | R3F = R2F ^ R3B; | |
14985 | R40 = R30 ^ HEAP[sbox | R3D] ^ 8; | |
14986 | R41 = R31 ^ HEAP[sbox | R3E]; | |
14987 | R42 = R32 ^ HEAP[sbox | R3F]; | |
14988 | R43 = R33 ^ HEAP[sbox | R3C]; | |
14989 | R44 = R34 ^ R40; | |
14990 | R45 = R35 ^ R41; | |
14991 | R46 = R36 ^ R42; | |
14992 | R47 = R37 ^ R43; | |
14993 | R48 = R38 ^ R44; | |
14994 | R49 = R39 ^ R45; | |
14995 | R4A = R3A ^ R46; | |
14996 | R4B = R3B ^ R47; | |
14997 | R4C = R3C ^ R48; | |
14998 | R4D = R3D ^ R49; | |
14999 | R4E = R3E ^ R4A; | |
15000 | R4F = R3F ^ R4B; | |
15001 | R50 = R40 ^ HEAP[sbox | R4D] ^ 16; | |
15002 | R51 = R41 ^ HEAP[sbox | R4E]; | |
15003 | R52 = R42 ^ HEAP[sbox | R4F]; | |
15004 | R53 = R43 ^ HEAP[sbox | R4C]; | |
15005 | R54 = R44 ^ R50; | |
15006 | R55 = R45 ^ R51; | |
15007 | R56 = R46 ^ R52; | |
15008 | R57 = R47 ^ R53; | |
15009 | R58 = R48 ^ R54; | |
15010 | R59 = R49 ^ R55; | |
15011 | R5A = R4A ^ R56; | |
15012 | R5B = R4B ^ R57; | |
15013 | R5C = R4C ^ R58; | |
15014 | R5D = R4D ^ R59; | |
15015 | R5E = R4E ^ R5A; | |
15016 | R5F = R4F ^ R5B; | |
15017 | R60 = R50 ^ HEAP[sbox | R5D] ^ 32; | |
15018 | R61 = R51 ^ HEAP[sbox | R5E]; | |
15019 | R62 = R52 ^ HEAP[sbox | R5F]; | |
15020 | R63 = R53 ^ HEAP[sbox | R5C]; | |
15021 | R64 = R54 ^ R60; | |
15022 | R65 = R55 ^ R61; | |
15023 | R66 = R56 ^ R62; | |
15024 | R67 = R57 ^ R63; | |
15025 | R68 = R58 ^ R64; | |
15026 | R69 = R59 ^ R65; | |
15027 | R6A = R5A ^ R66; | |
15028 | R6B = R5B ^ R67; | |
15029 | R6C = R5C ^ R68; | |
15030 | R6D = R5D ^ R69; | |
15031 | R6E = R5E ^ R6A; | |
15032 | R6F = R5F ^ R6B; | |
15033 | R70 = R60 ^ HEAP[sbox | R6D] ^ 64; | |
15034 | R71 = R61 ^ HEAP[sbox | R6E]; | |
15035 | R72 = R62 ^ HEAP[sbox | R6F]; | |
15036 | R73 = R63 ^ HEAP[sbox | R6C]; | |
15037 | R74 = R64 ^ R70; | |
15038 | R75 = R65 ^ R71; | |
15039 | R76 = R66 ^ R72; | |
15040 | R77 = R67 ^ R73; | |
15041 | R78 = R68 ^ R74; | |
15042 | R79 = R69 ^ R75; | |
15043 | R7A = R6A ^ R76; | |
15044 | R7B = R6B ^ R77; | |
15045 | R7C = R6C ^ R78; | |
15046 | R7D = R6D ^ R79; | |
15047 | R7E = R6E ^ R7A; | |
15048 | R7F = R6F ^ R7B; | |
15049 | R80 = R70 ^ HEAP[sbox | R7D] ^ 128; | |
15050 | R81 = R71 ^ HEAP[sbox | R7E]; | |
15051 | R82 = R72 ^ HEAP[sbox | R7F]; | |
15052 | R83 = R73 ^ HEAP[sbox | R7C]; | |
15053 | R84 = R74 ^ R80; | |
15054 | R85 = R75 ^ R81; | |
15055 | R86 = R76 ^ R82; | |
15056 | R87 = R77 ^ R83; | |
15057 | R88 = R78 ^ R84; | |
15058 | R89 = R79 ^ R85; | |
15059 | R8A = R7A ^ R86; | |
15060 | R8B = R7B ^ R87; | |
15061 | R8C = R7C ^ R88; | |
15062 | R8D = R7D ^ R89; | |
15063 | R8E = R7E ^ R8A; | |
15064 | R8F = R7F ^ R8B; | |
15065 | R90 = R80 ^ HEAP[sbox | R8D] ^ 27; | |
15066 | R91 = R81 ^ HEAP[sbox | R8E]; | |
15067 | R92 = R82 ^ HEAP[sbox | R8F]; | |
15068 | R93 = R83 ^ HEAP[sbox | R8C]; | |
15069 | R94 = R84 ^ R90; | |
15070 | R95 = R85 ^ R91; | |
15071 | R96 = R86 ^ R92; | |
15072 | R97 = R87 ^ R93; | |
15073 | R98 = R88 ^ R94; | |
15074 | R99 = R89 ^ R95; | |
15075 | R9A = R8A ^ R96; | |
15076 | R9B = R8B ^ R97; | |
15077 | R9C = R8C ^ R98; | |
15078 | R9D = R8D ^ R99; | |
15079 | R9E = R8E ^ R9A; | |
15080 | R9F = R8F ^ R9B; | |
15081 | RA0 = R90 ^ HEAP[sbox | R9D] ^ 54; | |
15082 | RA1 = R91 ^ HEAP[sbox | R9E]; | |
15083 | RA2 = R92 ^ HEAP[sbox | R9F]; | |
15084 | RA3 = R93 ^ HEAP[sbox | R9C]; | |
15085 | RA4 = R94 ^ RA0; | |
15086 | RA5 = R95 ^ RA1; | |
15087 | RA6 = R96 ^ RA2; | |
15088 | RA7 = R97 ^ RA3; | |
15089 | RA8 = R98 ^ RA4; | |
15090 | RA9 = R99 ^ RA5; | |
15091 | RAA = R9A ^ RA6; | |
15092 | RAB = R9B ^ RA7; | |
15093 | RAC = R9C ^ RA8; | |
15094 | RAD = R9D ^ RA9; | |
15095 | RAE = R9E ^ RAA; | |
15096 | RAF = R9F ^ RAB; | |
15097 | } | |
15098 | function _expand_key_256() { | |
15099 | var sbox = 0; | |
15100 | R20 = R00 ^ HEAP[sbox | R1D] ^ 1; | |
15101 | R21 = R01 ^ HEAP[sbox | R1E]; | |
15102 | R22 = R02 ^ HEAP[sbox | R1F]; | |
15103 | R23 = R03 ^ HEAP[sbox | R1C]; | |
15104 | R24 = R04 ^ R20; | |
15105 | R25 = R05 ^ R21; | |
15106 | R26 = R06 ^ R22; | |
15107 | R27 = R07 ^ R23; | |
15108 | R28 = R08 ^ R24; | |
15109 | R29 = R09 ^ R25; | |
15110 | R2A = R0A ^ R26; | |
15111 | R2B = R0B ^ R27; | |
15112 | R2C = R0C ^ R28; | |
15113 | R2D = R0D ^ R29; | |
15114 | R2E = R0E ^ R2A; | |
15115 | R2F = R0F ^ R2B; | |
15116 | R30 = R10 ^ HEAP[sbox | R2C]; | |
15117 | R31 = R11 ^ HEAP[sbox | R2D]; | |
15118 | R32 = R12 ^ HEAP[sbox | R2E]; | |
15119 | R33 = R13 ^ HEAP[sbox | R2F]; | |
15120 | R34 = R14 ^ R30; | |
15121 | R35 = R15 ^ R31; | |
15122 | R36 = R16 ^ R32; | |
15123 | R37 = R17 ^ R33; | |
15124 | R38 = R18 ^ R34; | |
15125 | R39 = R19 ^ R35; | |
15126 | R3A = R1A ^ R36; | |
15127 | R3B = R1B ^ R37; | |
15128 | R3C = R1C ^ R38; | |
15129 | R3D = R1D ^ R39; | |
15130 | R3E = R1E ^ R3A; | |
15131 | R3F = R1F ^ R3B; | |
15132 | R40 = R20 ^ HEAP[sbox | R3D] ^ 2; | |
15133 | R41 = R21 ^ HEAP[sbox | R3E]; | |
15134 | R42 = R22 ^ HEAP[sbox | R3F]; | |
15135 | R43 = R23 ^ HEAP[sbox | R3C]; | |
15136 | R44 = R24 ^ R40; | |
15137 | R45 = R25 ^ R41; | |
15138 | R46 = R26 ^ R42; | |
15139 | R47 = R27 ^ R43; | |
15140 | R48 = R28 ^ R44; | |
15141 | R49 = R29 ^ R45; | |
15142 | R4A = R2A ^ R46; | |
15143 | R4B = R2B ^ R47; | |
15144 | R4C = R2C ^ R48; | |
15145 | R4D = R2D ^ R49; | |
15146 | R4E = R2E ^ R4A; | |
15147 | R4F = R2F ^ R4B; | |
15148 | R50 = R30 ^ HEAP[sbox | R4C]; | |
15149 | R51 = R31 ^ HEAP[sbox | R4D]; | |
15150 | R52 = R32 ^ HEAP[sbox | R4E]; | |
15151 | R53 = R33 ^ HEAP[sbox | R4F]; | |
15152 | R54 = R34 ^ R50; | |
15153 | R55 = R35 ^ R51; | |
15154 | R56 = R36 ^ R52; | |
15155 | R57 = R37 ^ R53; | |
15156 | R58 = R38 ^ R54; | |
15157 | R59 = R39 ^ R55; | |
15158 | R5A = R3A ^ R56; | |
15159 | R5B = R3B ^ R57; | |
15160 | R5C = R3C ^ R58; | |
15161 | R5D = R3D ^ R59; | |
15162 | R5E = R3E ^ R5A; | |
15163 | R5F = R3F ^ R5B; | |
15164 | R60 = R40 ^ HEAP[sbox | R5D] ^ 4; | |
15165 | R61 = R41 ^ HEAP[sbox | R5E]; | |
15166 | R62 = R42 ^ HEAP[sbox | R5F]; | |
15167 | R63 = R43 ^ HEAP[sbox | R5C]; | |
15168 | R64 = R44 ^ R60; | |
15169 | R65 = R45 ^ R61; | |
15170 | R66 = R46 ^ R62; | |
15171 | R67 = R47 ^ R63; | |
15172 | R68 = R48 ^ R64; | |
15173 | R69 = R49 ^ R65; | |
15174 | R6A = R4A ^ R66; | |
15175 | R6B = R4B ^ R67; | |
15176 | R6C = R4C ^ R68; | |
15177 | R6D = R4D ^ R69; | |
15178 | R6E = R4E ^ R6A; | |
15179 | R6F = R4F ^ R6B; | |
15180 | R70 = R50 ^ HEAP[sbox | R6C]; | |
15181 | R71 = R51 ^ HEAP[sbox | R6D]; | |
15182 | R72 = R52 ^ HEAP[sbox | R6E]; | |
15183 | R73 = R53 ^ HEAP[sbox | R6F]; | |
15184 | R74 = R54 ^ R70; | |
15185 | R75 = R55 ^ R71; | |
15186 | R76 = R56 ^ R72; | |
15187 | R77 = R57 ^ R73; | |
15188 | R78 = R58 ^ R74; | |
15189 | R79 = R59 ^ R75; | |
15190 | R7A = R5A ^ R76; | |
15191 | R7B = R5B ^ R77; | |
15192 | R7C = R5C ^ R78; | |
15193 | R7D = R5D ^ R79; | |
15194 | R7E = R5E ^ R7A; | |
15195 | R7F = R5F ^ R7B; | |
15196 | R80 = R60 ^ HEAP[sbox | R7D] ^ 8; | |
15197 | R81 = R61 ^ HEAP[sbox | R7E]; | |
15198 | R82 = R62 ^ HEAP[sbox | R7F]; | |
15199 | R83 = R63 ^ HEAP[sbox | R7C]; | |
15200 | R84 = R64 ^ R80; | |
15201 | R85 = R65 ^ R81; | |
15202 | R86 = R66 ^ R82; | |
15203 | R87 = R67 ^ R83; | |
15204 | R88 = R68 ^ R84; | |
15205 | R89 = R69 ^ R85; | |
15206 | R8A = R6A ^ R86; | |
15207 | R8B = R6B ^ R87; | |
15208 | R8C = R6C ^ R88; | |
15209 | R8D = R6D ^ R89; | |
15210 | R8E = R6E ^ R8A; | |
15211 | R8F = R6F ^ R8B; | |
15212 | R90 = R70 ^ HEAP[sbox | R8C]; | |
15213 | R91 = R71 ^ HEAP[sbox | R8D]; | |
15214 | R92 = R72 ^ HEAP[sbox | R8E]; | |
15215 | R93 = R73 ^ HEAP[sbox | R8F]; | |
15216 | R94 = R74 ^ R90; | |
15217 | R95 = R75 ^ R91; | |
15218 | R96 = R76 ^ R92; | |
15219 | R97 = R77 ^ R93; | |
15220 | R98 = R78 ^ R94; | |
15221 | R99 = R79 ^ R95; | |
15222 | R9A = R7A ^ R96; | |
15223 | R9B = R7B ^ R97; | |
15224 | R9C = R7C ^ R98; | |
15225 | R9D = R7D ^ R99; | |
15226 | R9E = R7E ^ R9A; | |
15227 | R9F = R7F ^ R9B; | |
15228 | RA0 = R80 ^ HEAP[sbox | R9D] ^ 16; | |
15229 | RA1 = R81 ^ HEAP[sbox | R9E]; | |
15230 | RA2 = R82 ^ HEAP[sbox | R9F]; | |
15231 | RA3 = R83 ^ HEAP[sbox | R9C]; | |
15232 | RA4 = R84 ^ RA0; | |
15233 | RA5 = R85 ^ RA1; | |
15234 | RA6 = R86 ^ RA2; | |
15235 | RA7 = R87 ^ RA3; | |
15236 | RA8 = R88 ^ RA4; | |
15237 | RA9 = R89 ^ RA5; | |
15238 | RAA = R8A ^ RA6; | |
15239 | RAB = R8B ^ RA7; | |
15240 | RAC = R8C ^ RA8; | |
15241 | RAD = R8D ^ RA9; | |
15242 | RAE = R8E ^ RAA; | |
15243 | RAF = R8F ^ RAB; | |
15244 | RB0 = R90 ^ HEAP[sbox | RAC]; | |
15245 | RB1 = R91 ^ HEAP[sbox | RAD]; | |
15246 | RB2 = R92 ^ HEAP[sbox | RAE]; | |
15247 | RB3 = R93 ^ HEAP[sbox | RAF]; | |
15248 | RB4 = R94 ^ RB0; | |
15249 | RB5 = R95 ^ RB1; | |
15250 | RB6 = R96 ^ RB2; | |
15251 | RB7 = R97 ^ RB3; | |
15252 | RB8 = R98 ^ RB4; | |
15253 | RB9 = R99 ^ RB5; | |
15254 | RBA = R9A ^ RB6; | |
15255 | RBB = R9B ^ RB7; | |
15256 | RBC = R9C ^ RB8; | |
15257 | RBD = R9D ^ RB9; | |
15258 | RBE = R9E ^ RBA; | |
15259 | RBF = R9F ^ RBB; | |
15260 | RC0 = RA0 ^ HEAP[sbox | RBD] ^ 32; | |
15261 | RC1 = RA1 ^ HEAP[sbox | RBE]; | |
15262 | RC2 = RA2 ^ HEAP[sbox | RBF]; | |
15263 | RC3 = RA3 ^ HEAP[sbox | RBC]; | |
15264 | RC4 = RA4 ^ RC0; | |
15265 | RC5 = RA5 ^ RC1; | |
15266 | RC6 = RA6 ^ RC2; | |
15267 | RC7 = RA7 ^ RC3; | |
15268 | RC8 = RA8 ^ RC4; | |
15269 | RC9 = RA9 ^ RC5; | |
15270 | RCA = RAA ^ RC6; | |
15271 | RCB = RAB ^ RC7; | |
15272 | RCC = RAC ^ RC8; | |
15273 | RCD = RAD ^ RC9; | |
15274 | RCE = RAE ^ RCA; | |
15275 | RCF = RAF ^ RCB; | |
15276 | RD0 = RB0 ^ HEAP[sbox | RCC]; | |
15277 | RD1 = RB1 ^ HEAP[sbox | RCD]; | |
15278 | RD2 = RB2 ^ HEAP[sbox | RCE]; | |
15279 | RD3 = RB3 ^ HEAP[sbox | RCF]; | |
15280 | RD4 = RB4 ^ RD0; | |
15281 | RD5 = RB5 ^ RD1; | |
15282 | RD6 = RB6 ^ RD2; | |
15283 | RD7 = RB7 ^ RD3; | |
15284 | RD8 = RB8 ^ RD4; | |
15285 | RD9 = RB9 ^ RD5; | |
15286 | RDA = RBA ^ RD6; | |
15287 | RDB = RBB ^ RD7; | |
15288 | RDC = RBC ^ RD8; | |
15289 | RDD = RBD ^ RD9; | |
15290 | RDE = RBE ^ RDA; | |
15291 | RDF = RBF ^ RDB; | |
15292 | RE0 = RC0 ^ HEAP[sbox | RDD] ^ 64; | |
15293 | RE1 = RC1 ^ HEAP[sbox | RDE]; | |
15294 | RE2 = RC2 ^ HEAP[sbox | RDF]; | |
15295 | RE3 = RC3 ^ HEAP[sbox | RDC]; | |
15296 | RE4 = RC4 ^ RE0; | |
15297 | RE5 = RC5 ^ RE1; | |
15298 | RE6 = RC6 ^ RE2; | |
15299 | RE7 = RC7 ^ RE3; | |
15300 | RE8 = RC8 ^ RE4; | |
15301 | RE9 = RC9 ^ RE5; | |
15302 | REA = RCA ^ RE6; | |
15303 | REB = RCB ^ RE7; | |
15304 | REC = RCC ^ RE8; | |
15305 | RED = RCD ^ RE9; | |
15306 | REE = RCE ^ REA; | |
15307 | REF = RCF ^ REB; | |
15308 | } | |
15309 | function _encrypt(s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF) { | |
15310 | s0 = s0 | 0; | |
15311 | s1 = s1 | 0; | |
15312 | s2 = s2 | 0; | |
15313 | s3 = s3 | 0; | |
15314 | s4 = s4 | 0; | |
15315 | s5 = s5 | 0; | |
15316 | s6 = s6 | 0; | |
15317 | s7 = s7 | 0; | |
15318 | s8 = s8 | 0; | |
15319 | s9 = s9 | 0; | |
15320 | sA = sA | 0; | |
15321 | sB = sB | 0; | |
15322 | sC = sC | 0; | |
15323 | sD = sD | 0; | |
15324 | sE = sE | 0; | |
15325 | sF = sF | 0; | |
15326 | 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; | |
15327 | s0 = s0 ^ R00; | |
15328 | s1 = s1 ^ R01; | |
15329 | s2 = s2 ^ R02; | |
15330 | s3 = s3 ^ R03; | |
15331 | s4 = s4 ^ R04; | |
15332 | s5 = s5 ^ R05; | |
15333 | s6 = s6 ^ R06; | |
15334 | s7 = s7 ^ R07; | |
15335 | s8 = s8 ^ R08; | |
15336 | s9 = s9 ^ R09; | |
15337 | sA = sA ^ R0A; | |
15338 | sB = sB ^ R0B; | |
15339 | sC = sC ^ R0C; | |
15340 | sD = sD ^ R0D; | |
15341 | sE = sE ^ R0E; | |
15342 | sF = sF ^ R0F; | |
15343 | t0 = HEAP[x2_sbox | s0] ^ HEAP[x3_sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[sbox | sF] ^ R10; | |
15344 | t1 = HEAP[sbox | s0] ^ HEAP[x2_sbox | s5] ^ HEAP[x3_sbox | sA] ^ HEAP[sbox | sF] ^ R11; | |
15345 | t2 = HEAP[sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[x2_sbox | sA] ^ HEAP[x3_sbox | sF] ^ R12; | |
15346 | t3 = HEAP[x3_sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[x2_sbox | sF] ^ R13; | |
15347 | t4 = HEAP[x2_sbox | s4] ^ HEAP[x3_sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[sbox | s3] ^ R14; | |
15348 | t5 = HEAP[sbox | s4] ^ HEAP[x2_sbox | s9] ^ HEAP[x3_sbox | sE] ^ HEAP[sbox | s3] ^ R15; | |
15349 | t6 = HEAP[sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[x2_sbox | sE] ^ HEAP[x3_sbox | s3] ^ R16; | |
15350 | t7 = HEAP[x3_sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[x2_sbox | s3] ^ R17; | |
15351 | t8 = HEAP[x2_sbox | s8] ^ HEAP[x3_sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[sbox | s7] ^ R18; | |
15352 | t9 = HEAP[sbox | s8] ^ HEAP[x2_sbox | sD] ^ HEAP[x3_sbox | s2] ^ HEAP[sbox | s7] ^ R19; | |
15353 | tA = HEAP[sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[x2_sbox | s2] ^ HEAP[x3_sbox | s7] ^ R1A; | |
15354 | tB = HEAP[x3_sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[x2_sbox | s7] ^ R1B; | |
15355 | tC = HEAP[x2_sbox | sC] ^ HEAP[x3_sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[sbox | sB] ^ R1C; | |
15356 | tD = HEAP[sbox | sC] ^ HEAP[x2_sbox | s1] ^ HEAP[x3_sbox | s6] ^ HEAP[sbox | sB] ^ R1D; | |
15357 | tE = HEAP[sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[x2_sbox | s6] ^ HEAP[x3_sbox | sB] ^ R1E; | |
15358 | tF = HEAP[x3_sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[x2_sbox | sB] ^ R1F; | |
15359 | s0 = HEAP[x2_sbox | t0] ^ HEAP[x3_sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[sbox | tF] ^ R20; | |
15360 | s1 = HEAP[sbox | t0] ^ HEAP[x2_sbox | t5] ^ HEAP[x3_sbox | tA] ^ HEAP[sbox | tF] ^ R21; | |
15361 | s2 = HEAP[sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[x2_sbox | tA] ^ HEAP[x3_sbox | tF] ^ R22; | |
15362 | s3 = HEAP[x3_sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[x2_sbox | tF] ^ R23; | |
15363 | s4 = HEAP[x2_sbox | t4] ^ HEAP[x3_sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[sbox | t3] ^ R24; | |
15364 | s5 = HEAP[sbox | t4] ^ HEAP[x2_sbox | t9] ^ HEAP[x3_sbox | tE] ^ HEAP[sbox | t3] ^ R25; | |
15365 | s6 = HEAP[sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[x2_sbox | tE] ^ HEAP[x3_sbox | t3] ^ R26; | |
15366 | s7 = HEAP[x3_sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[x2_sbox | t3] ^ R27; | |
15367 | s8 = HEAP[x2_sbox | t8] ^ HEAP[x3_sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[sbox | t7] ^ R28; | |
15368 | s9 = HEAP[sbox | t8] ^ HEAP[x2_sbox | tD] ^ HEAP[x3_sbox | t2] ^ HEAP[sbox | t7] ^ R29; | |
15369 | sA = HEAP[sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[x2_sbox | t2] ^ HEAP[x3_sbox | t7] ^ R2A; | |
15370 | sB = HEAP[x3_sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[x2_sbox | t7] ^ R2B; | |
15371 | sC = HEAP[x2_sbox | tC] ^ HEAP[x3_sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[sbox | tB] ^ R2C; | |
15372 | sD = HEAP[sbox | tC] ^ HEAP[x2_sbox | t1] ^ HEAP[x3_sbox | t6] ^ HEAP[sbox | tB] ^ R2D; | |
15373 | sE = HEAP[sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[x2_sbox | t6] ^ HEAP[x3_sbox | tB] ^ R2E; | |
15374 | sF = HEAP[x3_sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[x2_sbox | tB] ^ R2F; | |
15375 | t0 = HEAP[x2_sbox | s0] ^ HEAP[x3_sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[sbox | sF] ^ R30; | |
15376 | t1 = HEAP[sbox | s0] ^ HEAP[x2_sbox | s5] ^ HEAP[x3_sbox | sA] ^ HEAP[sbox | sF] ^ R31; | |
15377 | t2 = HEAP[sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[x2_sbox | sA] ^ HEAP[x3_sbox | sF] ^ R32; | |
15378 | t3 = HEAP[x3_sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[x2_sbox | sF] ^ R33; | |
15379 | t4 = HEAP[x2_sbox | s4] ^ HEAP[x3_sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[sbox | s3] ^ R34; | |
15380 | t5 = HEAP[sbox | s4] ^ HEAP[x2_sbox | s9] ^ HEAP[x3_sbox | sE] ^ HEAP[sbox | s3] ^ R35; | |
15381 | t6 = HEAP[sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[x2_sbox | sE] ^ HEAP[x3_sbox | s3] ^ R36; | |
15382 | t7 = HEAP[x3_sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[x2_sbox | s3] ^ R37; | |
15383 | t8 = HEAP[x2_sbox | s8] ^ HEAP[x3_sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[sbox | s7] ^ R38; | |
15384 | t9 = HEAP[sbox | s8] ^ HEAP[x2_sbox | sD] ^ HEAP[x3_sbox | s2] ^ HEAP[sbox | s7] ^ R39; | |
15385 | tA = HEAP[sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[x2_sbox | s2] ^ HEAP[x3_sbox | s7] ^ R3A; | |
15386 | tB = HEAP[x3_sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[x2_sbox | s7] ^ R3B; | |
15387 | tC = HEAP[x2_sbox | sC] ^ HEAP[x3_sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[sbox | sB] ^ R3C; | |
15388 | tD = HEAP[sbox | sC] ^ HEAP[x2_sbox | s1] ^ HEAP[x3_sbox | s6] ^ HEAP[sbox | sB] ^ R3D; | |
15389 | tE = HEAP[sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[x2_sbox | s6] ^ HEAP[x3_sbox | sB] ^ R3E; | |
15390 | tF = HEAP[x3_sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[x2_sbox | sB] ^ R3F; | |
15391 | s0 = HEAP[x2_sbox | t0] ^ HEAP[x3_sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[sbox | tF] ^ R40; | |
15392 | s1 = HEAP[sbox | t0] ^ HEAP[x2_sbox | t5] ^ HEAP[x3_sbox | tA] ^ HEAP[sbox | tF] ^ R41; | |
15393 | s2 = HEAP[sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[x2_sbox | tA] ^ HEAP[x3_sbox | tF] ^ R42; | |
15394 | s3 = HEAP[x3_sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[x2_sbox | tF] ^ R43; | |
15395 | s4 = HEAP[x2_sbox | t4] ^ HEAP[x3_sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[sbox | t3] ^ R44; | |
15396 | s5 = HEAP[sbox | t4] ^ HEAP[x2_sbox | t9] ^ HEAP[x3_sbox | tE] ^ HEAP[sbox | t3] ^ R45; | |
15397 | s6 = HEAP[sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[x2_sbox | tE] ^ HEAP[x3_sbox | t3] ^ R46; | |
15398 | s7 = HEAP[x3_sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[x2_sbox | t3] ^ R47; | |
15399 | s8 = HEAP[x2_sbox | t8] ^ HEAP[x3_sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[sbox | t7] ^ R48; | |
15400 | s9 = HEAP[sbox | t8] ^ HEAP[x2_sbox | tD] ^ HEAP[x3_sbox | t2] ^ HEAP[sbox | t7] ^ R49; | |
15401 | sA = HEAP[sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[x2_sbox | t2] ^ HEAP[x3_sbox | t7] ^ R4A; | |
15402 | sB = HEAP[x3_sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[x2_sbox | t7] ^ R4B; | |
15403 | sC = HEAP[x2_sbox | tC] ^ HEAP[x3_sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[sbox | tB] ^ R4C; | |
15404 | sD = HEAP[sbox | tC] ^ HEAP[x2_sbox | t1] ^ HEAP[x3_sbox | t6] ^ HEAP[sbox | tB] ^ R4D; | |
15405 | sE = HEAP[sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[x2_sbox | t6] ^ HEAP[x3_sbox | tB] ^ R4E; | |
15406 | sF = HEAP[x3_sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[x2_sbox | tB] ^ R4F; | |
15407 | t0 = HEAP[x2_sbox | s0] ^ HEAP[x3_sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[sbox | sF] ^ R50; | |
15408 | t1 = HEAP[sbox | s0] ^ HEAP[x2_sbox | s5] ^ HEAP[x3_sbox | sA] ^ HEAP[sbox | sF] ^ R51; | |
15409 | t2 = HEAP[sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[x2_sbox | sA] ^ HEAP[x3_sbox | sF] ^ R52; | |
15410 | t3 = HEAP[x3_sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[x2_sbox | sF] ^ R53; | |
15411 | t4 = HEAP[x2_sbox | s4] ^ HEAP[x3_sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[sbox | s3] ^ R54; | |
15412 | t5 = HEAP[sbox | s4] ^ HEAP[x2_sbox | s9] ^ HEAP[x3_sbox | sE] ^ HEAP[sbox | s3] ^ R55; | |
15413 | t6 = HEAP[sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[x2_sbox | sE] ^ HEAP[x3_sbox | s3] ^ R56; | |
15414 | t7 = HEAP[x3_sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[x2_sbox | s3] ^ R57; | |
15415 | t8 = HEAP[x2_sbox | s8] ^ HEAP[x3_sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[sbox | s7] ^ R58; | |
15416 | t9 = HEAP[sbox | s8] ^ HEAP[x2_sbox | sD] ^ HEAP[x3_sbox | s2] ^ HEAP[sbox | s7] ^ R59; | |
15417 | tA = HEAP[sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[x2_sbox | s2] ^ HEAP[x3_sbox | s7] ^ R5A; | |
15418 | tB = HEAP[x3_sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[x2_sbox | s7] ^ R5B; | |
15419 | tC = HEAP[x2_sbox | sC] ^ HEAP[x3_sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[sbox | sB] ^ R5C; | |
15420 | tD = HEAP[sbox | sC] ^ HEAP[x2_sbox | s1] ^ HEAP[x3_sbox | s6] ^ HEAP[sbox | sB] ^ R5D; | |
15421 | tE = HEAP[sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[x2_sbox | s6] ^ HEAP[x3_sbox | sB] ^ R5E; | |
15422 | tF = HEAP[x3_sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[x2_sbox | sB] ^ R5F; | |
15423 | s0 = HEAP[x2_sbox | t0] ^ HEAP[x3_sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[sbox | tF] ^ R60; | |
15424 | s1 = HEAP[sbox | t0] ^ HEAP[x2_sbox | t5] ^ HEAP[x3_sbox | tA] ^ HEAP[sbox | tF] ^ R61; | |
15425 | s2 = HEAP[sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[x2_sbox | tA] ^ HEAP[x3_sbox | tF] ^ R62; | |
15426 | s3 = HEAP[x3_sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[x2_sbox | tF] ^ R63; | |
15427 | s4 = HEAP[x2_sbox | t4] ^ HEAP[x3_sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[sbox | t3] ^ R64; | |
15428 | s5 = HEAP[sbox | t4] ^ HEAP[x2_sbox | t9] ^ HEAP[x3_sbox | tE] ^ HEAP[sbox | t3] ^ R65; | |
15429 | s6 = HEAP[sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[x2_sbox | tE] ^ HEAP[x3_sbox | t3] ^ R66; | |
15430 | s7 = HEAP[x3_sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[x2_sbox | t3] ^ R67; | |
15431 | s8 = HEAP[x2_sbox | t8] ^ HEAP[x3_sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[sbox | t7] ^ R68; | |
15432 | s9 = HEAP[sbox | t8] ^ HEAP[x2_sbox | tD] ^ HEAP[x3_sbox | t2] ^ HEAP[sbox | t7] ^ R69; | |
15433 | sA = HEAP[sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[x2_sbox | t2] ^ HEAP[x3_sbox | t7] ^ R6A; | |
15434 | sB = HEAP[x3_sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[x2_sbox | t7] ^ R6B; | |
15435 | sC = HEAP[x2_sbox | tC] ^ HEAP[x3_sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[sbox | tB] ^ R6C; | |
15436 | sD = HEAP[sbox | tC] ^ HEAP[x2_sbox | t1] ^ HEAP[x3_sbox | t6] ^ HEAP[sbox | tB] ^ R6D; | |
15437 | sE = HEAP[sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[x2_sbox | t6] ^ HEAP[x3_sbox | tB] ^ R6E; | |
15438 | sF = HEAP[x3_sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[x2_sbox | tB] ^ R6F; | |
15439 | t0 = HEAP[x2_sbox | s0] ^ HEAP[x3_sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[sbox | sF] ^ R70; | |
15440 | t1 = HEAP[sbox | s0] ^ HEAP[x2_sbox | s5] ^ HEAP[x3_sbox | sA] ^ HEAP[sbox | sF] ^ R71; | |
15441 | t2 = HEAP[sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[x2_sbox | sA] ^ HEAP[x3_sbox | sF] ^ R72; | |
15442 | t3 = HEAP[x3_sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[x2_sbox | sF] ^ R73; | |
15443 | t4 = HEAP[x2_sbox | s4] ^ HEAP[x3_sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[sbox | s3] ^ R74; | |
15444 | t5 = HEAP[sbox | s4] ^ HEAP[x2_sbox | s9] ^ HEAP[x3_sbox | sE] ^ HEAP[sbox | s3] ^ R75; | |
15445 | t6 = HEAP[sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[x2_sbox | sE] ^ HEAP[x3_sbox | s3] ^ R76; | |
15446 | t7 = HEAP[x3_sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[x2_sbox | s3] ^ R77; | |
15447 | t8 = HEAP[x2_sbox | s8] ^ HEAP[x3_sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[sbox | s7] ^ R78; | |
15448 | t9 = HEAP[sbox | s8] ^ HEAP[x2_sbox | sD] ^ HEAP[x3_sbox | s2] ^ HEAP[sbox | s7] ^ R79; | |
15449 | tA = HEAP[sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[x2_sbox | s2] ^ HEAP[x3_sbox | s7] ^ R7A; | |
15450 | tB = HEAP[x3_sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[x2_sbox | s7] ^ R7B; | |
15451 | tC = HEAP[x2_sbox | sC] ^ HEAP[x3_sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[sbox | sB] ^ R7C; | |
15452 | tD = HEAP[sbox | sC] ^ HEAP[x2_sbox | s1] ^ HEAP[x3_sbox | s6] ^ HEAP[sbox | sB] ^ R7D; | |
15453 | tE = HEAP[sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[x2_sbox | s6] ^ HEAP[x3_sbox | sB] ^ R7E; | |
15454 | tF = HEAP[x3_sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[x2_sbox | sB] ^ R7F; | |
15455 | s0 = HEAP[x2_sbox | t0] ^ HEAP[x3_sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[sbox | tF] ^ R80; | |
15456 | s1 = HEAP[sbox | t0] ^ HEAP[x2_sbox | t5] ^ HEAP[x3_sbox | tA] ^ HEAP[sbox | tF] ^ R81; | |
15457 | s2 = HEAP[sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[x2_sbox | tA] ^ HEAP[x3_sbox | tF] ^ R82; | |
15458 | s3 = HEAP[x3_sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[x2_sbox | tF] ^ R83; | |
15459 | s4 = HEAP[x2_sbox | t4] ^ HEAP[x3_sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[sbox | t3] ^ R84; | |
15460 | s5 = HEAP[sbox | t4] ^ HEAP[x2_sbox | t9] ^ HEAP[x3_sbox | tE] ^ HEAP[sbox | t3] ^ R85; | |
15461 | s6 = HEAP[sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[x2_sbox | tE] ^ HEAP[x3_sbox | t3] ^ R86; | |
15462 | s7 = HEAP[x3_sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[x2_sbox | t3] ^ R87; | |
15463 | s8 = HEAP[x2_sbox | t8] ^ HEAP[x3_sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[sbox | t7] ^ R88; | |
15464 | s9 = HEAP[sbox | t8] ^ HEAP[x2_sbox | tD] ^ HEAP[x3_sbox | t2] ^ HEAP[sbox | t7] ^ R89; | |
15465 | sA = HEAP[sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[x2_sbox | t2] ^ HEAP[x3_sbox | t7] ^ R8A; | |
15466 | sB = HEAP[x3_sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[x2_sbox | t7] ^ R8B; | |
15467 | sC = HEAP[x2_sbox | tC] ^ HEAP[x3_sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[sbox | tB] ^ R8C; | |
15468 | sD = HEAP[sbox | tC] ^ HEAP[x2_sbox | t1] ^ HEAP[x3_sbox | t6] ^ HEAP[sbox | tB] ^ R8D; | |
15469 | sE = HEAP[sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[x2_sbox | t6] ^ HEAP[x3_sbox | tB] ^ R8E; | |
15470 | sF = HEAP[x3_sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[x2_sbox | tB] ^ R8F; | |
15471 | t0 = HEAP[x2_sbox | s0] ^ HEAP[x3_sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[sbox | sF] ^ R90; | |
15472 | t1 = HEAP[sbox | s0] ^ HEAP[x2_sbox | s5] ^ HEAP[x3_sbox | sA] ^ HEAP[sbox | sF] ^ R91; | |
15473 | t2 = HEAP[sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[x2_sbox | sA] ^ HEAP[x3_sbox | sF] ^ R92; | |
15474 | t3 = HEAP[x3_sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[x2_sbox | sF] ^ R93; | |
15475 | t4 = HEAP[x2_sbox | s4] ^ HEAP[x3_sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[sbox | s3] ^ R94; | |
15476 | t5 = HEAP[sbox | s4] ^ HEAP[x2_sbox | s9] ^ HEAP[x3_sbox | sE] ^ HEAP[sbox | s3] ^ R95; | |
15477 | t6 = HEAP[sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[x2_sbox | sE] ^ HEAP[x3_sbox | s3] ^ R96; | |
15478 | t7 = HEAP[x3_sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[x2_sbox | s3] ^ R97; | |
15479 | t8 = HEAP[x2_sbox | s8] ^ HEAP[x3_sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[sbox | s7] ^ R98; | |
15480 | t9 = HEAP[sbox | s8] ^ HEAP[x2_sbox | sD] ^ HEAP[x3_sbox | s2] ^ HEAP[sbox | s7] ^ R99; | |
15481 | tA = HEAP[sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[x2_sbox | s2] ^ HEAP[x3_sbox | s7] ^ R9A; | |
15482 | tB = HEAP[x3_sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[x2_sbox | s7] ^ R9B; | |
15483 | tC = HEAP[x2_sbox | sC] ^ HEAP[x3_sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[sbox | sB] ^ R9C; | |
15484 | tD = HEAP[sbox | sC] ^ HEAP[x2_sbox | s1] ^ HEAP[x3_sbox | s6] ^ HEAP[sbox | sB] ^ R9D; | |
15485 | tE = HEAP[sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[x2_sbox | s6] ^ HEAP[x3_sbox | sB] ^ R9E; | |
15486 | tF = HEAP[x3_sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[x2_sbox | sB] ^ R9F; | |
15487 | if ((keySize | 0) == 16) { | |
15488 | S0 = HEAP[sbox | t0] ^ RA0; | |
15489 | S1 = HEAP[sbox | t5] ^ RA1; | |
15490 | S2 = HEAP[sbox | tA] ^ RA2; | |
15491 | S3 = HEAP[sbox | tF] ^ RA3; | |
15492 | S4 = HEAP[sbox | t4] ^ RA4; | |
15493 | S5 = HEAP[sbox | t9] ^ RA5; | |
15494 | S6 = HEAP[sbox | tE] ^ RA6; | |
15495 | S7 = HEAP[sbox | t3] ^ RA7; | |
15496 | S8 = HEAP[sbox | t8] ^ RA8; | |
15497 | S9 = HEAP[sbox | tD] ^ RA9; | |
15498 | SA = HEAP[sbox | t2] ^ RAA; | |
15499 | SB = HEAP[sbox | t7] ^ RAB; | |
15500 | SC = HEAP[sbox | tC] ^ RAC; | |
15501 | SD = HEAP[sbox | t1] ^ RAD; | |
15502 | SE = HEAP[sbox | t6] ^ RAE; | |
15503 | SF = HEAP[sbox | tB] ^ RAF; | |
15504 | return; | |
15505 | } | |
15506 | s0 = HEAP[x2_sbox | t0] ^ HEAP[x3_sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[sbox | tF] ^ RA0; | |
15507 | s1 = HEAP[sbox | t0] ^ HEAP[x2_sbox | t5] ^ HEAP[x3_sbox | tA] ^ HEAP[sbox | tF] ^ RA1; | |
15508 | s2 = HEAP[sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[x2_sbox | tA] ^ HEAP[x3_sbox | tF] ^ RA2; | |
15509 | s3 = HEAP[x3_sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[x2_sbox | tF] ^ RA3; | |
15510 | s4 = HEAP[x2_sbox | t4] ^ HEAP[x3_sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[sbox | t3] ^ RA4; | |
15511 | s5 = HEAP[sbox | t4] ^ HEAP[x2_sbox | t9] ^ HEAP[x3_sbox | tE] ^ HEAP[sbox | t3] ^ RA5; | |
15512 | s6 = HEAP[sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[x2_sbox | tE] ^ HEAP[x3_sbox | t3] ^ RA6; | |
15513 | s7 = HEAP[x3_sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[x2_sbox | t3] ^ RA7; | |
15514 | s8 = HEAP[x2_sbox | t8] ^ HEAP[x3_sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[sbox | t7] ^ RA8; | |
15515 | s9 = HEAP[sbox | t8] ^ HEAP[x2_sbox | tD] ^ HEAP[x3_sbox | t2] ^ HEAP[sbox | t7] ^ RA9; | |
15516 | sA = HEAP[sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[x2_sbox | t2] ^ HEAP[x3_sbox | t7] ^ RAA; | |
15517 | sB = HEAP[x3_sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[x2_sbox | t7] ^ RAB; | |
15518 | sC = HEAP[x2_sbox | tC] ^ HEAP[x3_sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[sbox | tB] ^ RAC; | |
15519 | sD = HEAP[sbox | tC] ^ HEAP[x2_sbox | t1] ^ HEAP[x3_sbox | t6] ^ HEAP[sbox | tB] ^ RAD; | |
15520 | sE = HEAP[sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[x2_sbox | t6] ^ HEAP[x3_sbox | tB] ^ RAE; | |
15521 | sF = HEAP[x3_sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[x2_sbox | tB] ^ RAF; | |
15522 | t0 = HEAP[x2_sbox | s0] ^ HEAP[x3_sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[sbox | sF] ^ RB0; | |
15523 | t1 = HEAP[sbox | s0] ^ HEAP[x2_sbox | s5] ^ HEAP[x3_sbox | sA] ^ HEAP[sbox | sF] ^ RB1; | |
15524 | t2 = HEAP[sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[x2_sbox | sA] ^ HEAP[x3_sbox | sF] ^ RB2; | |
15525 | t3 = HEAP[x3_sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[x2_sbox | sF] ^ RB3; | |
15526 | t4 = HEAP[x2_sbox | s4] ^ HEAP[x3_sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[sbox | s3] ^ RB4; | |
15527 | t5 = HEAP[sbox | s4] ^ HEAP[x2_sbox | s9] ^ HEAP[x3_sbox | sE] ^ HEAP[sbox | s3] ^ RB5; | |
15528 | t6 = HEAP[sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[x2_sbox | sE] ^ HEAP[x3_sbox | s3] ^ RB6; | |
15529 | t7 = HEAP[x3_sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[x2_sbox | s3] ^ RB7; | |
15530 | t8 = HEAP[x2_sbox | s8] ^ HEAP[x3_sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[sbox | s7] ^ RB8; | |
15531 | t9 = HEAP[sbox | s8] ^ HEAP[x2_sbox | sD] ^ HEAP[x3_sbox | s2] ^ HEAP[sbox | s7] ^ RB9; | |
15532 | tA = HEAP[sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[x2_sbox | s2] ^ HEAP[x3_sbox | s7] ^ RBA; | |
15533 | tB = HEAP[x3_sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[x2_sbox | s7] ^ RBB; | |
15534 | tC = HEAP[x2_sbox | sC] ^ HEAP[x3_sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[sbox | sB] ^ RBC; | |
15535 | tD = HEAP[sbox | sC] ^ HEAP[x2_sbox | s1] ^ HEAP[x3_sbox | s6] ^ HEAP[sbox | sB] ^ RBD; | |
15536 | tE = HEAP[sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[x2_sbox | s6] ^ HEAP[x3_sbox | sB] ^ RBE; | |
15537 | tF = HEAP[x3_sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[x2_sbox | sB] ^ RBF; | |
15538 | s0 = HEAP[x2_sbox | t0] ^ HEAP[x3_sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[sbox | tF] ^ RC0; | |
15539 | s1 = HEAP[sbox | t0] ^ HEAP[x2_sbox | t5] ^ HEAP[x3_sbox | tA] ^ HEAP[sbox | tF] ^ RC1; | |
15540 | s2 = HEAP[sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[x2_sbox | tA] ^ HEAP[x3_sbox | tF] ^ RC2; | |
15541 | s3 = HEAP[x3_sbox | t0] ^ HEAP[sbox | t5] ^ HEAP[sbox | tA] ^ HEAP[x2_sbox | tF] ^ RC3; | |
15542 | s4 = HEAP[x2_sbox | t4] ^ HEAP[x3_sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[sbox | t3] ^ RC4; | |
15543 | s5 = HEAP[sbox | t4] ^ HEAP[x2_sbox | t9] ^ HEAP[x3_sbox | tE] ^ HEAP[sbox | t3] ^ RC5; | |
15544 | s6 = HEAP[sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[x2_sbox | tE] ^ HEAP[x3_sbox | t3] ^ RC6; | |
15545 | s7 = HEAP[x3_sbox | t4] ^ HEAP[sbox | t9] ^ HEAP[sbox | tE] ^ HEAP[x2_sbox | t3] ^ RC7; | |
15546 | s8 = HEAP[x2_sbox | t8] ^ HEAP[x3_sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[sbox | t7] ^ RC8; | |
15547 | s9 = HEAP[sbox | t8] ^ HEAP[x2_sbox | tD] ^ HEAP[x3_sbox | t2] ^ HEAP[sbox | t7] ^ RC9; | |
15548 | sA = HEAP[sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[x2_sbox | t2] ^ HEAP[x3_sbox | t7] ^ RCA; | |
15549 | sB = HEAP[x3_sbox | t8] ^ HEAP[sbox | tD] ^ HEAP[sbox | t2] ^ HEAP[x2_sbox | t7] ^ RCB; | |
15550 | sC = HEAP[x2_sbox | tC] ^ HEAP[x3_sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[sbox | tB] ^ RCC; | |
15551 | sD = HEAP[sbox | tC] ^ HEAP[x2_sbox | t1] ^ HEAP[x3_sbox | t6] ^ HEAP[sbox | tB] ^ RCD; | |
15552 | sE = HEAP[sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[x2_sbox | t6] ^ HEAP[x3_sbox | tB] ^ RCE; | |
15553 | sF = HEAP[x3_sbox | tC] ^ HEAP[sbox | t1] ^ HEAP[sbox | t6] ^ HEAP[x2_sbox | tB] ^ RCF; | |
15554 | t0 = HEAP[x2_sbox | s0] ^ HEAP[x3_sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[sbox | sF] ^ RD0; | |
15555 | t1 = HEAP[sbox | s0] ^ HEAP[x2_sbox | s5] ^ HEAP[x3_sbox | sA] ^ HEAP[sbox | sF] ^ RD1; | |
15556 | t2 = HEAP[sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[x2_sbox | sA] ^ HEAP[x3_sbox | sF] ^ RD2; | |
15557 | t3 = HEAP[x3_sbox | s0] ^ HEAP[sbox | s5] ^ HEAP[sbox | sA] ^ HEAP[x2_sbox | sF] ^ RD3; | |
15558 | t4 = HEAP[x2_sbox | s4] ^ HEAP[x3_sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[sbox | s3] ^ RD4; | |
15559 | t5 = HEAP[sbox | s4] ^ HEAP[x2_sbox | s9] ^ HEAP[x3_sbox | sE] ^ HEAP[sbox | s3] ^ RD5; | |
15560 | t6 = HEAP[sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[x2_sbox | sE] ^ HEAP[x3_sbox | s3] ^ RD6; | |
15561 | t7 = HEAP[x3_sbox | s4] ^ HEAP[sbox | s9] ^ HEAP[sbox | sE] ^ HEAP[x2_sbox | s3] ^ RD7; | |
15562 | t8 = HEAP[x2_sbox | s8] ^ HEAP[x3_sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[sbox | s7] ^ RD8; | |
15563 | t9 = HEAP[sbox | s8] ^ HEAP[x2_sbox | sD] ^ HEAP[x3_sbox | s2] ^ HEAP[sbox | s7] ^ RD9; | |
15564 | tA = HEAP[sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[x2_sbox | s2] ^ HEAP[x3_sbox | s7] ^ RDA; | |
15565 | tB = HEAP[x3_sbox | s8] ^ HEAP[sbox | sD] ^ HEAP[sbox | s2] ^ HEAP[x2_sbox | s7] ^ RDB; | |
15566 | tC = HEAP[x2_sbox | sC] ^ HEAP[x3_sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[sbox | sB] ^ RDC; | |
15567 | tD = HEAP[sbox | sC] ^ HEAP[x2_sbox | s1] ^ HEAP[x3_sbox | s6] ^ HEAP[sbox | sB] ^ RDD; | |
15568 | tE = HEAP[sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[x2_sbox | s6] ^ HEAP[x3_sbox | sB] ^ RDE; | |
15569 | tF = HEAP[x3_sbox | sC] ^ HEAP[sbox | s1] ^ HEAP[sbox | s6] ^ HEAP[x2_sbox | sB] ^ RDF; | |
15570 | S0 = HEAP[sbox | t0] ^ RE0; | |
15571 | S1 = HEAP[sbox | t5] ^ RE1; | |
15572 | S2 = HEAP[sbox | tA] ^ RE2; | |
15573 | S3 = HEAP[sbox | tF] ^ RE3; | |
15574 | S4 = HEAP[sbox | t4] ^ RE4; | |
15575 | S5 = HEAP[sbox | t9] ^ RE5; | |
15576 | S6 = HEAP[sbox | tE] ^ RE6; | |
15577 | S7 = HEAP[sbox | t3] ^ RE7; | |
15578 | S8 = HEAP[sbox | t8] ^ RE8; | |
15579 | S9 = HEAP[sbox | tD] ^ RE9; | |
15580 | SA = HEAP[sbox | t2] ^ REA; | |
15581 | SB = HEAP[sbox | t7] ^ REB; | |
15582 | SC = HEAP[sbox | tC] ^ REC; | |
15583 | SD = HEAP[sbox | t1] ^ RED; | |
15584 | SE = HEAP[sbox | t6] ^ REE; | |
15585 | SF = HEAP[sbox | tB] ^ REF; | |
15586 | } | |
15587 | function _decrypt(s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF) { | |
15588 | s0 = s0 | 0; | |
15589 | s1 = s1 | 0; | |
15590 | s2 = s2 | 0; | |
15591 | s3 = s3 | 0; | |
15592 | s4 = s4 | 0; | |
15593 | s5 = s5 | 0; | |
15594 | s6 = s6 | 0; | |
15595 | s7 = s7 | 0; | |
15596 | s8 = s8 | 0; | |
15597 | s9 = s9 | 0; | |
15598 | sA = sA | 0; | |
15599 | sB = sB | 0; | |
15600 | sC = sC | 0; | |
15601 | sD = sD | 0; | |
15602 | sE = sE | 0; | |
15603 | sF = sF | 0; | |
15604 | 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; | |
15605 | if ((keySize | 0) == 32) { | |
15606 | t0 = HEAP[inv_sbox | s0 ^ RE0] ^ RD0; | |
15607 | t1 = HEAP[inv_sbox | sD ^ RED] ^ RD1; | |
15608 | t2 = HEAP[inv_sbox | sA ^ REA] ^ RD2; | |
15609 | t3 = HEAP[inv_sbox | s7 ^ RE7] ^ RD3; | |
15610 | t4 = HEAP[inv_sbox | s4 ^ RE4] ^ RD4; | |
15611 | t5 = HEAP[inv_sbox | s1 ^ RE1] ^ RD5; | |
15612 | t6 = HEAP[inv_sbox | sE ^ REE] ^ RD6; | |
15613 | t7 = HEAP[inv_sbox | sB ^ REB] ^ RD7; | |
15614 | t8 = HEAP[inv_sbox | s8 ^ RE8] ^ RD8; | |
15615 | t9 = HEAP[inv_sbox | s5 ^ RE5] ^ RD9; | |
15616 | tA = HEAP[inv_sbox | s2 ^ RE2] ^ RDA; | |
15617 | tB = HEAP[inv_sbox | sF ^ REF] ^ RDB; | |
15618 | tC = HEAP[inv_sbox | sC ^ REC] ^ RDC; | |
15619 | tD = HEAP[inv_sbox | s9 ^ RE9] ^ RDD; | |
15620 | tE = HEAP[inv_sbox | s6 ^ RE6] ^ RDE; | |
15621 | tF = HEAP[inv_sbox | s3 ^ RE3] ^ RDF; | |
15622 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15623 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15624 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15625 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15626 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15627 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15628 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15629 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15630 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15631 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15632 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15633 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15634 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15635 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15636 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15637 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15638 | t0 = HEAP[inv_sbox | s0] ^ RC0; | |
15639 | t1 = HEAP[inv_sbox | s1] ^ RC1; | |
15640 | t2 = HEAP[inv_sbox | s2] ^ RC2; | |
15641 | t3 = HEAP[inv_sbox | s3] ^ RC3; | |
15642 | t4 = HEAP[inv_sbox | s4] ^ RC4; | |
15643 | t5 = HEAP[inv_sbox | s5] ^ RC5; | |
15644 | t6 = HEAP[inv_sbox | s6] ^ RC6; | |
15645 | t7 = HEAP[inv_sbox | s7] ^ RC7; | |
15646 | t8 = HEAP[inv_sbox | s8] ^ RC8; | |
15647 | t9 = HEAP[inv_sbox | s9] ^ RC9; | |
15648 | tA = HEAP[inv_sbox | sA] ^ RCA; | |
15649 | tB = HEAP[inv_sbox | sB] ^ RCB; | |
15650 | tC = HEAP[inv_sbox | sC] ^ RCC; | |
15651 | tD = HEAP[inv_sbox | sD] ^ RCD; | |
15652 | tE = HEAP[inv_sbox | sE] ^ RCE; | |
15653 | tF = HEAP[inv_sbox | sF] ^ RCF; | |
15654 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15655 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15656 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15657 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15658 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15659 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15660 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15661 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15662 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15663 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15664 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15665 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15666 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15667 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15668 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15669 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15670 | t0 = HEAP[inv_sbox | s0] ^ RB0; | |
15671 | t1 = HEAP[inv_sbox | s1] ^ RB1; | |
15672 | t2 = HEAP[inv_sbox | s2] ^ RB2; | |
15673 | t3 = HEAP[inv_sbox | s3] ^ RB3; | |
15674 | t4 = HEAP[inv_sbox | s4] ^ RB4; | |
15675 | t5 = HEAP[inv_sbox | s5] ^ RB5; | |
15676 | t6 = HEAP[inv_sbox | s6] ^ RB6; | |
15677 | t7 = HEAP[inv_sbox | s7] ^ RB7; | |
15678 | t8 = HEAP[inv_sbox | s8] ^ RB8; | |
15679 | t9 = HEAP[inv_sbox | s9] ^ RB9; | |
15680 | tA = HEAP[inv_sbox | sA] ^ RBA; | |
15681 | tB = HEAP[inv_sbox | sB] ^ RBB; | |
15682 | tC = HEAP[inv_sbox | sC] ^ RBC; | |
15683 | tD = HEAP[inv_sbox | sD] ^ RBD; | |
15684 | tE = HEAP[inv_sbox | sE] ^ RBE; | |
15685 | tF = HEAP[inv_sbox | sF] ^ RBF; | |
15686 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15687 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15688 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15689 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15690 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15691 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15692 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15693 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15694 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15695 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15696 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15697 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15698 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15699 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15700 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15701 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15702 | t0 = HEAP[inv_sbox | s0] ^ RA0; | |
15703 | t1 = HEAP[inv_sbox | s1] ^ RA1; | |
15704 | t2 = HEAP[inv_sbox | s2] ^ RA2; | |
15705 | t3 = HEAP[inv_sbox | s3] ^ RA3; | |
15706 | t4 = HEAP[inv_sbox | s4] ^ RA4; | |
15707 | t5 = HEAP[inv_sbox | s5] ^ RA5; | |
15708 | t6 = HEAP[inv_sbox | s6] ^ RA6; | |
15709 | t7 = HEAP[inv_sbox | s7] ^ RA7; | |
15710 | t8 = HEAP[inv_sbox | s8] ^ RA8; | |
15711 | t9 = HEAP[inv_sbox | s9] ^ RA9; | |
15712 | tA = HEAP[inv_sbox | sA] ^ RAA; | |
15713 | tB = HEAP[inv_sbox | sB] ^ RAB; | |
15714 | tC = HEAP[inv_sbox | sC] ^ RAC; | |
15715 | tD = HEAP[inv_sbox | sD] ^ RAD; | |
15716 | tE = HEAP[inv_sbox | sE] ^ RAE; | |
15717 | tF = HEAP[inv_sbox | sF] ^ RAF; | |
15718 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15719 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15720 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15721 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15722 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15723 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15724 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15725 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15726 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15727 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15728 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15729 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15730 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15731 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15732 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15733 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15734 | t0 = HEAP[inv_sbox | s0] ^ R90; | |
15735 | t1 = HEAP[inv_sbox | s1] ^ R91; | |
15736 | t2 = HEAP[inv_sbox | s2] ^ R92; | |
15737 | t3 = HEAP[inv_sbox | s3] ^ R93; | |
15738 | t4 = HEAP[inv_sbox | s4] ^ R94; | |
15739 | t5 = HEAP[inv_sbox | s5] ^ R95; | |
15740 | t6 = HEAP[inv_sbox | s6] ^ R96; | |
15741 | t7 = HEAP[inv_sbox | s7] ^ R97; | |
15742 | t8 = HEAP[inv_sbox | s8] ^ R98; | |
15743 | t9 = HEAP[inv_sbox | s9] ^ R99; | |
15744 | tA = HEAP[inv_sbox | sA] ^ R9A; | |
15745 | tB = HEAP[inv_sbox | sB] ^ R9B; | |
15746 | tC = HEAP[inv_sbox | sC] ^ R9C; | |
15747 | tD = HEAP[inv_sbox | sD] ^ R9D; | |
15748 | tE = HEAP[inv_sbox | sE] ^ R9E; | |
15749 | tF = HEAP[inv_sbox | sF] ^ R9F; | |
15750 | } else { | |
15751 | t0 = HEAP[inv_sbox | s0 ^ RA0] ^ R90; | |
15752 | t1 = HEAP[inv_sbox | sD ^ RAD] ^ R91; | |
15753 | t2 = HEAP[inv_sbox | sA ^ RAA] ^ R92; | |
15754 | t3 = HEAP[inv_sbox | s7 ^ RA7] ^ R93; | |
15755 | t4 = HEAP[inv_sbox | s4 ^ RA4] ^ R94; | |
15756 | t5 = HEAP[inv_sbox | s1 ^ RA1] ^ R95; | |
15757 | t6 = HEAP[inv_sbox | sE ^ RAE] ^ R96; | |
15758 | t7 = HEAP[inv_sbox | sB ^ RAB] ^ R97; | |
15759 | t8 = HEAP[inv_sbox | s8 ^ RA8] ^ R98; | |
15760 | t9 = HEAP[inv_sbox | s5 ^ RA5] ^ R99; | |
15761 | tA = HEAP[inv_sbox | s2 ^ RA2] ^ R9A; | |
15762 | tB = HEAP[inv_sbox | sF ^ RAF] ^ R9B; | |
15763 | tC = HEAP[inv_sbox | sC ^ RAC] ^ R9C; | |
15764 | tD = HEAP[inv_sbox | s9 ^ RA9] ^ R9D; | |
15765 | tE = HEAP[inv_sbox | s6 ^ RA6] ^ R9E; | |
15766 | tF = HEAP[inv_sbox | s3 ^ RA3] ^ R9F; | |
15767 | } | |
15768 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15769 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15770 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15771 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15772 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15773 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15774 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15775 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15776 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15777 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15778 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15779 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15780 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15781 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15782 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15783 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15784 | t0 = HEAP[inv_sbox | s0] ^ R80; | |
15785 | t1 = HEAP[inv_sbox | s1] ^ R81; | |
15786 | t2 = HEAP[inv_sbox | s2] ^ R82; | |
15787 | t3 = HEAP[inv_sbox | s3] ^ R83; | |
15788 | t4 = HEAP[inv_sbox | s4] ^ R84; | |
15789 | t5 = HEAP[inv_sbox | s5] ^ R85; | |
15790 | t6 = HEAP[inv_sbox | s6] ^ R86; | |
15791 | t7 = HEAP[inv_sbox | s7] ^ R87; | |
15792 | t8 = HEAP[inv_sbox | s8] ^ R88; | |
15793 | t9 = HEAP[inv_sbox | s9] ^ R89; | |
15794 | tA = HEAP[inv_sbox | sA] ^ R8A; | |
15795 | tB = HEAP[inv_sbox | sB] ^ R8B; | |
15796 | tC = HEAP[inv_sbox | sC] ^ R8C; | |
15797 | tD = HEAP[inv_sbox | sD] ^ R8D; | |
15798 | tE = HEAP[inv_sbox | sE] ^ R8E; | |
15799 | tF = HEAP[inv_sbox | sF] ^ R8F; | |
15800 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15801 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15802 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15803 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15804 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15805 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15806 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15807 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15808 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15809 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15810 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15811 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15812 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15813 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15814 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15815 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15816 | t0 = HEAP[inv_sbox | s0] ^ R70; | |
15817 | t1 = HEAP[inv_sbox | s1] ^ R71; | |
15818 | t2 = HEAP[inv_sbox | s2] ^ R72; | |
15819 | t3 = HEAP[inv_sbox | s3] ^ R73; | |
15820 | t4 = HEAP[inv_sbox | s4] ^ R74; | |
15821 | t5 = HEAP[inv_sbox | s5] ^ R75; | |
15822 | t6 = HEAP[inv_sbox | s6] ^ R76; | |
15823 | t7 = HEAP[inv_sbox | s7] ^ R77; | |
15824 | t8 = HEAP[inv_sbox | s8] ^ R78; | |
15825 | t9 = HEAP[inv_sbox | s9] ^ R79; | |
15826 | tA = HEAP[inv_sbox | sA] ^ R7A; | |
15827 | tB = HEAP[inv_sbox | sB] ^ R7B; | |
15828 | tC = HEAP[inv_sbox | sC] ^ R7C; | |
15829 | tD = HEAP[inv_sbox | sD] ^ R7D; | |
15830 | tE = HEAP[inv_sbox | sE] ^ R7E; | |
15831 | tF = HEAP[inv_sbox | sF] ^ R7F; | |
15832 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15833 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15834 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15835 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15836 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15837 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15838 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15839 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15840 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15841 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15842 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15843 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15844 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15845 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15846 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15847 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15848 | t0 = HEAP[inv_sbox | s0] ^ R60; | |
15849 | t1 = HEAP[inv_sbox | s1] ^ R61; | |
15850 | t2 = HEAP[inv_sbox | s2] ^ R62; | |
15851 | t3 = HEAP[inv_sbox | s3] ^ R63; | |
15852 | t4 = HEAP[inv_sbox | s4] ^ R64; | |
15853 | t5 = HEAP[inv_sbox | s5] ^ R65; | |
15854 | t6 = HEAP[inv_sbox | s6] ^ R66; | |
15855 | t7 = HEAP[inv_sbox | s7] ^ R67; | |
15856 | t8 = HEAP[inv_sbox | s8] ^ R68; | |
15857 | t9 = HEAP[inv_sbox | s9] ^ R69; | |
15858 | tA = HEAP[inv_sbox | sA] ^ R6A; | |
15859 | tB = HEAP[inv_sbox | sB] ^ R6B; | |
15860 | tC = HEAP[inv_sbox | sC] ^ R6C; | |
15861 | tD = HEAP[inv_sbox | sD] ^ R6D; | |
15862 | tE = HEAP[inv_sbox | sE] ^ R6E; | |
15863 | tF = HEAP[inv_sbox | sF] ^ R6F; | |
15864 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15865 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15866 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15867 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15868 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15869 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15870 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15871 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15872 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15873 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15874 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15875 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15876 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15877 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15878 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15879 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15880 | t0 = HEAP[inv_sbox | s0] ^ R50; | |
15881 | t1 = HEAP[inv_sbox | s1] ^ R51; | |
15882 | t2 = HEAP[inv_sbox | s2] ^ R52; | |
15883 | t3 = HEAP[inv_sbox | s3] ^ R53; | |
15884 | t4 = HEAP[inv_sbox | s4] ^ R54; | |
15885 | t5 = HEAP[inv_sbox | s5] ^ R55; | |
15886 | t6 = HEAP[inv_sbox | s6] ^ R56; | |
15887 | t7 = HEAP[inv_sbox | s7] ^ R57; | |
15888 | t8 = HEAP[inv_sbox | s8] ^ R58; | |
15889 | t9 = HEAP[inv_sbox | s9] ^ R59; | |
15890 | tA = HEAP[inv_sbox | sA] ^ R5A; | |
15891 | tB = HEAP[inv_sbox | sB] ^ R5B; | |
15892 | tC = HEAP[inv_sbox | sC] ^ R5C; | |
15893 | tD = HEAP[inv_sbox | sD] ^ R5D; | |
15894 | tE = HEAP[inv_sbox | sE] ^ R5E; | |
15895 | tF = HEAP[inv_sbox | sF] ^ R5F; | |
15896 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15897 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15898 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15899 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15900 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15901 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15902 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15903 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15904 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15905 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15906 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15907 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15908 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15909 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15910 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15911 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15912 | t0 = HEAP[inv_sbox | s0] ^ R40; | |
15913 | t1 = HEAP[inv_sbox | s1] ^ R41; | |
15914 | t2 = HEAP[inv_sbox | s2] ^ R42; | |
15915 | t3 = HEAP[inv_sbox | s3] ^ R43; | |
15916 | t4 = HEAP[inv_sbox | s4] ^ R44; | |
15917 | t5 = HEAP[inv_sbox | s5] ^ R45; | |
15918 | t6 = HEAP[inv_sbox | s6] ^ R46; | |
15919 | t7 = HEAP[inv_sbox | s7] ^ R47; | |
15920 | t8 = HEAP[inv_sbox | s8] ^ R48; | |
15921 | t9 = HEAP[inv_sbox | s9] ^ R49; | |
15922 | tA = HEAP[inv_sbox | sA] ^ R4A; | |
15923 | tB = HEAP[inv_sbox | sB] ^ R4B; | |
15924 | tC = HEAP[inv_sbox | sC] ^ R4C; | |
15925 | tD = HEAP[inv_sbox | sD] ^ R4D; | |
15926 | tE = HEAP[inv_sbox | sE] ^ R4E; | |
15927 | tF = HEAP[inv_sbox | sF] ^ R4F; | |
15928 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15929 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15930 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15931 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15932 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15933 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15934 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15935 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15936 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15937 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15938 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15939 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15940 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15941 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15942 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15943 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15944 | t0 = HEAP[inv_sbox | s0] ^ R30; | |
15945 | t1 = HEAP[inv_sbox | s1] ^ R31; | |
15946 | t2 = HEAP[inv_sbox | s2] ^ R32; | |
15947 | t3 = HEAP[inv_sbox | s3] ^ R33; | |
15948 | t4 = HEAP[inv_sbox | s4] ^ R34; | |
15949 | t5 = HEAP[inv_sbox | s5] ^ R35; | |
15950 | t6 = HEAP[inv_sbox | s6] ^ R36; | |
15951 | t7 = HEAP[inv_sbox | s7] ^ R37; | |
15952 | t8 = HEAP[inv_sbox | s8] ^ R38; | |
15953 | t9 = HEAP[inv_sbox | s9] ^ R39; | |
15954 | tA = HEAP[inv_sbox | sA] ^ R3A; | |
15955 | tB = HEAP[inv_sbox | sB] ^ R3B; | |
15956 | tC = HEAP[inv_sbox | sC] ^ R3C; | |
15957 | tD = HEAP[inv_sbox | sD] ^ R3D; | |
15958 | tE = HEAP[inv_sbox | sE] ^ R3E; | |
15959 | tF = HEAP[inv_sbox | sF] ^ R3F; | |
15960 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15961 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15962 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15963 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15964 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15965 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15966 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15967 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
15968 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
15969 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
15970 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
15971 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
15972 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
15973 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
15974 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
15975 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
15976 | t0 = HEAP[inv_sbox | s0] ^ R20; | |
15977 | t1 = HEAP[inv_sbox | s1] ^ R21; | |
15978 | t2 = HEAP[inv_sbox | s2] ^ R22; | |
15979 | t3 = HEAP[inv_sbox | s3] ^ R23; | |
15980 | t4 = HEAP[inv_sbox | s4] ^ R24; | |
15981 | t5 = HEAP[inv_sbox | s5] ^ R25; | |
15982 | t6 = HEAP[inv_sbox | s6] ^ R26; | |
15983 | t7 = HEAP[inv_sbox | s7] ^ R27; | |
15984 | t8 = HEAP[inv_sbox | s8] ^ R28; | |
15985 | t9 = HEAP[inv_sbox | s9] ^ R29; | |
15986 | tA = HEAP[inv_sbox | sA] ^ R2A; | |
15987 | tB = HEAP[inv_sbox | sB] ^ R2B; | |
15988 | tC = HEAP[inv_sbox | sC] ^ R2C; | |
15989 | tD = HEAP[inv_sbox | sD] ^ R2D; | |
15990 | tE = HEAP[inv_sbox | sE] ^ R2E; | |
15991 | tF = HEAP[inv_sbox | sF] ^ R2F; | |
15992 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
15993 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
15994 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
15995 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
15996 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
15997 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
15998 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
15999 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
16000 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
16001 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
16002 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
16003 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
16004 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
16005 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
16006 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
16007 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
16008 | t0 = HEAP[inv_sbox | s0] ^ R10; | |
16009 | t1 = HEAP[inv_sbox | s1] ^ R11; | |
16010 | t2 = HEAP[inv_sbox | s2] ^ R12; | |
16011 | t3 = HEAP[inv_sbox | s3] ^ R13; | |
16012 | t4 = HEAP[inv_sbox | s4] ^ R14; | |
16013 | t5 = HEAP[inv_sbox | s5] ^ R15; | |
16014 | t6 = HEAP[inv_sbox | s6] ^ R16; | |
16015 | t7 = HEAP[inv_sbox | s7] ^ R17; | |
16016 | t8 = HEAP[inv_sbox | s8] ^ R18; | |
16017 | t9 = HEAP[inv_sbox | s9] ^ R19; | |
16018 | tA = HEAP[inv_sbox | sA] ^ R1A; | |
16019 | tB = HEAP[inv_sbox | sB] ^ R1B; | |
16020 | tC = HEAP[inv_sbox | sC] ^ R1C; | |
16021 | tD = HEAP[inv_sbox | sD] ^ R1D; | |
16022 | tE = HEAP[inv_sbox | sE] ^ R1E; | |
16023 | tF = HEAP[inv_sbox | sF] ^ R1F; | |
16024 | s0 = HEAP[xE | t0] ^ HEAP[xB | t1] ^ HEAP[xD | t2] ^ HEAP[x9 | t3]; | |
16025 | s1 = HEAP[x9 | tC] ^ HEAP[xE | tD] ^ HEAP[xB | tE] ^ HEAP[xD | tF]; | |
16026 | s2 = HEAP[xD | t8] ^ HEAP[x9 | t9] ^ HEAP[xE | tA] ^ HEAP[xB | tB]; | |
16027 | s3 = HEAP[xB | t4] ^ HEAP[xD | t5] ^ HEAP[x9 | t6] ^ HEAP[xE | t7]; | |
16028 | s4 = HEAP[xE | t4] ^ HEAP[xB | t5] ^ HEAP[xD | t6] ^ HEAP[x9 | t7]; | |
16029 | s5 = HEAP[x9 | t0] ^ HEAP[xE | t1] ^ HEAP[xB | t2] ^ HEAP[xD | t3]; | |
16030 | s6 = HEAP[xD | tC] ^ HEAP[x9 | tD] ^ HEAP[xE | tE] ^ HEAP[xB | tF]; | |
16031 | s7 = HEAP[xB | t8] ^ HEAP[xD | t9] ^ HEAP[x9 | tA] ^ HEAP[xE | tB]; | |
16032 | s8 = HEAP[xE | t8] ^ HEAP[xB | t9] ^ HEAP[xD | tA] ^ HEAP[x9 | tB]; | |
16033 | s9 = HEAP[x9 | t4] ^ HEAP[xE | t5] ^ HEAP[xB | t6] ^ HEAP[xD | t7]; | |
16034 | sA = HEAP[xD | t0] ^ HEAP[x9 | t1] ^ HEAP[xE | t2] ^ HEAP[xB | t3]; | |
16035 | sB = HEAP[xB | tC] ^ HEAP[xD | tD] ^ HEAP[x9 | tE] ^ HEAP[xE | tF]; | |
16036 | sC = HEAP[xE | tC] ^ HEAP[xB | tD] ^ HEAP[xD | tE] ^ HEAP[x9 | tF]; | |
16037 | sD = HEAP[x9 | t8] ^ HEAP[xE | t9] ^ HEAP[xB | tA] ^ HEAP[xD | tB]; | |
16038 | sE = HEAP[xD | t4] ^ HEAP[x9 | t5] ^ HEAP[xE | t6] ^ HEAP[xB | t7]; | |
16039 | sF = HEAP[xB | t0] ^ HEAP[xD | t1] ^ HEAP[x9 | t2] ^ HEAP[xE | t3]; | |
16040 | S0 = HEAP[inv_sbox | s0] ^ R00; | |
16041 | S1 = HEAP[inv_sbox | s1] ^ R01; | |
16042 | S2 = HEAP[inv_sbox | s2] ^ R02; | |
16043 | S3 = HEAP[inv_sbox | s3] ^ R03; | |
16044 | S4 = HEAP[inv_sbox | s4] ^ R04; | |
16045 | S5 = HEAP[inv_sbox | s5] ^ R05; | |
16046 | S6 = HEAP[inv_sbox | s6] ^ R06; | |
16047 | S7 = HEAP[inv_sbox | s7] ^ R07; | |
16048 | S8 = HEAP[inv_sbox | s8] ^ R08; | |
16049 | S9 = HEAP[inv_sbox | s9] ^ R09; | |
16050 | SA = HEAP[inv_sbox | sA] ^ R0A; | |
16051 | SB = HEAP[inv_sbox | sB] ^ R0B; | |
16052 | SC = HEAP[inv_sbox | sC] ^ R0C; | |
16053 | SD = HEAP[inv_sbox | sD] ^ R0D; | |
16054 | SE = HEAP[inv_sbox | sE] ^ R0E; | |
16055 | SF = HEAP[inv_sbox | sF] ^ R0F; | |
16056 | } | |
16057 | function init_state(s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF) { | |
16058 | s0 = s0 | 0; | |
16059 | s1 = s1 | 0; | |
16060 | s2 = s2 | 0; | |
16061 | s3 = s3 | 0; | |
16062 | s4 = s4 | 0; | |
16063 | s5 = s5 | 0; | |
16064 | s6 = s6 | 0; | |
16065 | s7 = s7 | 0; | |
16066 | s8 = s8 | 0; | |
16067 | s9 = s9 | 0; | |
16068 | sA = sA | 0; | |
16069 | sB = sB | 0; | |
16070 | sC = sC | 0; | |
16071 | sD = sD | 0; | |
16072 | sE = sE | 0; | |
16073 | sF = sF | 0; | |
16074 | S0 = s0; | |
16075 | S1 = s1; | |
16076 | S2 = s2; | |
16077 | S3 = s3; | |
16078 | S4 = s4; | |
16079 | S5 = s5; | |
16080 | S6 = s6; | |
16081 | S7 = s7; | |
16082 | S8 = s8; | |
16083 | S9 = s9; | |
16084 | SA = sA; | |
16085 | SB = sB; | |
16086 | SC = sC; | |
16087 | SD = sD; | |
16088 | SE = sE; | |
16089 | SF = sF; | |
16090 | } | |
16091 | function save_state(offset) { | |
16092 | offset = offset | 0; | |
16093 | HEAP[offset] = S0; | |
16094 | HEAP[offset | 1] = S1; | |
16095 | HEAP[offset | 2] = S2; | |
16096 | HEAP[offset | 3] = S3; | |
16097 | HEAP[offset | 4] = S4; | |
16098 | HEAP[offset | 5] = S5; | |
16099 | HEAP[offset | 6] = S6; | |
16100 | HEAP[offset | 7] = S7; | |
16101 | HEAP[offset | 8] = S8; | |
16102 | HEAP[offset | 9] = S9; | |
16103 | HEAP[offset | 10] = SA; | |
16104 | HEAP[offset | 11] = SB; | |
16105 | HEAP[offset | 12] = SC; | |
16106 | HEAP[offset | 13] = SD; | |
16107 | HEAP[offset | 14] = SE; | |
16108 | HEAP[offset | 15] = SF; | |
16109 | } | |
16110 | function init_key_128(k0, k1, k2, k3, k4, k5, k6, k7, k8, k9, kA, kB, kC, kD, kE, kF) { | |
16111 | k0 = k0 | 0; | |
16112 | k1 = k1 | 0; | |
16113 | k2 = k2 | 0; | |
16114 | k3 = k3 | 0; | |
16115 | k4 = k4 | 0; | |
16116 | k5 = k5 | 0; | |
16117 | k6 = k6 | 0; | |
16118 | k7 = k7 | 0; | |
16119 | k8 = k8 | 0; | |
16120 | k9 = k9 | 0; | |
16121 | kA = kA | 0; | |
16122 | kB = kB | 0; | |
16123 | kC = kC | 0; | |
16124 | kD = kD | 0; | |
16125 | kE = kE | 0; | |
16126 | kF = kF | 0; | |
16127 | R00 = k0; | |
16128 | R01 = k1; | |
16129 | R02 = k2; | |
16130 | R03 = k3; | |
16131 | R04 = k4; | |
16132 | R05 = k5; | |
16133 | R06 = k6; | |
16134 | R07 = k7; | |
16135 | R08 = k8; | |
16136 | R09 = k9; | |
16137 | R0A = kA; | |
16138 | R0B = kB; | |
16139 | R0C = kC; | |
16140 | R0D = kD; | |
16141 | R0E = kE; | |
16142 | R0F = kF; | |
16143 | keySize = 16; | |
16144 | _expand_key_128(); | |
16145 | } | |
16146 | 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) { | |
16147 | k00 = k00 | 0; | |
16148 | k01 = k01 | 0; | |
16149 | k02 = k02 | 0; | |
16150 | k03 = k03 | 0; | |
16151 | k04 = k04 | 0; | |
16152 | k05 = k05 | 0; | |
16153 | k06 = k06 | 0; | |
16154 | k07 = k07 | 0; | |
16155 | k08 = k08 | 0; | |
16156 | k09 = k09 | 0; | |
16157 | k0A = k0A | 0; | |
16158 | k0B = k0B | 0; | |
16159 | k0C = k0C | 0; | |
16160 | k0D = k0D | 0; | |
16161 | k0E = k0E | 0; | |
16162 | k0F = k0F | 0; | |
16163 | k10 = k10 | 0; | |
16164 | k11 = k11 | 0; | |
16165 | k12 = k12 | 0; | |
16166 | k13 = k13 | 0; | |
16167 | k14 = k14 | 0; | |
16168 | k15 = k15 | 0; | |
16169 | k16 = k16 | 0; | |
16170 | k17 = k17 | 0; | |
16171 | k18 = k18 | 0; | |
16172 | k19 = k19 | 0; | |
16173 | k1A = k1A | 0; | |
16174 | k1B = k1B | 0; | |
16175 | k1C = k1C | 0; | |
16176 | k1D = k1D | 0; | |
16177 | k1E = k1E | 0; | |
16178 | k1F = k1F | 0; | |
16179 | R00 = k00; | |
16180 | R01 = k01; | |
16181 | R02 = k02; | |
16182 | R03 = k03; | |
16183 | R04 = k04; | |
16184 | R05 = k05; | |
16185 | R06 = k06; | |
16186 | R07 = k07; | |
16187 | R08 = k08; | |
16188 | R09 = k09; | |
16189 | R0A = k0A; | |
16190 | R0B = k0B; | |
16191 | R0C = k0C; | |
16192 | R0D = k0D; | |
16193 | R0E = k0E; | |
16194 | R0F = k0F; | |
16195 | R10 = k10; | |
16196 | R11 = k11; | |
16197 | R12 = k12; | |
16198 | R13 = k13; | |
16199 | R14 = k14; | |
16200 | R15 = k15; | |
16201 | R16 = k16; | |
16202 | R17 = k17; | |
16203 | R18 = k18; | |
16204 | R19 = k19; | |
16205 | R1A = k1A; | |
16206 | R1B = k1B; | |
16207 | R1C = k1C; | |
16208 | R1D = k1D; | |
16209 | R1E = k1E; | |
16210 | R1F = k1F; | |
16211 | keySize = 32; | |
16212 | _expand_key_256(); | |
16213 | } | |
16214 | function cbc_encrypt(offset, length) { | |
16215 | offset = offset | 0; | |
16216 | length = length | 0; | |
16217 | var encrypted = 0; | |
16218 | if (offset & 15) return -1; | |
16219 | while ((length | 0) >= 16) { | |
16220 | _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]); | |
16221 | HEAP[offset] = S0; | |
16222 | HEAP[offset | 1] = S1; | |
16223 | HEAP[offset | 2] = S2; | |
16224 | HEAP[offset | 3] = S3; | |
16225 | HEAP[offset | 4] = S4; | |
16226 | HEAP[offset | 5] = S5; | |
16227 | HEAP[offset | 6] = S6; | |
16228 | HEAP[offset | 7] = S7; | |
16229 | HEAP[offset | 8] = S8; | |
16230 | HEAP[offset | 9] = S9; | |
16231 | HEAP[offset | 10] = SA; | |
16232 | HEAP[offset | 11] = SB; | |
16233 | HEAP[offset | 12] = SC; | |
16234 | HEAP[offset | 13] = SD; | |
16235 | HEAP[offset | 14] = SE; | |
16236 | HEAP[offset | 15] = SF; | |
16237 | offset = offset + 16 | 0; | |
16238 | length = length - 16 | 0; | |
16239 | encrypted = encrypted + 16 | 0; | |
16240 | } | |
16241 | return encrypted | 0; | |
16242 | } | |
16243 | function cbc_decrypt(offset, length) { | |
16244 | offset = offset | 0; | |
16245 | length = length | 0; | |
16246 | 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; | |
16247 | if (offset & 15) return -1; | |
16248 | iv0 = S0; | |
16249 | iv1 = S1; | |
16250 | iv2 = S2; | |
16251 | iv3 = S3; | |
16252 | iv4 = S4; | |
16253 | iv5 = S5; | |
16254 | iv6 = S6; | |
16255 | iv7 = S7; | |
16256 | iv8 = S8; | |
16257 | iv9 = S9; | |
16258 | ivA = SA; | |
16259 | ivB = SB; | |
16260 | ivC = SC; | |
16261 | ivD = SD; | |
16262 | ivE = SE; | |
16263 | ivF = SF; | |
16264 | while ((length | 0) >= 16) { | |
16265 | _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); | |
16266 | S0 = S0 ^ iv0; | |
16267 | iv0 = HEAP[offset] | 0; | |
16268 | S1 = S1 ^ iv1; | |
16269 | iv1 = HEAP[offset | 1] | 0; | |
16270 | S2 = S2 ^ iv2; | |
16271 | iv2 = HEAP[offset | 2] | 0; | |
16272 | S3 = S3 ^ iv3; | |
16273 | iv3 = HEAP[offset | 3] | 0; | |
16274 | S4 = S4 ^ iv4; | |
16275 | iv4 = HEAP[offset | 4] | 0; | |
16276 | S5 = S5 ^ iv5; | |
16277 | iv5 = HEAP[offset | 5] | 0; | |
16278 | S6 = S6 ^ iv6; | |
16279 | iv6 = HEAP[offset | 6] | 0; | |
16280 | S7 = S7 ^ iv7; | |
16281 | iv7 = HEAP[offset | 7] | 0; | |
16282 | S8 = S8 ^ iv8; | |
16283 | iv8 = HEAP[offset | 8] | 0; | |
16284 | S9 = S9 ^ iv9; | |
16285 | iv9 = HEAP[offset | 9] | 0; | |
16286 | SA = SA ^ ivA; | |
16287 | ivA = HEAP[offset | 10] | 0; | |
16288 | SB = SB ^ ivB; | |
16289 | ivB = HEAP[offset | 11] | 0; | |
16290 | SC = SC ^ ivC; | |
16291 | ivC = HEAP[offset | 12] | 0; | |
16292 | SD = SD ^ ivD; | |
16293 | ivD = HEAP[offset | 13] | 0; | |
16294 | SE = SE ^ ivE; | |
16295 | ivE = HEAP[offset | 14] | 0; | |
16296 | SF = SF ^ ivF; | |
16297 | ivF = HEAP[offset | 15] | 0; | |
16298 | HEAP[offset] = S0; | |
16299 | HEAP[offset | 1] = S1; | |
16300 | HEAP[offset | 2] = S2; | |
16301 | HEAP[offset | 3] = S3; | |
16302 | HEAP[offset | 4] = S4; | |
16303 | HEAP[offset | 5] = S5; | |
16304 | HEAP[offset | 6] = S6; | |
16305 | HEAP[offset | 7] = S7; | |
16306 | HEAP[offset | 8] = S8; | |
16307 | HEAP[offset | 9] = S9; | |
16308 | HEAP[offset | 10] = SA; | |
16309 | HEAP[offset | 11] = SB; | |
16310 | HEAP[offset | 12] = SC; | |
16311 | HEAP[offset | 13] = SD; | |
16312 | HEAP[offset | 14] = SE; | |
16313 | HEAP[offset | 15] = SF; | |
16314 | offset = offset + 16 | 0; | |
16315 | length = length - 16 | 0; | |
16316 | decrypted = decrypted + 16 | 0; | |
16317 | } | |
16318 | S0 = iv0; | |
16319 | S1 = iv1; | |
16320 | S2 = iv2; | |
16321 | S3 = iv3; | |
16322 | S4 = iv4; | |
16323 | S5 = iv5; | |
16324 | S6 = iv6; | |
16325 | S7 = iv7; | |
16326 | S8 = iv8; | |
16327 | S9 = iv9; | |
16328 | SA = ivA; | |
16329 | SB = ivB; | |
16330 | SC = ivC; | |
16331 | SD = ivD; | |
16332 | SE = ivE; | |
16333 | SF = ivF; | |
16334 | return decrypted | 0; | |
16335 | } | |
16336 | function cbc_mac(offset, length, output) { | |
16337 | offset = offset | 0; | |
16338 | length = length | 0; | |
16339 | output = output | 0; | |
16340 | if (offset & 15) return -1; | |
16341 | if (~output) if (output & 31) return -1; | |
16342 | while ((length | 0) >= 16) { | |
16343 | _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]); | |
16344 | offset = offset + 16 | 0; | |
16345 | length = length - 16 | 0; | |
16346 | } | |
16347 | if ((length | 0) > 0) { | |
16348 | S0 = S0 ^ HEAP[offset]; | |
16349 | if ((length | 0) > 1) S1 = S1 ^ HEAP[offset | 1]; | |
16350 | if ((length | 0) > 2) S2 = S2 ^ HEAP[offset | 2]; | |
16351 | if ((length | 0) > 3) S3 = S3 ^ HEAP[offset | 3]; | |
16352 | if ((length | 0) > 4) S4 = S4 ^ HEAP[offset | 4]; | |
16353 | if ((length | 0) > 5) S5 = S5 ^ HEAP[offset | 5]; | |
16354 | if ((length | 0) > 6) S6 = S6 ^ HEAP[offset | 6]; | |
16355 | if ((length | 0) > 7) S7 = S7 ^ HEAP[offset | 7]; | |
16356 | if ((length | 0) > 8) S8 = S8 ^ HEAP[offset | 8]; | |
16357 | if ((length | 0) > 9) S9 = S9 ^ HEAP[offset | 9]; | |
16358 | if ((length | 0) > 10) SA = SA ^ HEAP[offset | 10]; | |
16359 | if ((length | 0) > 11) SB = SB ^ HEAP[offset | 11]; | |
16360 | if ((length | 0) > 12) SC = SC ^ HEAP[offset | 12]; | |
16361 | if ((length | 0) > 13) SD = SD ^ HEAP[offset | 13]; | |
16362 | if ((length | 0) > 14) SE = SE ^ HEAP[offset | 14]; | |
16363 | _encrypt(S0, S1, S2, S3, S4, S5, S6, S7, S8, S9, SA, SB, SC, SD, SE, SF); | |
16364 | offset = offset + length | 0; | |
16365 | length = 0; | |
16366 | } | |
16367 | if (~output) { | |
16368 | HEAP[output | 0] = S0; | |
16369 | HEAP[output | 1] = S1; | |
16370 | HEAP[output | 2] = S2; | |
16371 | HEAP[output | 3] = S3; | |
16372 | HEAP[output | 4] = S4; | |
16373 | HEAP[output | 5] = S5; | |
16374 | HEAP[output | 6] = S6; | |
16375 | HEAP[output | 7] = S7; | |
16376 | HEAP[output | 8] = S8; | |
16377 | HEAP[output | 9] = S9; | |
16378 | HEAP[output | 10] = SA; | |
16379 | HEAP[output | 11] = SB; | |
16380 | HEAP[output | 12] = SC; | |
16381 | HEAP[output | 13] = SD; | |
16382 | HEAP[output | 14] = SE; | |
16383 | HEAP[output | 15] = SF; | |
16384 | } | |
16385 | return 0; | |
16386 | } | |
16387 | function ccm_encrypt(offset, length, nonce0, nonce1, nonce2, nonce3, nonce4, nonce5, nonce6, nonce7, nonce8, nonce9, nonceA, nonceB, nonceC, nonceD, counter0, counter1) { | |
16388 | offset = offset | 0; | |
16389 | length = length | 0; | |
16390 | nonce0 = nonce0 | 0; | |
16391 | nonce1 = nonce1 | 0; | |
16392 | nonce2 = nonce2 | 0; | |
16393 | nonce3 = nonce3 | 0; | |
16394 | nonce4 = nonce4 | 0; | |
16395 | nonce5 = nonce5 | 0; | |
16396 | nonce6 = nonce6 | 0; | |
16397 | nonce7 = nonce7 | 0; | |
16398 | nonce8 = nonce8 | 0; | |
16399 | nonce9 = nonce9 | 0; | |
16400 | nonceA = nonceA | 0; | |
16401 | nonceB = nonceB | 0; | |
16402 | nonceC = nonceC | 0; | |
16403 | nonceD = nonceD | 0; | |
16404 | counter0 = counter0 | 0; | |
16405 | counter1 = counter1 | 0; | |
16406 | 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; | |
16407 | if (offset & 15) return -1; | |
16408 | iv0 = S0, iv1 = S1, iv2 = S2, iv3 = S3, iv4 = S4, iv5 = S5, iv6 = S6, iv7 = S7, | |
16409 | iv8 = S8, iv9 = S9, ivA = SA, ivB = SB, ivC = SC, ivD = SD, ivE = SE, ivF = SF; | |
16410 | while ((length | 0) >= 16) { | |
16411 | s0 = HEAP[offset] | 0; | |
16412 | s1 = HEAP[offset | 1] | 0; | |
16413 | s2 = HEAP[offset | 2] | 0; | |
16414 | s3 = HEAP[offset | 3] | 0; | |
16415 | s4 = HEAP[offset | 4] | 0; | |
16416 | s5 = HEAP[offset | 5] | 0; | |
16417 | s6 = HEAP[offset | 6] | 0; | |
16418 | s7 = HEAP[offset | 7] | 0; | |
16419 | s8 = HEAP[offset | 8] | 0; | |
16420 | s9 = HEAP[offset | 9] | 0; | |
16421 | sA = HEAP[offset | 10] | 0; | |
16422 | sB = HEAP[offset | 11] | 0; | |
16423 | sC = HEAP[offset | 12] | 0; | |
16424 | sD = HEAP[offset | 13] | 0; | |
16425 | sE = HEAP[offset | 14] | 0; | |
16426 | sF = HEAP[offset | 15] | 0; | |
16427 | _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); | |
16428 | HEAP[offset] = s0 ^ S0; | |
16429 | HEAP[offset | 1] = s1 ^ S1; | |
16430 | HEAP[offset | 2] = s2 ^ S2; | |
16431 | HEAP[offset | 3] = s3 ^ S3; | |
16432 | HEAP[offset | 4] = s4 ^ S4; | |
16433 | HEAP[offset | 5] = s5 ^ S5; | |
16434 | HEAP[offset | 6] = s6 ^ S6; | |
16435 | HEAP[offset | 7] = s7 ^ S7; | |
16436 | HEAP[offset | 8] = s8 ^ S8; | |
16437 | HEAP[offset | 9] = s9 ^ S9; | |
16438 | HEAP[offset | 10] = sA ^ SA; | |
16439 | HEAP[offset | 11] = sB ^ SB; | |
16440 | HEAP[offset | 12] = sC ^ SC; | |
16441 | HEAP[offset | 13] = sD ^ SD; | |
16442 | HEAP[offset | 14] = sE ^ SE; | |
16443 | HEAP[offset | 15] = sF ^ SF; | |
16444 | _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); | |
16445 | iv0 = S0, iv1 = S1, iv2 = S2, iv3 = S3, iv4 = S4, iv5 = S5, iv6 = S6, iv7 = S7, | |
16446 | iv8 = S8, iv9 = S9, ivA = SA, ivB = SB, ivC = SC, ivD = SD, ivE = SE, ivF = SF; | |
16447 | encrypted = encrypted + 16 | 0; | |
16448 | offset = offset + 16 | 0; | |
16449 | length = length - 16 | 0; | |
16450 | counter1 = counter1 + 1 | 0; | |
16451 | if ((counter1 | 0) == 0) counter0 = counter0 + 1 | 0; | |
16452 | } | |
16453 | if ((length | 0) > 0) { | |
16454 | s0 = HEAP[offset] | 0; | |
16455 | s1 = (length | 0) > 1 ? HEAP[offset | 1] | 0 : 0; | |
16456 | s2 = (length | 0) > 2 ? HEAP[offset | 2] | 0 : 0; | |
16457 | s3 = (length | 0) > 3 ? HEAP[offset | 3] | 0 : 0; | |
16458 | s4 = (length | 0) > 4 ? HEAP[offset | 4] | 0 : 0; | |
16459 | s5 = (length | 0) > 5 ? HEAP[offset | 5] | 0 : 0; | |
16460 | s6 = (length | 0) > 6 ? HEAP[offset | 6] | 0 : 0; | |
16461 | s7 = (length | 0) > 7 ? HEAP[offset | 7] | 0 : 0; | |
16462 | s8 = (length | 0) > 8 ? HEAP[offset | 8] | 0 : 0; | |
16463 | s9 = (length | 0) > 9 ? HEAP[offset | 9] | 0 : 0; | |
16464 | sA = (length | 0) > 10 ? HEAP[offset | 10] | 0 : 0; | |
16465 | sB = (length | 0) > 11 ? HEAP[offset | 11] | 0 : 0; | |
16466 | sC = (length | 0) > 12 ? HEAP[offset | 12] | 0 : 0; | |
16467 | sD = (length | 0) > 13 ? HEAP[offset | 13] | 0 : 0; | |
16468 | sE = (length | 0) > 14 ? HEAP[offset | 14] | 0 : 0; | |
16469 | _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); | |
16470 | HEAP[offset] = s0 ^ S0; | |
16471 | if ((length | 0) > 1) HEAP[offset | 1] = s1 ^ S1; | |
16472 | if ((length | 0) > 2) HEAP[offset | 2] = s2 ^ S2; | |
16473 | if ((length | 0) > 3) HEAP[offset | 3] = s3 ^ S3; | |
16474 | if ((length | 0) > 4) HEAP[offset | 4] = s4 ^ S4; | |
16475 | if ((length | 0) > 5) HEAP[offset | 5] = s5 ^ S5; | |
16476 | if ((length | 0) > 6) HEAP[offset | 6] = s6 ^ S6; | |
16477 | if ((length | 0) > 7) HEAP[offset | 7] = s7 ^ S7; | |
16478 | if ((length | 0) > 8) HEAP[offset | 8] = s8 ^ S8; | |
16479 | if ((length | 0) > 9) HEAP[offset | 9] = s9 ^ S9; | |
16480 | if ((length | 0) > 10) HEAP[offset | 10] = sA ^ SA; | |
16481 | if ((length | 0) > 11) HEAP[offset | 11] = sB ^ SB; | |
16482 | if ((length | 0) > 12) HEAP[offset | 12] = sC ^ SC; | |
16483 | if ((length | 0) > 13) HEAP[offset | 13] = sD ^ SD; | |
16484 | if ((length | 0) > 14) HEAP[offset | 14] = sE ^ SE; | |
16485 | _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); | |
16486 | iv0 = S0, iv1 = S1, iv2 = S2, iv3 = S3, iv4 = S4, iv5 = S5, iv6 = S6, iv7 = S7, | |
16487 | iv8 = S8, iv9 = S9, ivA = SA, ivB = SB, ivC = SC, ivD = SD, ivE = SE, ivF = SF; | |
16488 | encrypted = encrypted + length | 0; | |
16489 | offset = offset + length | 0; | |
16490 | length = 0; | |
16491 | counter1 = counter1 + 1 | 0; | |
16492 | if ((counter1 | 0) == 0) counter0 = counter0 + 1 | 0; | |
16493 | } | |
16494 | return encrypted | 0; | |
16495 | } | |
16496 | function ccm_decrypt(offset, length, nonce0, nonce1, nonce2, nonce3, nonce4, nonce5, nonce6, nonce7, nonce8, nonce9, nonceA, nonceB, nonceC, nonceD, counter0, counter1) { | |
16497 | offset = offset | 0; | |
16498 | length = length | 0; | |
16499 | nonce0 = nonce0 | 0; | |
16500 | nonce1 = nonce1 | 0; | |
16501 | nonce2 = nonce2 | 0; | |
16502 | nonce3 = nonce3 | 0; | |
16503 | nonce4 = nonce4 | 0; | |
16504 | nonce5 = nonce5 | 0; | |
16505 | nonce6 = nonce6 | 0; | |
16506 | nonce7 = nonce7 | 0; | |
16507 | nonce8 = nonce8 | 0; | |
16508 | nonce9 = nonce9 | 0; | |
16509 | nonceA = nonceA | 0; | |
16510 | nonceB = nonceB | 0; | |
16511 | nonceC = nonceC | 0; | |
16512 | nonceD = nonceD | 0; | |
16513 | counter0 = counter0 | 0; | |
16514 | counter1 = counter1 | 0; | |
16515 | 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; | |
16516 | if (offset & 15) return -1; | |
16517 | iv0 = S0, iv1 = S1, iv2 = S2, iv3 = S3, iv4 = S4, iv5 = S5, iv6 = S6, iv7 = S7, | |
16518 | iv8 = S8, iv9 = S9, ivA = SA, ivB = SB, ivC = SC, ivD = SD, ivE = SE, ivF = SF; | |
16519 | while ((length | 0) >= 16) { | |
16520 | _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); | |
16521 | HEAP[offset] = s0 = HEAP[offset] ^ S0; | |
16522 | HEAP[offset | 1] = s1 = HEAP[offset | 1] ^ S1; | |
16523 | HEAP[offset | 2] = s2 = HEAP[offset | 2] ^ S2; | |
16524 | HEAP[offset | 3] = s3 = HEAP[offset | 3] ^ S3; | |
16525 | HEAP[offset | 4] = s4 = HEAP[offset | 4] ^ S4; | |
16526 | HEAP[offset | 5] = s5 = HEAP[offset | 5] ^ S5; | |
16527 | HEAP[offset | 6] = s6 = HEAP[offset | 6] ^ S6; | |
16528 | HEAP[offset | 7] = s7 = HEAP[offset | 7] ^ S7; | |
16529 | HEAP[offset | 8] = s8 = HEAP[offset | 8] ^ S8; | |
16530 | HEAP[offset | 9] = s9 = HEAP[offset | 9] ^ S9; | |
16531 | HEAP[offset | 10] = sA = HEAP[offset | 10] ^ SA; | |
16532 | HEAP[offset | 11] = sB = HEAP[offset | 11] ^ SB; | |
16533 | HEAP[offset | 12] = sC = HEAP[offset | 12] ^ SC; | |
16534 | HEAP[offset | 13] = sD = HEAP[offset | 13] ^ SD; | |
16535 | HEAP[offset | 14] = sE = HEAP[offset | 14] ^ SE; | |
16536 | HEAP[offset | 15] = sF = HEAP[offset | 15] ^ SF; | |
16537 | _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); | |
16538 | iv0 = S0, iv1 = S1, iv2 = S2, iv3 = S3, iv4 = S4, iv5 = S5, iv6 = S6, iv7 = S7, | |
16539 | iv8 = S8, iv9 = S9, ivA = SA, ivB = SB, ivC = SC, ivD = SD, ivE = SE, ivF = SF; | |
16540 | decrypted = decrypted + 16 | 0; | |
16541 | offset = offset + 16 | 0; | |
16542 | length = length - 16 | 0; | |
16543 | counter1 = counter1 + 1 | 0; | |
16544 | if ((counter1 | 0) == 0) counter0 = counter0 + 1 | 0; | |
16545 | } | |
16546 | if ((length | 0) > 0) { | |
16547 | _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); | |
16548 | s0 = HEAP[offset] ^ S0; | |
16549 | s1 = (length | 0) > 1 ? HEAP[offset | 1] ^ S1 : 0; | |
16550 | s2 = (length | 0) > 2 ? HEAP[offset | 2] ^ S2 : 0; | |
16551 | s3 = (length | 0) > 3 ? HEAP[offset | 3] ^ S3 : 0; | |
16552 | s4 = (length | 0) > 4 ? HEAP[offset | 4] ^ S4 : 0; | |
16553 | s5 = (length | 0) > 5 ? HEAP[offset | 5] ^ S5 : 0; | |
16554 | s6 = (length | 0) > 6 ? HEAP[offset | 6] ^ S6 : 0; | |
16555 | s7 = (length | 0) > 7 ? HEAP[offset | 7] ^ S7 : 0; | |
16556 | s8 = (length | 0) > 8 ? HEAP[offset | 8] ^ S8 : 0; | |
16557 | s9 = (length | 0) > 9 ? HEAP[offset | 9] ^ S9 : 0; | |
16558 | sA = (length | 0) > 10 ? HEAP[offset | 10] ^ SA : 0; | |
16559 | sB = (length | 0) > 11 ? HEAP[offset | 11] ^ SB : 0; | |
16560 | sC = (length | 0) > 12 ? HEAP[offset | 12] ^ SC : 0; | |
16561 | sD = (length | 0) > 13 ? HEAP[offset | 13] ^ SD : 0; | |
16562 | sE = (length | 0) > 14 ? HEAP[offset | 14] ^ SE : 0; | |
16563 | sF = (length | 0) > 15 ? HEAP[offset | 15] ^ SF : 0; | |
16564 | HEAP[offset] = s0; | |
16565 | if ((length | 0) > 1) HEAP[offset | 1] = s1; | |
16566 | if ((length | 0) > 2) HEAP[offset | 2] = s2; | |
16567 | if ((length | 0) > 3) HEAP[offset | 3] = s3; | |
16568 | if ((length | 0) > 4) HEAP[offset | 4] = s4; | |
16569 | if ((length | 0) > 5) HEAP[offset | 5] = s5; | |
16570 | if ((length | 0) > 6) HEAP[offset | 6] = s6; | |
16571 | if ((length | 0) > 7) HEAP[offset | 7] = s7; | |
16572 | if ((length | 0) > 8) HEAP[offset | 8] = s8; | |
16573 | if ((length | 0) > 9) HEAP[offset | 9] = s9; | |
16574 | if ((length | 0) > 10) HEAP[offset | 10] = sA; | |
16575 | if ((length | 0) > 11) HEAP[offset | 11] = sB; | |
16576 | if ((length | 0) > 12) HEAP[offset | 12] = sC; | |
16577 | if ((length | 0) > 13) HEAP[offset | 13] = sD; | |
16578 | if ((length | 0) > 14) HEAP[offset | 14] = sE; | |
16579 | _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); | |
16580 | iv0 = S0, iv1 = S1, iv2 = S2, iv3 = S3, iv4 = S4, iv5 = S5, iv6 = S6, iv7 = S7, | |
16581 | iv8 = S8, iv9 = S9, ivA = SA, ivB = SB, ivC = SC, ivD = SD, ivE = SE, ivF = SF; | |
16582 | decrypted = decrypted + length | 0; | |
16583 | offset = offset + length | 0; | |
16584 | length = 0; | |
16585 | counter1 = counter1 + 1 | 0; | |
16586 | if ((counter1 | 0) == 0) counter0 = counter0 + 1 | 0; | |
16587 | } | |
16588 | return decrypted | 0; | |
16589 | } | |
16590 | function cfb_encrypt(offset, length) { | |
16591 | offset = offset | 0; | |
16592 | length = length | 0; | |
16593 | var encrypted = 0; | |
16594 | if (offset & 15) return -1; | |
16595 | while ((length | 0) >= 16) { | |
16596 | _encrypt(S0, S1, S2, S3, S4, S5, S6, S7, S8, S9, SA, SB, SC, SD, SE, SF); | |
16597 | S0 = S0 ^ HEAP[offset]; | |
16598 | S1 = S1 ^ HEAP[offset | 1]; | |
16599 | S2 = S2 ^ HEAP[offset | 2]; | |
16600 | S3 = S3 ^ HEAP[offset | 3]; | |
16601 | S4 = S4 ^ HEAP[offset | 4]; | |
16602 | S5 = S5 ^ HEAP[offset | 5]; | |
16603 | S6 = S6 ^ HEAP[offset | 6]; | |
16604 | S7 = S7 ^ HEAP[offset | 7]; | |
16605 | S8 = S8 ^ HEAP[offset | 8]; | |
16606 | S9 = S9 ^ HEAP[offset | 9]; | |
16607 | SA = SA ^ HEAP[offset | 10]; | |
16608 | SB = SB ^ HEAP[offset | 11]; | |
16609 | SC = SC ^ HEAP[offset | 12]; | |
16610 | SD = SD ^ HEAP[offset | 13]; | |
16611 | SE = SE ^ HEAP[offset | 14]; | |
16612 | SF = SF ^ HEAP[offset | 15]; | |
16613 | HEAP[offset] = S0; | |
16614 | HEAP[offset | 1] = S1; | |
16615 | HEAP[offset | 2] = S2; | |
16616 | HEAP[offset | 3] = S3; | |
16617 | HEAP[offset | 4] = S4; | |
16618 | HEAP[offset | 5] = S5; | |
16619 | HEAP[offset | 6] = S6; | |
16620 | HEAP[offset | 7] = S7; | |
16621 | HEAP[offset | 8] = S8; | |
16622 | HEAP[offset | 9] = S9; | |
16623 | HEAP[offset | 10] = SA; | |
16624 | HEAP[offset | 11] = SB; | |
16625 | HEAP[offset | 12] = SC; | |
16626 | HEAP[offset | 13] = SD; | |
16627 | HEAP[offset | 14] = SE; | |
16628 | HEAP[offset | 15] = SF; | |
16629 | offset = offset + 16 | 0; | |
16630 | length = length - 16 | 0; | |
16631 | encrypted = encrypted + 16 | 0; | |
16632 | } | |
16633 | if ((length | 0) > 0) { | |
16634 | _encrypt(S0, S1, S2, S3, S4, S5, S6, S7, S8, S9, SA, SB, SC, SD, SE, SF); | |
16635 | HEAP[offset] = HEAP[offset] ^ S0; | |
16636 | if ((length | 0) > 1) HEAP[offset | 1] = HEAP[offset | 1] ^ S1; | |
16637 | if ((length | 0) > 2) HEAP[offset | 2] = HEAP[offset | 2] ^ S2; | |
16638 | if ((length | 0) > 3) HEAP[offset | 3] = HEAP[offset | 3] ^ S3; | |
16639 | if ((length | 0) > 4) HEAP[offset | 4] = HEAP[offset | 4] ^ S4; | |
16640 | if ((length | 0) > 5) HEAP[offset | 5] = HEAP[offset | 5] ^ S5; | |
16641 | if ((length | 0) > 6) HEAP[offset | 6] = HEAP[offset | 6] ^ S6; | |
16642 | if ((length | 0) > 7) HEAP[offset | 7] = HEAP[offset | 7] ^ S7; | |
16643 | if ((length | 0) > 8) HEAP[offset | 8] = HEAP[offset | 8] ^ S8; | |
16644 | if ((length | 0) > 9) HEAP[offset | 9] = HEAP[offset | 9] ^ S9; | |
16645 | if ((length | 0) > 10) HEAP[offset | 10] = HEAP[offset | 10] ^ SA; | |
16646 | if ((length | 0) > 11) HEAP[offset | 11] = HEAP[offset | 11] ^ SB; | |
16647 | if ((length | 0) > 12) HEAP[offset | 12] = HEAP[offset | 12] ^ SC; | |
16648 | if ((length | 0) > 13) HEAP[offset | 13] = HEAP[offset | 13] ^ SD; | |
16649 | if ((length | 0) > 14) HEAP[offset | 14] = HEAP[offset | 14] ^ SE; | |
16650 | encrypted = encrypted + length | 0; | |
16651 | offset = offset + length | 0; | |
16652 | length = 0; | |
16653 | } | |
16654 | return encrypted | 0; | |
16655 | } | |
16656 | function cfb_decrypt(offset, length) { | |
16657 | offset = offset | 0; | |
16658 | length = length | 0; | |
16659 | 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; | |
16660 | if (offset & 15) return -1; | |
16661 | while ((length | 0) >= 16) { | |
16662 | _encrypt(S0, S1, S2, S3, S4, S5, S6, S7, S8, S9, SA, SB, SC, SD, SE, SF); | |
16663 | iv0 = HEAP[offset] | 0; | |
16664 | iv1 = HEAP[offset | 1] | 0; | |
16665 | iv2 = HEAP[offset | 2] | 0; | |
16666 | iv3 = HEAP[offset | 3] | 0; | |
16667 | iv4 = HEAP[offset | 4] | 0; | |
16668 | iv5 = HEAP[offset | 5] | 0; | |
16669 | iv6 = HEAP[offset | 6] | 0; | |
16670 | iv7 = HEAP[offset | 7] | 0; | |
16671 | iv8 = HEAP[offset | 8] | 0; | |
16672 | iv9 = HEAP[offset | 9] | 0; | |
16673 | ivA = HEAP[offset | 10] | 0; | |
16674 | ivB = HEAP[offset | 11] | 0; | |
16675 | ivC = HEAP[offset | 12] | 0; | |
16676 | ivD = HEAP[offset | 13] | 0; | |
16677 | ivE = HEAP[offset | 14] | 0; | |
16678 | ivF = HEAP[offset | 15] | 0; | |
16679 | HEAP[offset] = S0 ^ iv0; | |
16680 | HEAP[offset | 1] = S1 ^ iv1; | |
16681 | HEAP[offset | 2] = S2 ^ iv2; | |
16682 | HEAP[offset | 3] = S3 ^ iv3; | |
16683 | HEAP[offset | 4] = S4 ^ iv4; | |
16684 | HEAP[offset | 5] = S5 ^ iv5; | |
16685 | HEAP[offset | 6] = S6 ^ iv6; | |
16686 | HEAP[offset | 7] = S7 ^ iv7; | |
16687 | HEAP[offset | 8] = S8 ^ iv8; | |
16688 | HEAP[offset | 9] = S9 ^ iv9; | |
16689 | HEAP[offset | 10] = SA ^ ivA; | |
16690 | HEAP[offset | 11] = SB ^ ivB; | |
16691 | HEAP[offset | 12] = SC ^ ivC; | |
16692 | HEAP[offset | 13] = SD ^ ivD; | |
16693 | HEAP[offset | 14] = SE ^ ivE; | |
16694 | HEAP[offset | 15] = SF ^ ivF; | |
16695 | S0 = iv0; | |
16696 | S1 = iv1; | |
16697 | S2 = iv2; | |
16698 | S3 = iv3; | |
16699 | S4 = iv4; | |
16700 | S5 = iv5; | |
16701 | S6 = iv6; | |
16702 | S7 = iv7; | |
16703 | S8 = iv8; | |
16704 | S9 = iv9; | |
16705 | SA = ivA; | |
16706 | SB = ivB; | |
16707 | SC = ivC; | |
16708 | SD = ivD; | |
16709 | SE = ivE; | |
16710 | SF = ivF; | |
16711 | offset = offset + 16 | 0; | |
16712 | length = length - 16 | 0; | |
16713 | decrypted = decrypted + 16 | 0; | |
16714 | } | |
16715 | if ((length | 0) > 0) { | |
16716 | _encrypt(S0, S1, S2, S3, S4, S5, S6, S7, S8, S9, SA, SB, SC, SD, SE, SF); | |
16717 | HEAP[offset] = HEAP[offset] ^ S0; | |
16718 | if ((length | 0) > 1) HEAP[offset | 1] = HEAP[offset | 1] ^ S1; | |
16719 | if ((length | 0) > 2) HEAP[offset | 2] = HEAP[offset | 2] ^ S2; | |
16720 | if ((length | 0) > 3) HEAP[offset | 3] = HEAP[offset | 3] ^ S3; | |
16721 | if ((length | 0) > 4) HEAP[offset | 4] = HEAP[offset | 4] ^ S4; | |
16722 | if ((length | 0) > 5) HEAP[offset | 5] = HEAP[offset | 5] ^ S5; | |
16723 | if ((length | 0) > 6) HEAP[offset | 6] = HEAP[offset | 6] ^ S6; | |
16724 | if ((length | 0) > 7) HEAP[offset | 7] = HEAP[offset | 7] ^ S7; | |
16725 | if ((length | 0) > 8) HEAP[offset | 8] = HEAP[offset | 8] ^ S8; | |
16726 | if ((length | 0) > 9) HEAP[offset | 9] = HEAP[offset | 9] ^ S9; | |
16727 | if ((length | 0) > 10) HEAP[offset | 10] = HEAP[offset | 10] ^ SA; | |
16728 | if ((length | 0) > 11) HEAP[offset | 11] = HEAP[offset | 11] ^ SB; | |
16729 | if ((length | 0) > 12) HEAP[offset | 12] = HEAP[offset | 12] ^ SC; | |
16730 | if ((length | 0) > 13) HEAP[offset | 13] = HEAP[offset | 13] ^ SD; | |
16731 | if ((length | 0) > 14) HEAP[offset | 14] = HEAP[offset | 14] ^ SE; | |
16732 | decrypted = decrypted + length | 0; | |
16733 | offset = offset + length | 0; | |
16734 | length = 0; | |
16735 | } | |
16736 | return decrypted | 0; | |
16737 | } | |
16738 | return { | |
16739 | init_state: init_state, | |
16740 | save_state: save_state, | |
16741 | init_key_128: init_key_128, | |
16742 | init_key_256: init_key_256, | |
16743 | cbc_encrypt: cbc_encrypt, | |
16744 | cbc_decrypt: cbc_decrypt, | |
16745 | cbc_mac: cbc_mac, | |
16746 | ccm_encrypt: ccm_encrypt, | |
16747 | ccm_decrypt: ccm_decrypt, | |
16748 | cfb_encrypt: cfb_encrypt, | |
16749 | cfb_decrypt: cfb_decrypt | |
16750 | }; | |
16751 | } | |
16752 | function aes_asm(stdlib, foreign, buffer) { | |
16753 | var heap = new Uint8Array(buffer); | |
16754 | heap.set(_aes_tables); | |
16755 | return _aes_asm(stdlib, foreign, buffer); | |
16756 | } | |
16757 | var _aes_block_size = 16; | |
16758 | function _aes_constructor(options) { | |
16759 | options = options || {}; | |
16760 | options.heapSize = options.heapSize || 4096; | |
16761 | if (options.heapSize <= 0 || options.heapSize % 4096) throw new IllegalArgumentError("heapSize must be a positive number and multiple of 4096"); | |
16762 | this.BLOCK_SIZE = _aes_block_size; | |
16763 | this.heap = options.heap || new Uint8Array(options.heapSize); | |
16764 | this.asm = options.asm || aes_asm(global, null, this.heap.buffer); | |
16765 | this.pos = _aes_heap_start; | |
16766 | this.len = 0; | |
16767 | this.key = null; | |
16768 | this.result = null; | |
16769 | this.reset(options); | |
16770 | } | |
16771 | function _aes_reset(options) { | |
16772 | options = options || {}; | |
16773 | this.result = null; | |
16774 | this.pos = _aes_heap_start; | |
16775 | this.len = 0; | |
16776 | var asm = this.asm; | |
16777 | var key = options.key; | |
16778 | if (key !== undefined) { | |
16779 | if (is_buffer(key) || is_bytes(key)) { | |
16780 | key = new Uint8Array(key); | |
16781 | } else if (is_string(key)) { | |
16782 | var str = key; | |
16783 | key = new Uint8Array(str.length); | |
16784 | for (var i = 0; i < str.length; ++i) key[i] = str.charCodeAt(i); | |
16785 | } else { | |
16786 | throw new TypeError("unexpected key type"); | |
16787 | } | |
16788 | if (key.length === 16) { | |
16789 | this.key = key; | |
16790 | 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]); | |
16791 | } else if (key.length === 24) { | |
16792 | throw new IllegalArgumentError("illegal key size"); | |
16793 | } else if (key.length === 32) { | |
16794 | this.key = key; | |
16795 | 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]); | |
16796 | } else { | |
16797 | throw new IllegalArgumentError("illegal key size"); | |
16798 | } | |
16799 | } | |
16800 | return this; | |
16801 | } | |
16802 | function _aes_init_iv(iv) { | |
16803 | var asm = this.asm; | |
16804 | if (iv !== undefined) { | |
16805 | if (is_buffer(iv) || is_bytes(iv)) { | |
16806 | iv = new Uint8Array(iv); | |
16807 | } else if (is_string(iv)) { | |
16808 | var str = iv; | |
16809 | iv = new Uint8Array(str.length); | |
16810 | for (var i = 0; i < str.length; ++i) iv[i] = str.charCodeAt(i); | |
16811 | } else { | |
16812 | throw new TypeError("unexpected iv type"); | |
16813 | } | |
16814 | if (iv.length !== _aes_block_size) throw new IllegalArgumentError("illegal iv size"); | |
16815 | this.iv = iv; | |
16816 | 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]); | |
16817 | } else { | |
16818 | this.iv = null; | |
16819 | asm.init_state.call(asm, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); | |
16820 | } | |
16821 | } | |
16822 | function _aes_heap_write(heap, hpos, data, dpos, dlen) { | |
16823 | var hlen = heap.byteLength - hpos, wlen = hlen < dlen ? hlen : dlen; | |
16824 | if (is_buffer(data) || is_bytes(data)) { | |
16825 | heap.set(new Uint8Array(data.buffer || data, dpos, wlen), hpos); | |
16826 | } else if (is_string(data)) { | |
16827 | for (var i = 0; i < wlen; ++i) heap[hpos + i] = data.charCodeAt(dpos + i); | |
16828 | } else { | |
16829 | throw new TypeError("unexpected data type"); | |
16830 | } | |
16831 | return wlen; | |
16832 | } | |
16833 | function cbc_aes_constructor(options) { | |
16834 | this.padding = true; | |
16835 | this.mode = "cbc"; | |
16836 | this.iv = null; | |
16837 | _aes_constructor.call(this, options); | |
16838 | } | |
16839 | function cbc_aes_encrypt_constructor(options) { | |
16840 | cbc_aes_constructor.call(this, options); | |
16841 | } | |
16842 | function cbc_aes_decrypt_constructor(options) { | |
16843 | cbc_aes_constructor.call(this, options); | |
16844 | } | |
16845 | function cbc_aes_reset(options) { | |
16846 | options = options || {}; | |
16847 | _aes_reset.call(this, options); | |
16848 | var padding = options.padding; | |
16849 | if (padding !== undefined) { | |
16850 | this.padding = !!padding; | |
16851 | } else { | |
16852 | this.padding = true; | |
16853 | } | |
16854 | _aes_init_iv.call(this, options.iv); | |
16855 | return this; | |
16856 | } | |
16857 | function cbc_aes_encrypt_process(data) { | |
16858 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
16859 | 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; | |
16860 | var result = new Uint8Array(rlen); | |
16861 | while (dlen > 0) { | |
16862 | wlen = _aes_heap_write(heap, pos + len, data, dpos, dlen); | |
16863 | len += wlen; | |
16864 | dpos += wlen; | |
16865 | dlen -= wlen; | |
16866 | wlen = asm.cbc_encrypt(pos, len); | |
16867 | result.set(heap.subarray(pos, pos + wlen), rpos); | |
16868 | rpos += wlen; | |
16869 | if (wlen < len) { | |
16870 | pos += wlen; | |
16871 | len -= wlen; | |
16872 | } else { | |
16873 | pos = _aes_heap_start; | |
16874 | len = 0; | |
16875 | } | |
16876 | } | |
16877 | this.result = result; | |
16878 | this.pos = pos; | |
16879 | this.len = len; | |
16880 | return this; | |
16881 | } | |
16882 | function cbc_aes_encrypt_finish() { | |
16883 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
16884 | 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); | |
16885 | if (len % _aes_block_size === 0) { | |
16886 | if (padding) rlen += _aes_block_size; | |
16887 | } else if (!padding) { | |
16888 | throw new IllegalArgumentError("data length must be a multiple of " + _aes_block_size); | |
16889 | } | |
16890 | var result = new Uint8Array(rlen); | |
16891 | if (len < rlen) { | |
16892 | var plen = _aes_block_size - len % _aes_block_size; | |
16893 | for (var p = 0; p < plen; ++p) heap[pos + len + p] = plen; | |
16894 | len += plen; | |
16895 | } | |
16896 | asm.cbc_encrypt(pos, len); | |
16897 | result.set(heap.subarray(pos, pos + len)); | |
16898 | this.result = result; | |
16899 | this.pos = _aes_heap_start; | |
16900 | this.len = 0; | |
16901 | return this; | |
16902 | } | |
16903 | function cbc_aes_encrypt(data) { | |
16904 | var result1 = cbc_aes_encrypt_process.call(this, data).result, result2 = cbc_aes_encrypt_finish.call(this).result, result; | |
16905 | result = new Uint8Array(result1.length + result2.length); | |
16906 | result.set(result1); | |
16907 | result.set(result2, result1.length); | |
16908 | this.result = result; | |
16909 | return this; | |
16910 | } | |
16911 | function cbc_aes_decrypt_process(data) { | |
16912 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
16913 | 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; | |
16914 | var result = new Uint8Array(rlen); | |
16915 | while (dlen > 0) { | |
16916 | wlen = _aes_heap_write(heap, pos + len, data, dpos, dlen); | |
16917 | len += wlen; | |
16918 | dpos += wlen; | |
16919 | dlen -= wlen; | |
16920 | wlen = asm.cbc_decrypt(pos, len - (padding && dlen === 0 && len % _aes_block_size === 0 ? _aes_block_size : 0)); | |
16921 | result.set(heap.subarray(pos, pos + wlen), rpos); | |
16922 | rpos += wlen; | |
16923 | if (wlen < len) { | |
16924 | pos += wlen; | |
16925 | len -= wlen; | |
16926 | } else { | |
16927 | pos = _aes_heap_start; | |
16928 | len = 0; | |
16929 | } | |
16930 | } | |
16931 | this.result = result.subarray(0, rpos); | |
16932 | this.pos = pos; | |
16933 | this.len = len; | |
16934 | return this; | |
16935 | } | |
16936 | function cbc_aes_decrypt_finish() { | |
16937 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
16938 | var asm = this.asm, heap = this.heap, padding = this.padding, pos = this.pos, len = this.len; | |
16939 | if (len === 0) { | |
16940 | if (!padding) { | |
16941 | this.result = new Uint8Array(0); | |
16942 | this.pos = _aes_heap_start; | |
16943 | this.len = 0; | |
16944 | return this; | |
16945 | } else { | |
16946 | throw new IllegalStateError("padding not found"); | |
16947 | } | |
16948 | } | |
16949 | if (len % _aes_block_size !== 0) throw new IllegalArgumentError("data length must be a multiple of " + _aes_block_size); | |
16950 | var result = new Uint8Array(len); | |
16951 | asm.cbc_decrypt(pos, len); | |
16952 | result.set(heap.subarray(pos, pos + len)); | |
16953 | if (padding) { | |
16954 | var pad = result[len - 1]; | |
16955 | result = result.subarray(0, len - pad); | |
16956 | } | |
16957 | this.result = result; | |
16958 | this.pos = _aes_heap_start; | |
16959 | this.len = 0; | |
16960 | return this; | |
16961 | } | |
16962 | function cbc_aes_decrypt(data) { | |
16963 | var result1 = cbc_aes_decrypt_process.call(this, data).result, result2 = cbc_aes_decrypt_finish.call(this).result, result; | |
16964 | result = new Uint8Array(result1.length + result2.length); | |
16965 | result.set(result1); | |
16966 | result.set(result2, result1.length); | |
16967 | this.result = result; | |
16968 | return this; | |
16969 | } | |
16970 | var cbc_aes_encrypt_prototype = cbc_aes_encrypt_constructor.prototype; | |
16971 | cbc_aes_encrypt_prototype.reset = cbc_aes_reset; | |
16972 | cbc_aes_encrypt_prototype.process = cbc_aes_encrypt_process; | |
16973 | cbc_aes_encrypt_prototype.finish = cbc_aes_encrypt_finish; | |
16974 | var cbc_aes_decrypt_prototype = cbc_aes_decrypt_constructor.prototype; | |
16975 | cbc_aes_decrypt_prototype.reset = cbc_aes_reset; | |
16976 | cbc_aes_decrypt_prototype.process = cbc_aes_decrypt_process; | |
16977 | cbc_aes_decrypt_prototype.finish = cbc_aes_decrypt_finish; | |
16978 | var cbc_aes_prototype = cbc_aes_constructor.prototype; | |
16979 | cbc_aes_prototype.reset = cbc_aes_reset; | |
16980 | cbc_aes_prototype.encrypt = cbc_aes_encrypt; | |
16981 | cbc_aes_prototype.decrypt = cbc_aes_decrypt; | |
16982 | function _cbc_mac_process(data) { | |
16983 | var dpos = data.byteOffset || 0, dlen = data.byteLength || data.length || 0, wlen = 0; | |
16984 | while (dlen > 0) { | |
16985 | wlen = _aes_heap_write(this.heap, _aes_heap_start, data, dpos, dlen); | |
16986 | this.asm.cbc_mac(_aes_heap_start, wlen, -1); | |
16987 | dpos += wlen; | |
16988 | dlen -= wlen; | |
16989 | } | |
16990 | } | |
16991 | var _ccm_adata_maxLength = 65279, _ccm_data_maxLength = 68719476720; | |
16992 | function ccm_aes_constructor(options) { | |
16993 | this.padding = false; | |
16994 | this.mode = "ccm"; | |
16995 | this.tagSize = _aes_block_size; | |
16996 | this.lengthSize = 4; | |
16997 | this.nonce = null; | |
16998 | this.adata = null; | |
16999 | this.iv = null; | |
17000 | this.dataLength = -1; | |
17001 | this.dataLeft = -1; | |
17002 | this.counter = 1; | |
17003 | _aes_constructor.call(this, options); | |
17004 | } | |
17005 | function ccm_aes_encrypt_constructor(options) { | |
17006 | ccm_aes_constructor.call(this, options); | |
17007 | } | |
17008 | function ccm_aes_decrypt_constructor(options) { | |
17009 | ccm_aes_constructor.call(this, options); | |
17010 | } | |
17011 | function _ccm_calculate_iv() { | |
17012 | var nonce = this.nonce, adata = this.adata, tagSize = this.tagSize, lengthSize = this.lengthSize, dataLength = this.dataLength; | |
17013 | var data = new Uint8Array(_aes_block_size + (adata ? 2 + adata.byteLength : 0)); | |
17014 | data[0] = (adata ? 64 : 0) | tagSize - 2 << 2 | lengthSize - 1; | |
17015 | data.set(nonce, 1); | |
17016 | if (lengthSize > 4) data[11] = (dataLength - (dataLength >>> 0)) / 4294967296 & 15; | |
17017 | if (lengthSize > 3) data[12] = dataLength >>> 24; | |
17018 | if (lengthSize > 2) data[13] = dataLength >>> 16 & 255; | |
17019 | data[14] = dataLength >>> 8 & 255; | |
17020 | data[15] = dataLength & 255; | |
17021 | if (adata) { | |
17022 | data[16] = adata.byteLength >>> 8 & 255; | |
17023 | data[17] = adata.byteLength & 255; | |
17024 | data.set(adata, 18); | |
17025 | } | |
17026 | _cbc_mac_process.call(this, data); | |
17027 | this.asm.save_state(_aes_heap_start); | |
17028 | this.iv = new Uint8Array(this.heap.subarray(_aes_heap_start, _aes_heap_start + _aes_block_size)); | |
17029 | } | |
17030 | function ccm_aes_reset(options) { | |
17031 | options = options || {}; | |
17032 | _aes_reset.call(this, options); | |
17033 | _aes_init_iv.call(this, options.iv); | |
17034 | var tagSize = options.tagSize; | |
17035 | if (tagSize !== undefined) { | |
17036 | if (!is_number(tagSize)) throw new TypeError("tagSize must be a number"); | |
17037 | if (tagSize < 4 || tagSize > 16 || tagSize & 1) throw new IllegalArgumentError("illegal tagSize value"); | |
17038 | this.tagSize = tagSize; | |
17039 | } else { | |
17040 | this.tagSize = _aes_block_size; | |
17041 | } | |
17042 | var lengthSize = options.lengthSize, nonce = options.nonce; | |
17043 | if (nonce !== undefined) { | |
17044 | if (is_buffer(nonce) || is_bytes(nonce)) { | |
17045 | nonce = new Uint8Array(nonce); | |
17046 | } else if (is_string(nonce)) { | |
17047 | var str = nonce; | |
17048 | nonce = new Uint8Array(str.length); | |
17049 | for (var i = 0; i < str.length; ++i) nonce[i] = str.charCodeAt(i); | |
17050 | } else { | |
17051 | throw new TypeError("unexpected nonce type"); | |
17052 | } | |
17053 | if (nonce.length < 10 || nonce.length > 13) throw new IllegalArgumentError("illegal nonce length"); | |
17054 | lengthSize = lengthSize || 15 - nonce.length; | |
17055 | this.nonce = nonce; | |
17056 | } else { | |
17057 | this.nonce = null; | |
17058 | } | |
17059 | if (lengthSize !== undefined) { | |
17060 | if (!is_number(lengthSize)) throw new TypeError("lengthSize must be a number"); | |
17061 | if (lengthSize < 2 || lengthSize > 5 || nonce.length + lengthSize !== 15) throw new IllegalArgumentError("illegal lengthSize value"); | |
17062 | this.lengthSize = lengthSize; | |
17063 | } else { | |
17064 | this.lengthSize = lengthSize = 4; | |
17065 | } | |
17066 | var iv = this.iv; | |
17067 | var counter = options.counter; | |
17068 | if (counter !== undefined) { | |
17069 | if (iv === null) throw new IllegalStateError("iv is also required"); | |
17070 | if (!is_number(counter)) throw new TypeError("counter must be a number"); | |
17071 | this.counter = counter; | |
17072 | } else { | |
17073 | this.counter = 1; | |
17074 | } | |
17075 | var dataLength = options.dataLength; | |
17076 | if (dataLength !== undefined) { | |
17077 | if (!is_number(dataLength)) throw new TypeError("dataLength must be a number"); | |
17078 | if (dataLength < 0 || dataLength > _ccm_data_maxLength || dataLength > Math.pow(2, 8 * lengthSize) - 1) throw new IllegalArgumentError("illegal dataLength value"); | |
17079 | this.dataLength = dataLength; | |
17080 | var dataLeft = options.dataLeft || dataLength; | |
17081 | if (!is_number(dataLeft)) throw new TypeError("dataLeft must be a number"); | |
17082 | if (dataLeft < 0 || dataLeft > dataLength) throw new IllegalArgumentError("illegal dataLeft value"); | |
17083 | this.dataLeft = dataLeft; | |
17084 | } else { | |
17085 | this.dataLength = dataLength = -1; | |
17086 | this.dataLeft = dataLength; | |
17087 | } | |
17088 | var adata = options.adata; | |
17089 | if (adata !== undefined) { | |
17090 | if (iv !== null) throw new IllegalStateError("you must specify either adata or iv, not both"); | |
17091 | if (is_buffer(adata) || is_bytes(adata)) { | |
17092 | adata = new Uint8Array(adata); | |
17093 | } else if (is_string(adata)) { | |
17094 | var str = adata; | |
17095 | adata = new Uint8Array(str.length); | |
17096 | for (var i = 0; i < str.length; ++i) adata[i] = str.charCodeAt(i); | |
17097 | } else { | |
17098 | throw new TypeError("unexpected adata type"); | |
17099 | } | |
17100 | if (adata.byteLength === 0 || adata.byteLength > _ccm_adata_maxLength) throw new IllegalArgumentError("illegal adata length"); | |
17101 | this.adata = adata; | |
17102 | this.counter = 1; | |
17103 | } else { | |
17104 | this.adata = adata = null; | |
17105 | } | |
17106 | if (dataLength !== -1) _ccm_calculate_iv.call(this); | |
17107 | return this; | |
17108 | } | |
17109 | function ccm_aes_encrypt_process(data) { | |
17110 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17111 | 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; | |
17112 | if ((counter - 1 << 4) + len + dlen > _ccm_data_maxLength) throw new RangeError("counter overflow"); | |
17113 | var result = new Uint8Array(rlen); | |
17114 | var asm_args = [ 0, 0, this.lengthSize - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; | |
17115 | for (var i = 0; i < nonce.length; i++) asm_args[3 + i] = nonce[i]; | |
17116 | while (dlen > 0) { | |
17117 | wlen = _aes_heap_write(heap, pos + len, data, dpos, dlen); | |
17118 | len += wlen; | |
17119 | dpos += wlen; | |
17120 | dlen -= wlen; | |
17121 | asm_args[0] = pos; | |
17122 | asm_args[1] = len & ~15; | |
17123 | asm_args[16] = counter / 4294967296 >>> 0; | |
17124 | asm_args[17] = counter >>> 0; | |
17125 | wlen = asm.ccm_encrypt.apply(asm, asm_args); | |
17126 | result.set(heap.subarray(pos, pos + wlen), rpos); | |
17127 | counter += wlen >>> 4; | |
17128 | rpos += wlen; | |
17129 | if (wlen < len) { | |
17130 | pos += wlen; | |
17131 | len -= wlen; | |
17132 | } else { | |
17133 | pos = _aes_heap_start; | |
17134 | len = 0; | |
17135 | } | |
17136 | } | |
17137 | this.result = result; | |
17138 | this.counter = counter; | |
17139 | this.pos = pos; | |
17140 | this.len = len; | |
17141 | return this; | |
17142 | } | |
17143 | function ccm_aes_encrypt_finish() { | |
17144 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17145 | var asm = this.asm, heap = this.heap, nonce = this.nonce, counter = this.counter, tagSize = this.tagSize, pos = this.pos, len = this.len, wlen = 0; | |
17146 | var result = new Uint8Array(len + tagSize); | |
17147 | var asm_args = [ 0, 0, this.lengthSize - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; | |
17148 | for (var i = 0; i < nonce.length; i++) asm_args[3 + i] = nonce[i]; | |
17149 | asm_args[0] = pos; | |
17150 | asm_args[1] = len; | |
17151 | asm_args[16] = counter / 4294967296 >>> 0; | |
17152 | asm_args[17] = counter >>> 0; | |
17153 | wlen = asm.ccm_encrypt.apply(asm, asm_args); | |
17154 | result.set(heap.subarray(pos, pos + wlen)); | |
17155 | counter = 1; | |
17156 | pos = _aes_heap_start; | |
17157 | len = 0; | |
17158 | asm.save_state(_aes_heap_start); | |
17159 | asm_args[0] = _aes_heap_start, asm_args[1] = _aes_block_size, asm_args[16] = 0; | |
17160 | asm_args[17] = 0; | |
17161 | asm.ccm_encrypt.apply(asm, asm_args); | |
17162 | result.set(heap.subarray(_aes_heap_start, _aes_heap_start + tagSize), wlen); | |
17163 | this.result = result; | |
17164 | this.counter = counter; | |
17165 | this.pos = pos; | |
17166 | this.len = len; | |
17167 | return this; | |
17168 | } | |
17169 | function ccm_aes_encrypt(data) { | |
17170 | this.dataLength = this.dataLeft = data.byteLength || data.length || 0; | |
17171 | var result1 = ccm_aes_encrypt_process.call(this, data).result, result2 = ccm_aes_encrypt_finish.call(this).result, result; | |
17172 | result = new Uint8Array(result1.length + result2.length); | |
17173 | result.set(result1); | |
17174 | result.set(result2, result1.length); | |
17175 | this.result = result; | |
17176 | return this; | |
17177 | } | |
17178 | function ccm_aes_decrypt_process(data) { | |
17179 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17180 | 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; | |
17181 | if ((counter - 1 << 4) + len + dlen > _ccm_data_maxLength) throw new RangeError("counter overflow"); | |
17182 | var result = new Uint8Array(rlen); | |
17183 | var asm_args = [ 0, 0, this.lengthSize - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; | |
17184 | for (var i = 0; i < nonce.length; i++) asm_args[3 + i] = nonce[i]; | |
17185 | while (dlen > 0) { | |
17186 | wlen = _aes_heap_write(heap, pos + len, data, dpos, dlen); | |
17187 | len += wlen; | |
17188 | dpos += wlen; | |
17189 | dlen -= wlen; | |
17190 | asm_args[0] = pos; | |
17191 | asm_args[1] = len + dlen - tagSize >= _aes_block_size ? dlen >= tagSize ? len & ~15 : len + dlen - tagSize & ~15 : 0; | |
17192 | asm_args[16] = counter / 4294967296 >>> 0; | |
17193 | asm_args[17] = counter >>> 0; | |
17194 | wlen = asm.ccm_decrypt.apply(asm, asm_args); | |
17195 | result.set(heap.subarray(pos, pos + wlen), rpos); | |
17196 | counter += wlen >>> 4; | |
17197 | rpos += wlen; | |
17198 | if (wlen < len) { | |
17199 | pos += wlen; | |
17200 | len -= wlen; | |
17201 | } else { | |
17202 | pos = _aes_heap_start; | |
17203 | len = 0; | |
17204 | } | |
17205 | } | |
17206 | this.result = result.subarray(0, rpos); | |
17207 | this.counter = counter; | |
17208 | this.pos = pos; | |
17209 | this.len = len; | |
17210 | return this; | |
17211 | } | |
17212 | function ccm_aes_decrypt_finish() { | |
17213 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17214 | 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; | |
17215 | if (len < tagSize) throw new IllegalStateError("authentication tag not found"); | |
17216 | var result = new Uint8Array(rlen), atag = new Uint8Array(heap.subarray(pos + rlen, pos + len)); | |
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] = rlen; | |
17221 | asm_args[16] = counter / 4294967296 >>> 0; | |
17222 | asm_args[17] = counter >>> 0; | |
17223 | wlen = asm.ccm_decrypt.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 | var acheck = 0; | |
17233 | for (var i = 0; i < tagSize; ++i) acheck |= atag[i] ^ heap[_aes_heap_start + i]; | |
17234 | if (acheck) throw new SecurityError("data integrity check failed"); | |
17235 | this.result = result; | |
17236 | this.counter = counter; | |
17237 | this.pos = pos; | |
17238 | this.len = len; | |
17239 | return this; | |
17240 | } | |
17241 | function ccm_aes_decrypt(data) { | |
17242 | this.dataLength = this.dataLeft = data.byteLength || data.length || 0; | |
17243 | var result1 = ccm_aes_decrypt_process.call(this, data).result, result2 = ccm_aes_decrypt_finish.call(this).result, result; | |
17244 | result = new Uint8Array(result1.length + result2.length); | |
17245 | result.set(result1); | |
17246 | result.set(result2, result1.length); | |
17247 | this.result = result; | |
17248 | return this; | |
17249 | } | |
17250 | var ccm_aes_prototype = ccm_aes_constructor.prototype; | |
17251 | ccm_aes_prototype.reset = ccm_aes_reset; | |
17252 | ccm_aes_prototype.encrypt = ccm_aes_encrypt; | |
17253 | ccm_aes_prototype.decrypt = ccm_aes_decrypt; | |
17254 | var ccm_aes_encrypt_prototype = ccm_aes_encrypt_constructor.prototype; | |
17255 | ccm_aes_encrypt_prototype.reset = ccm_aes_reset; | |
17256 | ccm_aes_encrypt_prototype.process = ccm_aes_encrypt_process; | |
17257 | ccm_aes_encrypt_prototype.finish = ccm_aes_encrypt_finish; | |
17258 | var ccm_aes_decrypt_prototype = ccm_aes_decrypt_constructor.prototype; | |
17259 | ccm_aes_decrypt_prototype.reset = ccm_aes_reset; | |
17260 | ccm_aes_decrypt_prototype.process = ccm_aes_decrypt_process; | |
17261 | ccm_aes_decrypt_prototype.finish = ccm_aes_decrypt_finish; | |
17262 | function cfb_aes_constructor(options) { | |
17263 | this.padding = false; | |
17264 | this.mode = "cfb"; | |
17265 | this.iv = null; | |
17266 | _aes_constructor.call(this, options); | |
17267 | } | |
17268 | function cfb_aes_encrypt_constructor(options) { | |
17269 | cfb_aes_constructor.call(this, options); | |
17270 | } | |
17271 | function cfb_aes_decrypt_constructor(options) { | |
17272 | cfb_aes_constructor.call(this, options); | |
17273 | } | |
17274 | function cfb_aes_reset(options) { | |
17275 | options = options || {}; | |
17276 | _aes_reset.call(this, options); | |
17277 | _aes_init_iv.call(this, options.iv); | |
17278 | return this; | |
17279 | } | |
17280 | function cfb_aes_encrypt_process(data) { | |
17281 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17282 | 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; | |
17283 | var result = new Uint8Array(rlen); | |
17284 | while (dlen > 0) { | |
17285 | wlen = _aes_heap_write(heap, pos + len, data, dpos, dlen); | |
17286 | len += wlen; | |
17287 | dpos += wlen; | |
17288 | dlen -= wlen; | |
17289 | wlen = asm.cfb_encrypt(pos, _aes_block_size * Math.floor(len / _aes_block_size)); | |
17290 | result.set(heap.subarray(pos, pos + wlen), rpos); | |
17291 | rpos += wlen; | |
17292 | if (wlen < len) { | |
17293 | pos += wlen; | |
17294 | len -= wlen; | |
17295 | } else { | |
17296 | pos = _aes_heap_start; | |
17297 | len = 0; | |
17298 | } | |
17299 | } | |
17300 | this.result = result; | |
17301 | this.pos = pos; | |
17302 | this.len = len; | |
17303 | return this; | |
17304 | } | |
17305 | function cfb_aes_encrypt_finish() { | |
17306 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17307 | var asm = this.asm, heap = this.heap, pos = this.pos, len = this.len; | |
17308 | var result = new Uint8Array(len); | |
17309 | asm.cfb_encrypt(pos, len); | |
17310 | result.set(heap.subarray(pos, pos + len)); | |
17311 | this.result = result; | |
17312 | this.pos = _aes_heap_start; | |
17313 | this.len = 0; | |
17314 | return this; | |
17315 | } | |
17316 | function cfb_aes_encrypt(data) { | |
17317 | var result1 = cfb_aes_encrypt_process.call(this, data).result, result2 = cfb_aes_encrypt_finish.call(this).result, result; | |
17318 | result = new Uint8Array(result1.length + result2.length); | |
17319 | result.set(result1); | |
17320 | result.set(result2, result1.length); | |
17321 | this.result = result; | |
17322 | return this; | |
17323 | } | |
17324 | function cfb_aes_decrypt_process(data) { | |
17325 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17326 | 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; | |
17327 | var result = new Uint8Array(rlen); | |
17328 | while (dlen > 0) { | |
17329 | wlen = _aes_heap_write(heap, pos + len, data, dpos, dlen); | |
17330 | len += wlen; | |
17331 | dpos += wlen; | |
17332 | dlen -= wlen; | |
17333 | wlen = asm.cfb_decrypt(pos, _aes_block_size * Math.floor(len / _aes_block_size)); | |
17334 | result.set(heap.subarray(pos, pos + wlen), rpos); | |
17335 | rpos += wlen; | |
17336 | if (wlen < len) { | |
17337 | pos += wlen; | |
17338 | len -= wlen; | |
17339 | } else { | |
17340 | pos = _aes_heap_start; | |
17341 | len = 0; | |
17342 | } | |
17343 | } | |
17344 | this.result = result.subarray(0, rpos); | |
17345 | this.pos = pos; | |
17346 | this.len = len; | |
17347 | return this; | |
17348 | } | |
17349 | function cfb_aes_decrypt_finish() { | |
17350 | if (!this.key) throw new IllegalStateError("no key is associated with the instance"); | |
17351 | var asm = this.asm, heap = this.heap, pos = this.pos, len = this.len; | |
17352 | if (len === 0) { | |
17353 | this.result = new Uint8Array(0); | |
17354 | this.pos = _aes_heap_start; | |
17355 | this.len = 0; | |
17356 | return this; | |
17357 | } | |
17358 | var result = new Uint8Array(len); | |
17359 | asm.cfb_decrypt(pos, len); | |
17360 | result.set(heap.subarray(pos, pos + len)); | |
17361 | this.result = result; | |
17362 | this.pos = _aes_heap_start; | |
17363 | this.len = 0; | |
17364 | return this; | |
17365 | } | |
17366 | function cfb_aes_decrypt(data) { | |
17367 | var result1 = cfb_aes_decrypt_process.call(this, data).result, result2 = cfb_aes_decrypt_finish.call(this).result, result; | |
17368 | result = new Uint8Array(result1.length + result2.length); | |
17369 | result.set(result1); | |
17370 | result.set(result2, result1.length); | |
17371 | this.result = result; | |
17372 | return this; | |
17373 | } | |
17374 | var cfb_aes_encrypt_prototype = cfb_aes_encrypt_constructor.prototype; | |
17375 | cfb_aes_encrypt_prototype.reset = cfb_aes_reset; | |
17376 | cfb_aes_encrypt_prototype.process = cfb_aes_encrypt_process; | |
17377 | cfb_aes_encrypt_prototype.finish = cfb_aes_encrypt_finish; | |
17378 | var cfb_aes_decrypt_prototype = cfb_aes_decrypt_constructor.prototype; | |
17379 | cfb_aes_decrypt_prototype.reset = cfb_aes_reset; | |
17380 | cfb_aes_decrypt_prototype.process = cfb_aes_decrypt_process; | |
17381 | cfb_aes_decrypt_prototype.finish = cfb_aes_decrypt_finish; | |
17382 | var cfb_aes_prototype = cfb_aes_constructor.prototype; | |
17383 | cfb_aes_prototype.reset = cfb_aes_reset; | |
17384 | cfb_aes_prototype.encrypt = cfb_aes_encrypt; | |
17385 | cfb_aes_prototype.decrypt = cfb_aes_decrypt; | |
17386 | function sha256_asm(stdlib, foreign, buffer) { | |
17387 | // Closure Compiler warning - commented out | |
17388 | //"use asm"; | |
17389 | var H0 = 0, H1 = 0, H2 = 0, H3 = 0, H4 = 0, H5 = 0, H6 = 0, H7 = 0, TOTAL = 0; | |
17390 | 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; | |
17391 | var HEAP = new stdlib.Uint8Array(buffer); | |
17392 | function _core(w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15) { | |
17393 | w0 = w0 | 0; | |
17394 | w1 = w1 | 0; | |
17395 | w2 = w2 | 0; | |
17396 | w3 = w3 | 0; | |
17397 | w4 = w4 | 0; | |
17398 | w5 = w5 | 0; | |
17399 | w6 = w6 | 0; | |
17400 | w7 = w7 | 0; | |
17401 | w8 = w8 | 0; | |
17402 | w9 = w9 | 0; | |
17403 | w10 = w10 | 0; | |
17404 | w11 = w11 | 0; | |
17405 | w12 = w12 | 0; | |
17406 | w13 = w13 | 0; | |
17407 | w14 = w14 | 0; | |
17408 | w15 = w15 | 0; | |
17409 | var a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, t = 0; | |
17410 | a = H0; | |
17411 | b = H1; | |
17412 | c = H2; | |
17413 | d = H3; | |
17414 | e = H4; | |
17415 | f = H5; | |
17416 | g = H6; | |
17417 | h = H7; | |
17418 | t = w0 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1116352408 | 0; | |
17419 | h = g; | |
17420 | g = f; | |
17421 | f = e; | |
17422 | e = d + t | 0; | |
17423 | d = c; | |
17424 | c = b; | |
17425 | b = a; | |
17426 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17427 | t = w1 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1899447441 | 0; | |
17428 | h = g; | |
17429 | g = f; | |
17430 | f = e; | |
17431 | e = d + t | 0; | |
17432 | d = c; | |
17433 | c = b; | |
17434 | b = a; | |
17435 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17436 | t = w2 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3049323471 | 0; | |
17437 | h = g; | |
17438 | g = f; | |
17439 | f = e; | |
17440 | e = d + t | 0; | |
17441 | d = c; | |
17442 | c = b; | |
17443 | b = a; | |
17444 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17445 | t = w3 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3921009573 | 0; | |
17446 | h = g; | |
17447 | g = f; | |
17448 | f = e; | |
17449 | e = d + t | 0; | |
17450 | d = c; | |
17451 | c = b; | |
17452 | b = a; | |
17453 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17454 | t = w4 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 961987163 | 0; | |
17455 | h = g; | |
17456 | g = f; | |
17457 | f = e; | |
17458 | e = d + t | 0; | |
17459 | d = c; | |
17460 | c = b; | |
17461 | b = a; | |
17462 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17463 | t = w5 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1508970993 | 0; | |
17464 | h = g; | |
17465 | g = f; | |
17466 | f = e; | |
17467 | e = d + t | 0; | |
17468 | d = c; | |
17469 | c = b; | |
17470 | b = a; | |
17471 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17472 | t = w6 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2453635748 | 0; | |
17473 | h = g; | |
17474 | g = f; | |
17475 | f = e; | |
17476 | e = d + t | 0; | |
17477 | d = c; | |
17478 | c = b; | |
17479 | b = a; | |
17480 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17481 | t = w7 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2870763221 | 0; | |
17482 | h = g; | |
17483 | g = f; | |
17484 | f = e; | |
17485 | e = d + t | 0; | |
17486 | d = c; | |
17487 | c = b; | |
17488 | b = a; | |
17489 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17490 | t = w8 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3624381080 | 0; | |
17491 | h = g; | |
17492 | g = f; | |
17493 | f = e; | |
17494 | e = d + t | 0; | |
17495 | d = c; | |
17496 | c = b; | |
17497 | b = a; | |
17498 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17499 | t = w9 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 310598401 | 0; | |
17500 | h = g; | |
17501 | g = f; | |
17502 | f = e; | |
17503 | e = d + t | 0; | |
17504 | d = c; | |
17505 | c = b; | |
17506 | b = a; | |
17507 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17508 | t = w10 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 607225278 | 0; | |
17509 | h = g; | |
17510 | g = f; | |
17511 | f = e; | |
17512 | e = d + t | 0; | |
17513 | d = c; | |
17514 | c = b; | |
17515 | b = a; | |
17516 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17517 | t = w11 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1426881987 | 0; | |
17518 | h = g; | |
17519 | g = f; | |
17520 | f = e; | |
17521 | e = d + t | 0; | |
17522 | d = c; | |
17523 | c = b; | |
17524 | b = a; | |
17525 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17526 | t = w12 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1925078388 | 0; | |
17527 | h = g; | |
17528 | g = f; | |
17529 | f = e; | |
17530 | e = d + t | 0; | |
17531 | d = c; | |
17532 | c = b; | |
17533 | b = a; | |
17534 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17535 | t = w13 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2162078206 | 0; | |
17536 | h = g; | |
17537 | g = f; | |
17538 | f = e; | |
17539 | e = d + t | 0; | |
17540 | d = c; | |
17541 | c = b; | |
17542 | b = a; | |
17543 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17544 | t = w14 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2614888103 | 0; | |
17545 | h = g; | |
17546 | g = f; | |
17547 | f = e; | |
17548 | e = d + t | 0; | |
17549 | d = c; | |
17550 | c = b; | |
17551 | b = a; | |
17552 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17553 | t = w15 + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3248222580 | 0; | |
17554 | h = g; | |
17555 | g = f; | |
17556 | f = e; | |
17557 | e = d + t | 0; | |
17558 | d = c; | |
17559 | c = b; | |
17560 | b = a; | |
17561 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17562 | 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; | |
17563 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3835390401 | 0; | |
17564 | h = g; | |
17565 | g = f; | |
17566 | f = e; | |
17567 | e = d + t | 0; | |
17568 | d = c; | |
17569 | c = b; | |
17570 | b = a; | |
17571 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17572 | 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; | |
17573 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 4022224774 | 0; | |
17574 | h = g; | |
17575 | g = f; | |
17576 | f = e; | |
17577 | e = d + t | 0; | |
17578 | d = c; | |
17579 | c = b; | |
17580 | b = a; | |
17581 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17582 | 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; | |
17583 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 264347078 | 0; | |
17584 | h = g; | |
17585 | g = f; | |
17586 | f = e; | |
17587 | e = d + t | 0; | |
17588 | d = c; | |
17589 | c = b; | |
17590 | b = a; | |
17591 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17592 | 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; | |
17593 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 604807628 | 0; | |
17594 | h = g; | |
17595 | g = f; | |
17596 | f = e; | |
17597 | e = d + t | 0; | |
17598 | d = c; | |
17599 | c = b; | |
17600 | b = a; | |
17601 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17602 | 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; | |
17603 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 770255983 | 0; | |
17604 | h = g; | |
17605 | g = f; | |
17606 | f = e; | |
17607 | e = d + t | 0; | |
17608 | d = c; | |
17609 | c = b; | |
17610 | b = a; | |
17611 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17612 | 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; | |
17613 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1249150122 | 0; | |
17614 | h = g; | |
17615 | g = f; | |
17616 | f = e; | |
17617 | e = d + t | 0; | |
17618 | d = c; | |
17619 | c = b; | |
17620 | b = a; | |
17621 | a = t + (b & c ^ d & (b ^ c)) + (b >>> 2 ^ b >>> 13 ^ b >>> 22 ^ b << 30 ^ b << 19 ^ b << 10) | 0; | |
17622 | 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; | |
17623 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1555081692 | 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 | 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; | |
17633 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1996064986 | 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 | 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; | |
17643 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2554220882 | 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 | 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; | |
17653 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2821834349 | 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 | 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; | |
17663 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2952996808 | 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 | 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; | |
17673 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3210313671 | 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 | 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; | |
17683 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3336571891 | 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 | 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; | |
17693 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3584528711 | 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 | 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; | |
17703 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 113926993 | 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 | 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; | |
17713 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 338241895 | 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 | 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; | |
17723 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 666307205 | 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 | 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; | |
17733 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 773529912 | 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 | 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; | |
17743 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1294757372 | 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 | 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; | |
17753 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1396182291 | 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 | 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; | |
17763 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1695183700 | 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 | 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; | |
17773 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1986661051 | 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 | 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; | |
17783 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2177026350 | 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 | 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; | |
17793 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2456956037 | 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 | 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; | |
17803 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2730485921 | 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 | 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; | |
17813 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2820302411 | 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 | 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; | |
17823 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3259730800 | 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 | 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; | |
17833 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3345764771 | 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 | 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; | |
17843 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3516065817 | 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 | 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; | |
17853 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3600352804 | 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 | 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; | |
17863 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 4094571909 | 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 | 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; | |
17873 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 275423344 | 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 | 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; | |
17883 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 430227734 | 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 | 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; | |
17893 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 506948616 | 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 | 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; | |
17903 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 659060556 | 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 | 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; | |
17913 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 883997877 | 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 | 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; | |
17923 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 958139571 | 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 | 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; | |
17933 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1322822218 | 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 | 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; | |
17943 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1537002063 | 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 | 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; | |
17953 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1747873779 | 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 | 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; | |
17963 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 1955562222 | 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 | 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; | |
17973 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2024104815 | 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 | 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; | |
17983 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2227730452 | 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 | 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; | |
17993 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2361852424 | 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 | 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; | |
18003 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2428436474 | 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 | 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; | |
18013 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 2756734187 | 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 | 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; | |
18023 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3204031479 | 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 | 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; | |
18033 | t = t + h + (e >>> 6 ^ e >>> 11 ^ e >>> 25 ^ e << 26 ^ e << 21 ^ e << 7) + (g ^ e & (f ^ g)) + 3329325298 | 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 | H0 = H0 + a | 0; | |
18043 | H1 = H1 + b | 0; | |
18044 | H2 = H2 + c | 0; | |
18045 | H3 = H3 + d | 0; | |
18046 | H4 = H4 + e | 0; | |
18047 | H5 = H5 + f | 0; | |
18048 | H6 = H6 + g | 0; | |
18049 | H7 = H7 + h | 0; | |
18050 | } | |
18051 | function _core_heap(offset) { | |
18052 | offset = offset | 0; | |
18053 | _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]); | |
18054 | } | |
18055 | function _state_to_heap(output) { | |
18056 | output = output | 0; | |
18057 | HEAP[output | 0] = H0 >>> 24; | |
18058 | HEAP[output | 1] = H0 >>> 16 & 255; | |
18059 | HEAP[output | 2] = H0 >>> 8 & 255; | |
18060 | HEAP[output | 3] = H0 & 255; | |
18061 | HEAP[output | 4] = H1 >>> 24; | |
18062 | HEAP[output | 5] = H1 >>> 16 & 255; | |
18063 | HEAP[output | 6] = H1 >>> 8 & 255; | |
18064 | HEAP[output | 7] = H1 & 255; | |
18065 | HEAP[output | 8] = H2 >>> 24; | |
18066 | HEAP[output | 9] = H2 >>> 16 & 255; | |
18067 | HEAP[output | 10] = H2 >>> 8 & 255; | |
18068 | HEAP[output | 11] = H2 & 255; | |
18069 | HEAP[output | 12] = H3 >>> 24; | |
18070 | HEAP[output | 13] = H3 >>> 16 & 255; | |
18071 | HEAP[output | 14] = H3 >>> 8 & 255; | |
18072 | HEAP[output | 15] = H3 & 255; | |
18073 | HEAP[output | 16] = H4 >>> 24; | |
18074 | HEAP[output | 17] = H4 >>> 16 & 255; | |
18075 | HEAP[output | 18] = H4 >>> 8 & 255; | |
18076 | HEAP[output | 19] = H4 & 255; | |
18077 | HEAP[output | 20] = H5 >>> 24; | |
18078 | HEAP[output | 21] = H5 >>> 16 & 255; | |
18079 | HEAP[output | 22] = H5 >>> 8 & 255; | |
18080 | HEAP[output | 23] = H5 & 255; | |
18081 | HEAP[output | 24] = H6 >>> 24; | |
18082 | HEAP[output | 25] = H6 >>> 16 & 255; | |
18083 | HEAP[output | 26] = H6 >>> 8 & 255; | |
18084 | HEAP[output | 27] = H6 & 255; | |
18085 | HEAP[output | 28] = H7 >>> 24; | |
18086 | HEAP[output | 29] = H7 >>> 16 & 255; | |
18087 | HEAP[output | 30] = H7 >>> 8 & 255; | |
18088 | HEAP[output | 31] = H7 & 255; | |
18089 | } | |
18090 | function reset() { | |
18091 | H0 = 1779033703; | |
18092 | H1 = 3144134277; | |
18093 | H2 = 1013904242; | |
18094 | H3 = 2773480762; | |
18095 | H4 = 1359893119; | |
18096 | H5 = 2600822924; | |
18097 | H6 = 528734635; | |
18098 | H7 = 1541459225; | |
18099 | TOTAL = 0; | |
18100 | } | |
18101 | function init(h0, h1, h2, h3, h4, h5, h6, h7, total) { | |
18102 | h0 = h0 | 0; | |
18103 | h1 = h1 | 0; | |
18104 | h2 = h2 | 0; | |
18105 | h3 = h3 | 0; | |
18106 | h4 = h4 | 0; | |
18107 | h5 = h5 | 0; | |
18108 | h6 = h6 | 0; | |
18109 | h7 = h7 | 0; | |
18110 | total = total | 0; | |
18111 | H0 = h0; | |
18112 | H1 = h1; | |
18113 | H2 = h2; | |
18114 | H3 = h3; | |
18115 | H4 = h4; | |
18116 | H5 = h5; | |
18117 | H6 = h6; | |
18118 | H7 = h7; | |
18119 | TOTAL = total; | |
18120 | } | |
18121 | function process(offset, length) { | |
18122 | offset = offset | 0; | |
18123 | length = length | 0; | |
18124 | var hashed = 0; | |
18125 | if (offset & 63) return -1; | |
18126 | while ((length | 0) >= 64) { | |
18127 | _core_heap(offset); | |
18128 | offset = offset + 64 | 0; | |
18129 | length = length - 64 | 0; | |
18130 | hashed = hashed + 64 | 0; | |
18131 | } | |
18132 | TOTAL = TOTAL + hashed | 0; | |
18133 | return hashed | 0; | |
18134 | } | |
18135 | function finish(offset, length, output) { | |
18136 | offset = offset | 0; | |
18137 | length = length | 0; | |
18138 | output = output | 0; | |
18139 | var hashed = 0, i = 0; | |
18140 | if (offset & 63) return -1; | |
18141 | if (~output) if (output & 31) return -1; | |
18142 | if ((length | 0) >= 64) { | |
18143 | hashed = process(offset, length) | 0; | |
18144 | if ((hashed | 0) == -1) return -1; | |
18145 | offset = offset + hashed | 0; | |
18146 | length = length - hashed | 0; | |
18147 | } | |
18148 | hashed = hashed + length | 0; | |
18149 | TOTAL = TOTAL + length | 0; | |
18150 | HEAP[offset | length] = 128; | |
18151 | if ((length | 0) >= 56) { | |
18152 | for (i = length + 1 | 0; (i | 0) < 64; i = i + 1 | 0) HEAP[offset | i] = 0; | |
18153 | _core_heap(offset); | |
18154 | length = 0; | |
18155 | HEAP[offset | 0] = 0; | |
18156 | } | |
18157 | for (i = length + 1 | 0; (i | 0) < 59; i = i + 1 | 0) HEAP[offset | i] = 0; | |
18158 | HEAP[offset | 59] = TOTAL >>> 29; | |
18159 | HEAP[offset | 60] = TOTAL >>> 21 & 255; | |
18160 | HEAP[offset | 61] = TOTAL >>> 13 & 255; | |
18161 | HEAP[offset | 62] = TOTAL >>> 5 & 255; | |
18162 | HEAP[offset | 63] = TOTAL << 3 & 255; | |
18163 | _core_heap(offset); | |
18164 | if (~output) _state_to_heap(output); | |
18165 | return hashed | 0; | |
18166 | } | |
18167 | function hmac_reset() { | |
18168 | H0 = I0; | |
18169 | H1 = I1; | |
18170 | H2 = I2; | |
18171 | H3 = I3; | |
18172 | H4 = I4; | |
18173 | H5 = I5; | |
18174 | H6 = I6; | |
18175 | H7 = I7; | |
18176 | TOTAL = 64; | |
18177 | } | |
18178 | function _hmac_opad() { | |
18179 | H0 = O0; | |
18180 | H1 = O1; | |
18181 | H2 = O2; | |
18182 | H3 = O3; | |
18183 | H4 = O4; | |
18184 | H5 = O5; | |
18185 | H6 = O6; | |
18186 | H7 = O7; | |
18187 | TOTAL = 64; | |
18188 | } | |
18189 | function hmac_init(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15) { | |
18190 | p0 = p0 | 0; | |
18191 | p1 = p1 | 0; | |
18192 | p2 = p2 | 0; | |
18193 | p3 = p3 | 0; | |
18194 | p4 = p4 | 0; | |
18195 | p5 = p5 | 0; | |
18196 | p6 = p6 | 0; | |
18197 | p7 = p7 | 0; | |
18198 | p8 = p8 | 0; | |
18199 | p9 = p9 | 0; | |
18200 | p10 = p10 | 0; | |
18201 | p11 = p11 | 0; | |
18202 | p12 = p12 | 0; | |
18203 | p13 = p13 | 0; | |
18204 | p14 = p14 | 0; | |
18205 | p15 = p15 | 0; | |
18206 | reset(); | |
18207 | _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); | |
18208 | O0 = H0; | |
18209 | O1 = H1; | |
18210 | O2 = H2; | |
18211 | O3 = H3; | |
18212 | O4 = H4; | |
18213 | O5 = H5; | |
18214 | O6 = H6; | |
18215 | O7 = H7; | |
18216 | reset(); | |
18217 | _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); | |
18218 | I0 = H0; | |
18219 | I1 = H1; | |
18220 | I2 = H2; | |
18221 | I3 = H3; | |
18222 | I4 = H4; | |
18223 | I5 = H5; | |
18224 | I6 = H6; | |
18225 | I7 = H7; | |
18226 | TOTAL = 64; | |
18227 | } | |
18228 | function hmac_finish(offset, length, output) { | |
18229 | offset = offset | 0; | |
18230 | length = length | 0; | |
18231 | output = output | 0; | |
18232 | var t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, hashed = 0; | |
18233 | if (offset & 63) return -1; | |
18234 | if (~output) if (output & 31) return -1; | |
18235 | hashed = finish(offset, length, -1) | 0; | |
18236 | t0 = H0, t1 = H1, t2 = H2, t3 = H3, t4 = H4, t5 = H5, t6 = H6, t7 = H7; | |
18237 | _hmac_opad(); | |
18238 | _core(t0, t1, t2, t3, t4, t5, t6, t7, 2147483648, 0, 0, 0, 0, 0, 0, 768); | |
18239 | if (~output) _state_to_heap(output); | |
18240 | return hashed | 0; | |
18241 | } | |
18242 | function pbkdf2_generate_block(offset, length, block, count, output) { | |
18243 | offset = offset | 0; | |
18244 | length = length | 0; | |
18245 | block = block | 0; | |
18246 | count = count | 0; | |
18247 | output = output | 0; | |
18248 | 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; | |
18249 | if (offset & 63) return -1; | |
18250 | if (~output) if (output & 31) return -1; | |
18251 | HEAP[offset + length | 0] = block >>> 24; | |
18252 | HEAP[offset + length + 1 | 0] = block >>> 16 & 255; | |
18253 | HEAP[offset + length + 2 | 0] = block >>> 8 & 255; | |
18254 | HEAP[offset + length + 3 | 0] = block & 255; | |
18255 | // Closure compiler warning - The result of the 'bitor' operator is not being used | |
18256 | //hmac_finish(offset, length + 4 | 0, -1) | 0; | |
18257 | hmac_finish(offset, length + 4 | 0, -1); | |
18258 | h0 = t0 = H0, h1 = t1 = H1, h2 = t2 = H2, h3 = t3 = H3, h4 = t4 = H4, h5 = t5 = H5, | |
18259 | h6 = t6 = H6, h7 = t7 = H7; | |
18260 | count = count - 1 | 0; | |
18261 | while ((count | 0) > 0) { | |
18262 | hmac_reset(); | |
18263 | _core(t0, t1, t2, t3, t4, t5, t6, t7, 2147483648, 0, 0, 0, 0, 0, 0, 768); | |
18264 | t0 = H0, t1 = H1, t2 = H2, t3 = H3, t4 = H4, t5 = H5, t6 = H6, t7 = H7; | |
18265 | _hmac_opad(); | |
18266 | _core(t0, t1, t2, t3, t4, t5, t6, t7, 2147483648, 0, 0, 0, 0, 0, 0, 768); | |
18267 | t0 = H0, t1 = H1, t2 = H2, t3 = H3, t4 = H4, t5 = H5, t6 = H6, t7 = H7; | |
18268 | h0 = h0 ^ H0; | |
18269 | h1 = h1 ^ H1; | |
18270 | h2 = h2 ^ H2; | |
18271 | h3 = h3 ^ H3; | |
18272 | h4 = h4 ^ H4; | |
18273 | h5 = h5 ^ H5; | |
18274 | h6 = h6 ^ H6; | |
18275 | h7 = h7 ^ H7; | |
18276 | count = count - 1 | 0; | |
18277 | } | |
18278 | H0 = h0; | |
18279 | H1 = h1; | |
18280 | H2 = h2; | |
18281 | H3 = h3; | |
18282 | H4 = h4; | |
18283 | H5 = h5; | |
18284 | H6 = h6; | |
18285 | H7 = h7; | |
18286 | if (~output) _state_to_heap(output); | |
18287 | return 0; | |
18288 | } | |
18289 | return { | |
18290 | reset: reset, | |
18291 | init: init, | |
18292 | process: process, | |
18293 | finish: finish, | |
18294 | hmac_reset: hmac_reset, | |
18295 | hmac_init: hmac_init, | |
18296 | hmac_finish: hmac_finish, | |
18297 | pbkdf2_generate_block: pbkdf2_generate_block | |
18298 | }; | |
18299 | } | |
18300 | var _sha256_block_size = 64, _sha256_hash_size = 32; | |
18301 | function sha256_constructor(options) { | |
18302 | options = options || {}; | |
18303 | options.heapSize = options.heapSize || 4096; | |
18304 | if (options.heapSize <= 0 || options.heapSize % 4096) throw new IllegalArgumentError("heapSize must be a positive number and multiple of 4096"); | |
18305 | this.heap = options.heap || new Uint8Array(options.heapSize); | |
18306 | this.asm = options.asm || sha256_asm(global, null, this.heap.buffer); | |
18307 | this.BLOCK_SIZE = _sha256_block_size; | |
18308 | this.HASH_SIZE = _sha256_hash_size; | |
18309 | this.reset(); | |
18310 | } | |
18311 | function sha256_reset() { | |
18312 | this.result = null; | |
18313 | this.pos = 0; | |
18314 | this.len = 0; | |
18315 | this.asm.reset(); | |
18316 | return this; | |
18317 | } | |
18318 | function sha256_process(data) { | |
18319 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
18320 | var dpos = 0, dlen = 0, clen = 0; | |
18321 | if (is_buffer(data) || is_bytes(data)) { | |
18322 | dpos = data.byteOffset || 0; | |
18323 | dlen = data.byteLength; | |
18324 | } else if (is_string(data)) { | |
18325 | dlen = data.length; | |
18326 | } else { | |
18327 | throw new TypeError("data isn't of expected type"); | |
18328 | } | |
18329 | while (dlen > 0) { | |
18330 | clen = this.heap.byteLength - this.pos - this.len; | |
18331 | clen = clen < dlen ? clen : dlen; | |
18332 | if (is_buffer(data) || is_bytes(data)) { | |
18333 | this.heap.set(new Uint8Array(data.buffer || data, dpos, clen), this.pos + this.len); | |
18334 | } else { | |
18335 | for (var i = 0; i < clen; i++) this.heap[this.pos + this.len + i] = data.charCodeAt(dpos + i); | |
18336 | } | |
18337 | this.len += clen; | |
18338 | dpos += clen; | |
18339 | dlen -= clen; | |
18340 | clen = this.asm.process(this.pos, this.len); | |
18341 | if (clen < this.len) { | |
18342 | this.pos += clen; | |
18343 | this.len -= clen; | |
18344 | } else { | |
18345 | this.pos = 0; | |
18346 | this.len = 0; | |
18347 | } | |
18348 | } | |
18349 | return this; | |
18350 | } | |
18351 | function sha256_finish() { | |
18352 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
18353 | this.asm.finish(this.pos, this.len, 0); | |
18354 | this.result = new Uint8Array(_sha256_hash_size); | |
18355 | this.result.set(this.heap.subarray(0, _sha256_hash_size)); | |
18356 | this.pos = 0; | |
18357 | this.len = 0; | |
18358 | return this; | |
18359 | } | |
18360 | sha256_constructor.BLOCK_SIZE = _sha256_block_size; | |
18361 | sha256_constructor.HASH_SIZE = _sha256_hash_size; | |
18362 | var sha256_prototype = sha256_constructor.prototype; | |
18363 | sha256_prototype.reset = sha256_reset; | |
18364 | sha256_prototype.process = sha256_process; | |
18365 | sha256_prototype.finish = sha256_finish; | |
18366 | function sha512_asm(stdlib, foreign, buffer) { | |
18367 | // Closure Compiler warning - commented out | |
18368 | //"use asm"; | |
18369 | 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; | |
18370 | 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; | |
18371 | var HEAP = new stdlib.Uint8Array(buffer); | |
18372 | 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) { | |
18373 | w0h = w0h | 0; | |
18374 | w0l = w0l | 0; | |
18375 | w1h = w1h | 0; | |
18376 | w1l = w1l | 0; | |
18377 | w2h = w2h | 0; | |
18378 | w2l = w2l | 0; | |
18379 | w3h = w3h | 0; | |
18380 | w3l = w3l | 0; | |
18381 | w4h = w4h | 0; | |
18382 | w4l = w4l | 0; | |
18383 | w5h = w5h | 0; | |
18384 | w5l = w5l | 0; | |
18385 | w6h = w6h | 0; | |
18386 | w6l = w6l | 0; | |
18387 | w7h = w7h | 0; | |
18388 | w7l = w7l | 0; | |
18389 | w8h = w8h | 0; | |
18390 | w8l = w8l | 0; | |
18391 | w9h = w9h | 0; | |
18392 | w9l = w9l | 0; | |
18393 | w10h = w10h | 0; | |
18394 | w10l = w10l | 0; | |
18395 | w11h = w11h | 0; | |
18396 | w11l = w11l | 0; | |
18397 | w12h = w12h | 0; | |
18398 | w12l = w12l | 0; | |
18399 | w13h = w13h | 0; | |
18400 | w13l = w13l | 0; | |
18401 | w14h = w14h | 0; | |
18402 | w14l = w14l | 0; | |
18403 | w15h = w15h | 0; | |
18404 | w15l = w15l | 0; | |
18405 | 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; | |
18406 | ah = H0h; | |
18407 | al = H0l; | |
18408 | bh = H1h; | |
18409 | bl = H1l; | |
18410 | ch = H2h; | |
18411 | cl = H2l; | |
18412 | dh = H3h; | |
18413 | dl = H3l; | |
18414 | eh = H4h; | |
18415 | el = H4l; | |
18416 | fh = H5h; | |
18417 | fl = H5l; | |
18418 | gh = H6h; | |
18419 | gl = H6l; | |
18420 | hh = H7h; | |
18421 | hl = H7l; | |
18422 | tl = 3609767458 + w0l | 0; | |
18423 | th = 1116352408 + w0h + (tl >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
18424 | tl = tl + hl | 0; | |
18425 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18426 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18427 | tl = tl + xl | 0; | |
18428 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18429 | xl = gl ^ el & (fl ^ gl) | 0; | |
18430 | tl = tl + xl | 0; | |
18431 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18432 | hl = gl; | |
18433 | hh = gh; | |
18434 | gl = fl; | |
18435 | gh = fh; | |
18436 | fl = el; | |
18437 | fh = eh; | |
18438 | el = dl + tl | 0; | |
18439 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18440 | dl = cl; | |
18441 | dh = ch; | |
18442 | cl = bl; | |
18443 | ch = bh; | |
18444 | bl = al; | |
18445 | bh = ah; | |
18446 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18447 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18448 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18449 | al = al + xl | 0; | |
18450 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18451 | tl = 602891725 + w1l | 0; | |
18452 | th = 1899447441 + w1h + (tl >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
18453 | tl = tl + hl | 0; | |
18454 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18455 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18456 | tl = tl + xl | 0; | |
18457 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18458 | xl = gl ^ el & (fl ^ gl) | 0; | |
18459 | tl = tl + xl | 0; | |
18460 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18461 | hl = gl; | |
18462 | hh = gh; | |
18463 | gl = fl; | |
18464 | gh = fh; | |
18465 | fl = el; | |
18466 | fh = eh; | |
18467 | el = dl + tl | 0; | |
18468 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18469 | dl = cl; | |
18470 | dh = ch; | |
18471 | cl = bl; | |
18472 | ch = bh; | |
18473 | bl = al; | |
18474 | bh = ah; | |
18475 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18476 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18477 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18478 | al = al + xl | 0; | |
18479 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18480 | tl = 3964484399 + w2l | 0; | |
18481 | th = 3049323471 + w2h + (tl >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
18482 | tl = tl + hl | 0; | |
18483 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18484 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18485 | tl = tl + xl | 0; | |
18486 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18487 | xl = gl ^ el & (fl ^ gl) | 0; | |
18488 | tl = tl + xl | 0; | |
18489 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18490 | hl = gl; | |
18491 | hh = gh; | |
18492 | gl = fl; | |
18493 | gh = fh; | |
18494 | fl = el; | |
18495 | fh = eh; | |
18496 | el = dl + tl | 0; | |
18497 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18498 | dl = cl; | |
18499 | dh = ch; | |
18500 | cl = bl; | |
18501 | ch = bh; | |
18502 | bl = al; | |
18503 | bh = ah; | |
18504 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18505 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18506 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18507 | al = al + xl | 0; | |
18508 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18509 | tl = 2173295548 + w3l | 0; | |
18510 | th = 3921009573 + w3h + (tl >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
18511 | tl = tl + hl | 0; | |
18512 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18513 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18514 | tl = tl + xl | 0; | |
18515 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18516 | xl = gl ^ el & (fl ^ gl) | 0; | |
18517 | tl = tl + xl | 0; | |
18518 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18519 | hl = gl; | |
18520 | hh = gh; | |
18521 | gl = fl; | |
18522 | gh = fh; | |
18523 | fl = el; | |
18524 | fh = eh; | |
18525 | el = dl + tl | 0; | |
18526 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18527 | dl = cl; | |
18528 | dh = ch; | |
18529 | cl = bl; | |
18530 | ch = bh; | |
18531 | bl = al; | |
18532 | bh = ah; | |
18533 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18534 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18535 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18536 | al = al + xl | 0; | |
18537 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18538 | tl = 4081628472 + w4l | 0; | |
18539 | th = 961987163 + w4h + (tl >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
18540 | tl = tl + hl | 0; | |
18541 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18542 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18543 | tl = tl + xl | 0; | |
18544 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18545 | xl = gl ^ el & (fl ^ gl) | 0; | |
18546 | tl = tl + xl | 0; | |
18547 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18548 | hl = gl; | |
18549 | hh = gh; | |
18550 | gl = fl; | |
18551 | gh = fh; | |
18552 | fl = el; | |
18553 | fh = eh; | |
18554 | el = dl + tl | 0; | |
18555 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18556 | dl = cl; | |
18557 | dh = ch; | |
18558 | cl = bl; | |
18559 | ch = bh; | |
18560 | bl = al; | |
18561 | bh = ah; | |
18562 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18563 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18564 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18565 | al = al + xl | 0; | |
18566 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18567 | tl = 3053834265 + w5l | 0; | |
18568 | th = 1508970993 + w5h + (tl >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
18569 | tl = tl + hl | 0; | |
18570 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18571 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18572 | tl = tl + xl | 0; | |
18573 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18574 | xl = gl ^ el & (fl ^ gl) | 0; | |
18575 | tl = tl + xl | 0; | |
18576 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18577 | hl = gl; | |
18578 | hh = gh; | |
18579 | gl = fl; | |
18580 | gh = fh; | |
18581 | fl = el; | |
18582 | fh = eh; | |
18583 | el = dl + tl | 0; | |
18584 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18585 | dl = cl; | |
18586 | dh = ch; | |
18587 | cl = bl; | |
18588 | ch = bh; | |
18589 | bl = al; | |
18590 | bh = ah; | |
18591 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18592 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18593 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18594 | al = al + xl | 0; | |
18595 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18596 | tl = 2937671579 + w6l | 0; | |
18597 | th = 2453635748 + w6h + (tl >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
18598 | tl = tl + hl | 0; | |
18599 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18600 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18601 | tl = tl + xl | 0; | |
18602 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18603 | xl = gl ^ el & (fl ^ gl) | 0; | |
18604 | tl = tl + xl | 0; | |
18605 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18606 | hl = gl; | |
18607 | hh = gh; | |
18608 | gl = fl; | |
18609 | gh = fh; | |
18610 | fl = el; | |
18611 | fh = eh; | |
18612 | el = dl + tl | 0; | |
18613 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18614 | dl = cl; | |
18615 | dh = ch; | |
18616 | cl = bl; | |
18617 | ch = bh; | |
18618 | bl = al; | |
18619 | bh = ah; | |
18620 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18621 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18622 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18623 | al = al + xl | 0; | |
18624 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18625 | tl = 3664609560 + w7l | 0; | |
18626 | th = 2870763221 + w7h + (tl >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
18627 | tl = tl + hl | 0; | |
18628 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18629 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18630 | tl = tl + xl | 0; | |
18631 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18632 | xl = gl ^ el & (fl ^ gl) | 0; | |
18633 | tl = tl + xl | 0; | |
18634 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18635 | hl = gl; | |
18636 | hh = gh; | |
18637 | gl = fl; | |
18638 | gh = fh; | |
18639 | fl = el; | |
18640 | fh = eh; | |
18641 | el = dl + tl | 0; | |
18642 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18643 | dl = cl; | |
18644 | dh = ch; | |
18645 | cl = bl; | |
18646 | ch = bh; | |
18647 | bl = al; | |
18648 | bh = ah; | |
18649 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18650 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18651 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18652 | al = al + xl | 0; | |
18653 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18654 | tl = 2734883394 + w8l | 0; | |
18655 | th = 3624381080 + w8h + (tl >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
18656 | tl = tl + hl | 0; | |
18657 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18658 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18659 | tl = tl + xl | 0; | |
18660 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18661 | xl = gl ^ el & (fl ^ gl) | 0; | |
18662 | tl = tl + xl | 0; | |
18663 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18664 | hl = gl; | |
18665 | hh = gh; | |
18666 | gl = fl; | |
18667 | gh = fh; | |
18668 | fl = el; | |
18669 | fh = eh; | |
18670 | el = dl + tl | 0; | |
18671 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18672 | dl = cl; | |
18673 | dh = ch; | |
18674 | cl = bl; | |
18675 | ch = bh; | |
18676 | bl = al; | |
18677 | bh = ah; | |
18678 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18679 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18680 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18681 | al = al + xl | 0; | |
18682 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18683 | tl = 1164996542 + w9l | 0; | |
18684 | th = 310598401 + w9h + (tl >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
18685 | tl = tl + hl | 0; | |
18686 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18687 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18688 | tl = tl + xl | 0; | |
18689 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18690 | xl = gl ^ el & (fl ^ gl) | 0; | |
18691 | tl = tl + xl | 0; | |
18692 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18693 | hl = gl; | |
18694 | hh = gh; | |
18695 | gl = fl; | |
18696 | gh = fh; | |
18697 | fl = el; | |
18698 | fh = eh; | |
18699 | el = dl + tl | 0; | |
18700 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18701 | dl = cl; | |
18702 | dh = ch; | |
18703 | cl = bl; | |
18704 | ch = bh; | |
18705 | bl = al; | |
18706 | bh = ah; | |
18707 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18708 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18709 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18710 | al = al + xl | 0; | |
18711 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18712 | tl = 1323610764 + w10l | 0; | |
18713 | th = 607225278 + w10h + (tl >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
18714 | tl = tl + hl | 0; | |
18715 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18716 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18717 | tl = tl + xl | 0; | |
18718 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18719 | xl = gl ^ el & (fl ^ gl) | 0; | |
18720 | tl = tl + xl | 0; | |
18721 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18722 | hl = gl; | |
18723 | hh = gh; | |
18724 | gl = fl; | |
18725 | gh = fh; | |
18726 | fl = el; | |
18727 | fh = eh; | |
18728 | el = dl + tl | 0; | |
18729 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18730 | dl = cl; | |
18731 | dh = ch; | |
18732 | cl = bl; | |
18733 | ch = bh; | |
18734 | bl = al; | |
18735 | bh = ah; | |
18736 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18737 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18738 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18739 | al = al + xl | 0; | |
18740 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18741 | tl = 3590304994 + w11l | 0; | |
18742 | th = 1426881987 + w11h + (tl >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
18743 | tl = tl + hl | 0; | |
18744 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18745 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18746 | tl = tl + xl | 0; | |
18747 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18748 | xl = gl ^ el & (fl ^ gl) | 0; | |
18749 | tl = tl + xl | 0; | |
18750 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18751 | hl = gl; | |
18752 | hh = gh; | |
18753 | gl = fl; | |
18754 | gh = fh; | |
18755 | fl = el; | |
18756 | fh = eh; | |
18757 | el = dl + tl | 0; | |
18758 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18759 | dl = cl; | |
18760 | dh = ch; | |
18761 | cl = bl; | |
18762 | ch = bh; | |
18763 | bl = al; | |
18764 | bh = ah; | |
18765 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18766 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18767 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18768 | al = al + xl | 0; | |
18769 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18770 | tl = 4068182383 + w12l | 0; | |
18771 | th = 1925078388 + w12h + (tl >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
18772 | tl = tl + hl | 0; | |
18773 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18774 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18775 | tl = tl + xl | 0; | |
18776 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18777 | xl = gl ^ el & (fl ^ gl) | 0; | |
18778 | tl = tl + xl | 0; | |
18779 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18780 | hl = gl; | |
18781 | hh = gh; | |
18782 | gl = fl; | |
18783 | gh = fh; | |
18784 | fl = el; | |
18785 | fh = eh; | |
18786 | el = dl + tl | 0; | |
18787 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18788 | dl = cl; | |
18789 | dh = ch; | |
18790 | cl = bl; | |
18791 | ch = bh; | |
18792 | bl = al; | |
18793 | bh = ah; | |
18794 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18795 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18796 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18797 | al = al + xl | 0; | |
18798 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18799 | tl = 991336113 + w13l | 0; | |
18800 | th = 2162078206 + w13h + (tl >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
18801 | tl = tl + hl | 0; | |
18802 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18803 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18804 | tl = tl + xl | 0; | |
18805 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18806 | xl = gl ^ el & (fl ^ gl) | 0; | |
18807 | tl = tl + xl | 0; | |
18808 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18809 | hl = gl; | |
18810 | hh = gh; | |
18811 | gl = fl; | |
18812 | gh = fh; | |
18813 | fl = el; | |
18814 | fh = eh; | |
18815 | el = dl + tl | 0; | |
18816 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18817 | dl = cl; | |
18818 | dh = ch; | |
18819 | cl = bl; | |
18820 | ch = bh; | |
18821 | bl = al; | |
18822 | bh = ah; | |
18823 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18824 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18825 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18826 | al = al + xl | 0; | |
18827 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18828 | tl = 633803317 + w14l | 0; | |
18829 | th = 2614888103 + w14h + (tl >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
18830 | tl = tl + hl | 0; | |
18831 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18832 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18833 | tl = tl + xl | 0; | |
18834 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18835 | xl = gl ^ el & (fl ^ gl) | 0; | |
18836 | tl = tl + xl | 0; | |
18837 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18838 | hl = gl; | |
18839 | hh = gh; | |
18840 | gl = fl; | |
18841 | gh = fh; | |
18842 | fl = el; | |
18843 | fh = eh; | |
18844 | el = dl + tl | 0; | |
18845 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18846 | dl = cl; | |
18847 | dh = ch; | |
18848 | cl = bl; | |
18849 | ch = bh; | |
18850 | bl = al; | |
18851 | bh = ah; | |
18852 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18853 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18854 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18855 | al = al + xl | 0; | |
18856 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18857 | tl = 3479774868 + w15l | 0; | |
18858 | th = 3248222580 + w15h + (tl >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
18859 | tl = tl + hl | 0; | |
18860 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18861 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18862 | tl = tl + xl | 0; | |
18863 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18864 | xl = gl ^ el & (fl ^ gl) | 0; | |
18865 | tl = tl + xl | 0; | |
18866 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18867 | hl = gl; | |
18868 | hh = gh; | |
18869 | gl = fl; | |
18870 | gh = fh; | |
18871 | fl = el; | |
18872 | fh = eh; | |
18873 | el = dl + tl | 0; | |
18874 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18875 | dl = cl; | |
18876 | dh = ch; | |
18877 | cl = bl; | |
18878 | ch = bh; | |
18879 | bl = al; | |
18880 | bh = ah; | |
18881 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18882 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18883 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18884 | al = al + xl | 0; | |
18885 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18886 | w0l = w0l + w9l | 0; | |
18887 | w0h = w0h + w9h + (w0l >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
18888 | xl = (w1l >>> 1 | w1h << 31) ^ (w1l >>> 8 | w1h << 24) ^ (w1l >>> 7 | w1h << 25) | 0; | |
18889 | w0l = w0l + xl | 0; | |
18890 | w0h = w0h + ((w1h >>> 1 | w1l << 31) ^ (w1h >>> 8 | w1l << 24) ^ w1h >>> 7) + (w0l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18891 | xl = (w14l >>> 19 | w14h << 13) ^ (w14l << 3 | w14h >>> 29) ^ (w14l >>> 6 | w14h << 26) | 0; | |
18892 | w0l = w0l + xl | 0; | |
18893 | w0h = w0h + ((w14h >>> 19 | w14l << 13) ^ (w14h << 3 | w14l >>> 29) ^ w14h >>> 6) + (w0l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18894 | tl = 2666613458 + w0l | 0; | |
18895 | th = 3835390401 + w0h + (tl >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
18896 | tl = tl + hl | 0; | |
18897 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18898 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18899 | tl = tl + xl | 0; | |
18900 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18901 | xl = gl ^ el & (fl ^ gl) | 0; | |
18902 | tl = tl + xl | 0; | |
18903 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18904 | hl = gl; | |
18905 | hh = gh; | |
18906 | gl = fl; | |
18907 | gh = fh; | |
18908 | fl = el; | |
18909 | fh = eh; | |
18910 | el = dl + tl | 0; | |
18911 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18912 | dl = cl; | |
18913 | dh = ch; | |
18914 | cl = bl; | |
18915 | ch = bh; | |
18916 | bl = al; | |
18917 | bh = ah; | |
18918 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18919 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18920 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18921 | al = al + xl | 0; | |
18922 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18923 | w1l = w1l + w10l | 0; | |
18924 | w1h = w1h + w10h + (w1l >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
18925 | xl = (w2l >>> 1 | w2h << 31) ^ (w2l >>> 8 | w2h << 24) ^ (w2l >>> 7 | w2h << 25) | 0; | |
18926 | w1l = w1l + xl | 0; | |
18927 | w1h = w1h + ((w2h >>> 1 | w2l << 31) ^ (w2h >>> 8 | w2l << 24) ^ w2h >>> 7) + (w1l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18928 | xl = (w15l >>> 19 | w15h << 13) ^ (w15l << 3 | w15h >>> 29) ^ (w15l >>> 6 | w15h << 26) | 0; | |
18929 | w1l = w1l + xl | 0; | |
18930 | w1h = w1h + ((w15h >>> 19 | w15l << 13) ^ (w15h << 3 | w15l >>> 29) ^ w15h >>> 6) + (w1l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18931 | tl = 944711139 + w1l | 0; | |
18932 | th = 4022224774 + w1h + (tl >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
18933 | tl = tl + hl | 0; | |
18934 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18935 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18936 | tl = tl + xl | 0; | |
18937 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18938 | xl = gl ^ el & (fl ^ gl) | 0; | |
18939 | tl = tl + xl | 0; | |
18940 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18941 | hl = gl; | |
18942 | hh = gh; | |
18943 | gl = fl; | |
18944 | gh = fh; | |
18945 | fl = el; | |
18946 | fh = eh; | |
18947 | el = dl + tl | 0; | |
18948 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18949 | dl = cl; | |
18950 | dh = ch; | |
18951 | cl = bl; | |
18952 | ch = bh; | |
18953 | bl = al; | |
18954 | bh = ah; | |
18955 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18956 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18957 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18958 | al = al + xl | 0; | |
18959 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18960 | w2l = w2l + w11l | 0; | |
18961 | w2h = w2h + w11h + (w2l >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
18962 | xl = (w3l >>> 1 | w3h << 31) ^ (w3l >>> 8 | w3h << 24) ^ (w3l >>> 7 | w3h << 25) | 0; | |
18963 | w2l = w2l + xl | 0; | |
18964 | w2h = w2h + ((w3h >>> 1 | w3l << 31) ^ (w3h >>> 8 | w3l << 24) ^ w3h >>> 7) + (w2l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18965 | xl = (w0l >>> 19 | w0h << 13) ^ (w0l << 3 | w0h >>> 29) ^ (w0l >>> 6 | w0h << 26) | 0; | |
18966 | w2l = w2l + xl | 0; | |
18967 | w2h = w2h + ((w0h >>> 19 | w0l << 13) ^ (w0h << 3 | w0l >>> 29) ^ w0h >>> 6) + (w2l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18968 | tl = 2341262773 + w2l | 0; | |
18969 | th = 264347078 + w2h + (tl >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
18970 | tl = tl + hl | 0; | |
18971 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
18972 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
18973 | tl = tl + xl | 0; | |
18974 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18975 | xl = gl ^ el & (fl ^ gl) | 0; | |
18976 | tl = tl + xl | 0; | |
18977 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18978 | hl = gl; | |
18979 | hh = gh; | |
18980 | gl = fl; | |
18981 | gh = fh; | |
18982 | fl = el; | |
18983 | fh = eh; | |
18984 | el = dl + tl | 0; | |
18985 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
18986 | dl = cl; | |
18987 | dh = ch; | |
18988 | cl = bl; | |
18989 | ch = bh; | |
18990 | bl = al; | |
18991 | bh = ah; | |
18992 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
18993 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
18994 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
18995 | al = al + xl | 0; | |
18996 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
18997 | w3l = w3l + w12l | 0; | |
18998 | w3h = w3h + w12h + (w3l >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
18999 | xl = (w4l >>> 1 | w4h << 31) ^ (w4l >>> 8 | w4h << 24) ^ (w4l >>> 7 | w4h << 25) | 0; | |
19000 | w3l = w3l + xl | 0; | |
19001 | w3h = w3h + ((w4h >>> 1 | w4l << 31) ^ (w4h >>> 8 | w4l << 24) ^ w4h >>> 7) + (w3l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19002 | xl = (w1l >>> 19 | w1h << 13) ^ (w1l << 3 | w1h >>> 29) ^ (w1l >>> 6 | w1h << 26) | 0; | |
19003 | w3l = w3l + xl | 0; | |
19004 | w3h = w3h + ((w1h >>> 19 | w1l << 13) ^ (w1h << 3 | w1l >>> 29) ^ w1h >>> 6) + (w3l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19005 | tl = 2007800933 + w3l | 0; | |
19006 | th = 604807628 + w3h + (tl >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
19007 | tl = tl + hl | 0; | |
19008 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19009 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19010 | tl = tl + xl | 0; | |
19011 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19012 | xl = gl ^ el & (fl ^ gl) | 0; | |
19013 | tl = tl + xl | 0; | |
19014 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19015 | hl = gl; | |
19016 | hh = gh; | |
19017 | gl = fl; | |
19018 | gh = fh; | |
19019 | fl = el; | |
19020 | fh = eh; | |
19021 | el = dl + tl | 0; | |
19022 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19023 | dl = cl; | |
19024 | dh = ch; | |
19025 | cl = bl; | |
19026 | ch = bh; | |
19027 | bl = al; | |
19028 | bh = ah; | |
19029 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19030 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19031 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19032 | al = al + xl | 0; | |
19033 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19034 | w4l = w4l + w13l | 0; | |
19035 | w4h = w4h + w13h + (w4l >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
19036 | xl = (w5l >>> 1 | w5h << 31) ^ (w5l >>> 8 | w5h << 24) ^ (w5l >>> 7 | w5h << 25) | 0; | |
19037 | w4l = w4l + xl | 0; | |
19038 | w4h = w4h + ((w5h >>> 1 | w5l << 31) ^ (w5h >>> 8 | w5l << 24) ^ w5h >>> 7) + (w4l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19039 | xl = (w2l >>> 19 | w2h << 13) ^ (w2l << 3 | w2h >>> 29) ^ (w2l >>> 6 | w2h << 26) | 0; | |
19040 | w4l = w4l + xl | 0; | |
19041 | w4h = w4h + ((w2h >>> 19 | w2l << 13) ^ (w2h << 3 | w2l >>> 29) ^ w2h >>> 6) + (w4l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19042 | tl = 1495990901 + w4l | 0; | |
19043 | th = 770255983 + w4h + (tl >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
19044 | tl = tl + hl | 0; | |
19045 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19046 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19047 | tl = tl + xl | 0; | |
19048 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19049 | xl = gl ^ el & (fl ^ gl) | 0; | |
19050 | tl = tl + xl | 0; | |
19051 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19052 | hl = gl; | |
19053 | hh = gh; | |
19054 | gl = fl; | |
19055 | gh = fh; | |
19056 | fl = el; | |
19057 | fh = eh; | |
19058 | el = dl + tl | 0; | |
19059 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19060 | dl = cl; | |
19061 | dh = ch; | |
19062 | cl = bl; | |
19063 | ch = bh; | |
19064 | bl = al; | |
19065 | bh = ah; | |
19066 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19067 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19068 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19069 | al = al + xl | 0; | |
19070 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19071 | w5l = w5l + w14l | 0; | |
19072 | w5h = w5h + w14h + (w5l >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
19073 | xl = (w6l >>> 1 | w6h << 31) ^ (w6l >>> 8 | w6h << 24) ^ (w6l >>> 7 | w6h << 25) | 0; | |
19074 | w5l = w5l + xl | 0; | |
19075 | w5h = w5h + ((w6h >>> 1 | w6l << 31) ^ (w6h >>> 8 | w6l << 24) ^ w6h >>> 7) + (w5l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19076 | xl = (w3l >>> 19 | w3h << 13) ^ (w3l << 3 | w3h >>> 29) ^ (w3l >>> 6 | w3h << 26) | 0; | |
19077 | w5l = w5l + xl | 0; | |
19078 | w5h = w5h + ((w3h >>> 19 | w3l << 13) ^ (w3h << 3 | w3l >>> 29) ^ w3h >>> 6) + (w5l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19079 | tl = 1856431235 + w5l | 0; | |
19080 | th = 1249150122 + w5h + (tl >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
19081 | tl = tl + hl | 0; | |
19082 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19083 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19084 | tl = tl + xl | 0; | |
19085 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19086 | xl = gl ^ el & (fl ^ gl) | 0; | |
19087 | tl = tl + xl | 0; | |
19088 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19089 | hl = gl; | |
19090 | hh = gh; | |
19091 | gl = fl; | |
19092 | gh = fh; | |
19093 | fl = el; | |
19094 | fh = eh; | |
19095 | el = dl + tl | 0; | |
19096 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19097 | dl = cl; | |
19098 | dh = ch; | |
19099 | cl = bl; | |
19100 | ch = bh; | |
19101 | bl = al; | |
19102 | bh = ah; | |
19103 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19104 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19105 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19106 | al = al + xl | 0; | |
19107 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19108 | w6l = w6l + w15l | 0; | |
19109 | w6h = w6h + w15h + (w6l >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
19110 | xl = (w7l >>> 1 | w7h << 31) ^ (w7l >>> 8 | w7h << 24) ^ (w7l >>> 7 | w7h << 25) | 0; | |
19111 | w6l = w6l + xl | 0; | |
19112 | w6h = w6h + ((w7h >>> 1 | w7l << 31) ^ (w7h >>> 8 | w7l << 24) ^ w7h >>> 7) + (w6l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19113 | xl = (w4l >>> 19 | w4h << 13) ^ (w4l << 3 | w4h >>> 29) ^ (w4l >>> 6 | w4h << 26) | 0; | |
19114 | w6l = w6l + xl | 0; | |
19115 | w6h = w6h + ((w4h >>> 19 | w4l << 13) ^ (w4h << 3 | w4l >>> 29) ^ w4h >>> 6) + (w6l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19116 | tl = 3175218132 + w6l | 0; | |
19117 | th = 1555081692 + w6h + (tl >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
19118 | tl = tl + hl | 0; | |
19119 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19120 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19121 | tl = tl + xl | 0; | |
19122 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19123 | xl = gl ^ el & (fl ^ gl) | 0; | |
19124 | tl = tl + xl | 0; | |
19125 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19126 | hl = gl; | |
19127 | hh = gh; | |
19128 | gl = fl; | |
19129 | gh = fh; | |
19130 | fl = el; | |
19131 | fh = eh; | |
19132 | el = dl + tl | 0; | |
19133 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19134 | dl = cl; | |
19135 | dh = ch; | |
19136 | cl = bl; | |
19137 | ch = bh; | |
19138 | bl = al; | |
19139 | bh = ah; | |
19140 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19141 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19142 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19143 | al = al + xl | 0; | |
19144 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19145 | w7l = w7l + w0l | 0; | |
19146 | w7h = w7h + w0h + (w7l >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
19147 | xl = (w8l >>> 1 | w8h << 31) ^ (w8l >>> 8 | w8h << 24) ^ (w8l >>> 7 | w8h << 25) | 0; | |
19148 | w7l = w7l + xl | 0; | |
19149 | w7h = w7h + ((w8h >>> 1 | w8l << 31) ^ (w8h >>> 8 | w8l << 24) ^ w8h >>> 7) + (w7l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19150 | xl = (w5l >>> 19 | w5h << 13) ^ (w5l << 3 | w5h >>> 29) ^ (w5l >>> 6 | w5h << 26) | 0; | |
19151 | w7l = w7l + xl | 0; | |
19152 | w7h = w7h + ((w5h >>> 19 | w5l << 13) ^ (w5h << 3 | w5l >>> 29) ^ w5h >>> 6) + (w7l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19153 | tl = 2198950837 + w7l | 0; | |
19154 | th = 1996064986 + w7h + (tl >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
19155 | tl = tl + hl | 0; | |
19156 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19157 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19158 | tl = tl + xl | 0; | |
19159 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19160 | xl = gl ^ el & (fl ^ gl) | 0; | |
19161 | tl = tl + xl | 0; | |
19162 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19163 | hl = gl; | |
19164 | hh = gh; | |
19165 | gl = fl; | |
19166 | gh = fh; | |
19167 | fl = el; | |
19168 | fh = eh; | |
19169 | el = dl + tl | 0; | |
19170 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19171 | dl = cl; | |
19172 | dh = ch; | |
19173 | cl = bl; | |
19174 | ch = bh; | |
19175 | bl = al; | |
19176 | bh = ah; | |
19177 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19178 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19179 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19180 | al = al + xl | 0; | |
19181 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19182 | w8l = w8l + w1l | 0; | |
19183 | w8h = w8h + w1h + (w8l >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
19184 | xl = (w9l >>> 1 | w9h << 31) ^ (w9l >>> 8 | w9h << 24) ^ (w9l >>> 7 | w9h << 25) | 0; | |
19185 | w8l = w8l + xl | 0; | |
19186 | w8h = w8h + ((w9h >>> 1 | w9l << 31) ^ (w9h >>> 8 | w9l << 24) ^ w9h >>> 7) + (w8l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19187 | xl = (w6l >>> 19 | w6h << 13) ^ (w6l << 3 | w6h >>> 29) ^ (w6l >>> 6 | w6h << 26) | 0; | |
19188 | w8l = w8l + xl | 0; | |
19189 | w8h = w8h + ((w6h >>> 19 | w6l << 13) ^ (w6h << 3 | w6l >>> 29) ^ w6h >>> 6) + (w8l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19190 | tl = 3999719339 + w8l | 0; | |
19191 | th = 2554220882 + w8h + (tl >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
19192 | tl = tl + hl | 0; | |
19193 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19194 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19195 | tl = tl + xl | 0; | |
19196 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19197 | xl = gl ^ el & (fl ^ gl) | 0; | |
19198 | tl = tl + xl | 0; | |
19199 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19200 | hl = gl; | |
19201 | hh = gh; | |
19202 | gl = fl; | |
19203 | gh = fh; | |
19204 | fl = el; | |
19205 | fh = eh; | |
19206 | el = dl + tl | 0; | |
19207 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19208 | dl = cl; | |
19209 | dh = ch; | |
19210 | cl = bl; | |
19211 | ch = bh; | |
19212 | bl = al; | |
19213 | bh = ah; | |
19214 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19215 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19216 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19217 | al = al + xl | 0; | |
19218 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19219 | w9l = w9l + w2l | 0; | |
19220 | w9h = w9h + w2h + (w9l >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
19221 | xl = (w10l >>> 1 | w10h << 31) ^ (w10l >>> 8 | w10h << 24) ^ (w10l >>> 7 | w10h << 25) | 0; | |
19222 | w9l = w9l + xl | 0; | |
19223 | w9h = w9h + ((w10h >>> 1 | w10l << 31) ^ (w10h >>> 8 | w10l << 24) ^ w10h >>> 7) + (w9l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19224 | xl = (w7l >>> 19 | w7h << 13) ^ (w7l << 3 | w7h >>> 29) ^ (w7l >>> 6 | w7h << 26) | 0; | |
19225 | w9l = w9l + xl | 0; | |
19226 | w9h = w9h + ((w7h >>> 19 | w7l << 13) ^ (w7h << 3 | w7l >>> 29) ^ w7h >>> 6) + (w9l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19227 | tl = 766784016 + w9l | 0; | |
19228 | th = 2821834349 + w9h + (tl >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
19229 | tl = tl + hl | 0; | |
19230 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19231 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19232 | tl = tl + xl | 0; | |
19233 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19234 | xl = gl ^ el & (fl ^ gl) | 0; | |
19235 | tl = tl + xl | 0; | |
19236 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19237 | hl = gl; | |
19238 | hh = gh; | |
19239 | gl = fl; | |
19240 | gh = fh; | |
19241 | fl = el; | |
19242 | fh = eh; | |
19243 | el = dl + tl | 0; | |
19244 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19245 | dl = cl; | |
19246 | dh = ch; | |
19247 | cl = bl; | |
19248 | ch = bh; | |
19249 | bl = al; | |
19250 | bh = ah; | |
19251 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19252 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19253 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19254 | al = al + xl | 0; | |
19255 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19256 | w10l = w10l + w3l | 0; | |
19257 | w10h = w10h + w3h + (w10l >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
19258 | xl = (w11l >>> 1 | w11h << 31) ^ (w11l >>> 8 | w11h << 24) ^ (w11l >>> 7 | w11h << 25) | 0; | |
19259 | w10l = w10l + xl | 0; | |
19260 | w10h = w10h + ((w11h >>> 1 | w11l << 31) ^ (w11h >>> 8 | w11l << 24) ^ w11h >>> 7) + (w10l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19261 | xl = (w8l >>> 19 | w8h << 13) ^ (w8l << 3 | w8h >>> 29) ^ (w8l >>> 6 | w8h << 26) | 0; | |
19262 | w10l = w10l + xl | 0; | |
19263 | w10h = w10h + ((w8h >>> 19 | w8l << 13) ^ (w8h << 3 | w8l >>> 29) ^ w8h >>> 6) + (w10l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19264 | tl = 2566594879 + w10l | 0; | |
19265 | th = 2952996808 + w10h + (tl >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
19266 | tl = tl + hl | 0; | |
19267 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19268 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19269 | tl = tl + xl | 0; | |
19270 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19271 | xl = gl ^ el & (fl ^ gl) | 0; | |
19272 | tl = tl + xl | 0; | |
19273 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19274 | hl = gl; | |
19275 | hh = gh; | |
19276 | gl = fl; | |
19277 | gh = fh; | |
19278 | fl = el; | |
19279 | fh = eh; | |
19280 | el = dl + tl | 0; | |
19281 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19282 | dl = cl; | |
19283 | dh = ch; | |
19284 | cl = bl; | |
19285 | ch = bh; | |
19286 | bl = al; | |
19287 | bh = ah; | |
19288 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19289 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19290 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19291 | al = al + xl | 0; | |
19292 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19293 | w11l = w11l + w4l | 0; | |
19294 | w11h = w11h + w4h + (w11l >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
19295 | xl = (w12l >>> 1 | w12h << 31) ^ (w12l >>> 8 | w12h << 24) ^ (w12l >>> 7 | w12h << 25) | 0; | |
19296 | w11l = w11l + xl | 0; | |
19297 | w11h = w11h + ((w12h >>> 1 | w12l << 31) ^ (w12h >>> 8 | w12l << 24) ^ w12h >>> 7) + (w11l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19298 | xl = (w9l >>> 19 | w9h << 13) ^ (w9l << 3 | w9h >>> 29) ^ (w9l >>> 6 | w9h << 26) | 0; | |
19299 | w11l = w11l + xl | 0; | |
19300 | w11h = w11h + ((w9h >>> 19 | w9l << 13) ^ (w9h << 3 | w9l >>> 29) ^ w9h >>> 6) + (w11l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19301 | tl = 3203337956 + w11l | 0; | |
19302 | th = 3210313671 + w11h + (tl >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
19303 | tl = tl + hl | 0; | |
19304 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19305 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19306 | tl = tl + xl | 0; | |
19307 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19308 | xl = gl ^ el & (fl ^ gl) | 0; | |
19309 | tl = tl + xl | 0; | |
19310 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19311 | hl = gl; | |
19312 | hh = gh; | |
19313 | gl = fl; | |
19314 | gh = fh; | |
19315 | fl = el; | |
19316 | fh = eh; | |
19317 | el = dl + tl | 0; | |
19318 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19319 | dl = cl; | |
19320 | dh = ch; | |
19321 | cl = bl; | |
19322 | ch = bh; | |
19323 | bl = al; | |
19324 | bh = ah; | |
19325 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19326 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19327 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19328 | al = al + xl | 0; | |
19329 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19330 | w12l = w12l + w5l | 0; | |
19331 | w12h = w12h + w5h + (w12l >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
19332 | xl = (w13l >>> 1 | w13h << 31) ^ (w13l >>> 8 | w13h << 24) ^ (w13l >>> 7 | w13h << 25) | 0; | |
19333 | w12l = w12l + xl | 0; | |
19334 | w12h = w12h + ((w13h >>> 1 | w13l << 31) ^ (w13h >>> 8 | w13l << 24) ^ w13h >>> 7) + (w12l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19335 | xl = (w10l >>> 19 | w10h << 13) ^ (w10l << 3 | w10h >>> 29) ^ (w10l >>> 6 | w10h << 26) | 0; | |
19336 | w12l = w12l + xl | 0; | |
19337 | w12h = w12h + ((w10h >>> 19 | w10l << 13) ^ (w10h << 3 | w10l >>> 29) ^ w10h >>> 6) + (w12l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19338 | tl = 1034457026 + w12l | 0; | |
19339 | th = 3336571891 + w12h + (tl >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
19340 | tl = tl + hl | 0; | |
19341 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19342 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19343 | tl = tl + xl | 0; | |
19344 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19345 | xl = gl ^ el & (fl ^ gl) | 0; | |
19346 | tl = tl + xl | 0; | |
19347 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19348 | hl = gl; | |
19349 | hh = gh; | |
19350 | gl = fl; | |
19351 | gh = fh; | |
19352 | fl = el; | |
19353 | fh = eh; | |
19354 | el = dl + tl | 0; | |
19355 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19356 | dl = cl; | |
19357 | dh = ch; | |
19358 | cl = bl; | |
19359 | ch = bh; | |
19360 | bl = al; | |
19361 | bh = ah; | |
19362 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19363 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19364 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19365 | al = al + xl | 0; | |
19366 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19367 | w13l = w13l + w6l | 0; | |
19368 | w13h = w13h + w6h + (w13l >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
19369 | xl = (w14l >>> 1 | w14h << 31) ^ (w14l >>> 8 | w14h << 24) ^ (w14l >>> 7 | w14h << 25) | 0; | |
19370 | w13l = w13l + xl | 0; | |
19371 | w13h = w13h + ((w14h >>> 1 | w14l << 31) ^ (w14h >>> 8 | w14l << 24) ^ w14h >>> 7) + (w13l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19372 | xl = (w11l >>> 19 | w11h << 13) ^ (w11l << 3 | w11h >>> 29) ^ (w11l >>> 6 | w11h << 26) | 0; | |
19373 | w13l = w13l + xl | 0; | |
19374 | w13h = w13h + ((w11h >>> 19 | w11l << 13) ^ (w11h << 3 | w11l >>> 29) ^ w11h >>> 6) + (w13l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19375 | tl = 2466948901 + w13l | 0; | |
19376 | th = 3584528711 + w13h + (tl >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
19377 | tl = tl + hl | 0; | |
19378 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19379 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19380 | tl = tl + xl | 0; | |
19381 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19382 | xl = gl ^ el & (fl ^ gl) | 0; | |
19383 | tl = tl + xl | 0; | |
19384 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19385 | hl = gl; | |
19386 | hh = gh; | |
19387 | gl = fl; | |
19388 | gh = fh; | |
19389 | fl = el; | |
19390 | fh = eh; | |
19391 | el = dl + tl | 0; | |
19392 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19393 | dl = cl; | |
19394 | dh = ch; | |
19395 | cl = bl; | |
19396 | ch = bh; | |
19397 | bl = al; | |
19398 | bh = ah; | |
19399 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19400 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19401 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19402 | al = al + xl | 0; | |
19403 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19404 | w14l = w14l + w7l | 0; | |
19405 | w14h = w14h + w7h + (w14l >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
19406 | xl = (w15l >>> 1 | w15h << 31) ^ (w15l >>> 8 | w15h << 24) ^ (w15l >>> 7 | w15h << 25) | 0; | |
19407 | w14l = w14l + xl | 0; | |
19408 | w14h = w14h + ((w15h >>> 1 | w15l << 31) ^ (w15h >>> 8 | w15l << 24) ^ w15h >>> 7) + (w14l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19409 | xl = (w12l >>> 19 | w12h << 13) ^ (w12l << 3 | w12h >>> 29) ^ (w12l >>> 6 | w12h << 26) | 0; | |
19410 | w14l = w14l + xl | 0; | |
19411 | w14h = w14h + ((w12h >>> 19 | w12l << 13) ^ (w12h << 3 | w12l >>> 29) ^ w12h >>> 6) + (w14l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19412 | tl = 3758326383 + w14l | 0; | |
19413 | th = 113926993 + w14h + (tl >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
19414 | tl = tl + hl | 0; | |
19415 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19416 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19417 | tl = tl + xl | 0; | |
19418 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19419 | xl = gl ^ el & (fl ^ gl) | 0; | |
19420 | tl = tl + xl | 0; | |
19421 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19422 | hl = gl; | |
19423 | hh = gh; | |
19424 | gl = fl; | |
19425 | gh = fh; | |
19426 | fl = el; | |
19427 | fh = eh; | |
19428 | el = dl + tl | 0; | |
19429 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19430 | dl = cl; | |
19431 | dh = ch; | |
19432 | cl = bl; | |
19433 | ch = bh; | |
19434 | bl = al; | |
19435 | bh = ah; | |
19436 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19437 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19438 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19439 | al = al + xl | 0; | |
19440 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19441 | w15l = w15l + w8l | 0; | |
19442 | w15h = w15h + w8h + (w15l >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
19443 | xl = (w0l >>> 1 | w0h << 31) ^ (w0l >>> 8 | w0h << 24) ^ (w0l >>> 7 | w0h << 25) | 0; | |
19444 | w15l = w15l + xl | 0; | |
19445 | w15h = w15h + ((w0h >>> 1 | w0l << 31) ^ (w0h >>> 8 | w0l << 24) ^ w0h >>> 7) + (w15l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19446 | xl = (w13l >>> 19 | w13h << 13) ^ (w13l << 3 | w13h >>> 29) ^ (w13l >>> 6 | w13h << 26) | 0; | |
19447 | w15l = w15l + xl | 0; | |
19448 | w15h = w15h + ((w13h >>> 19 | w13l << 13) ^ (w13h << 3 | w13l >>> 29) ^ w13h >>> 6) + (w15l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19449 | tl = 168717936 + w15l | 0; | |
19450 | th = 338241895 + w15h + (tl >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
19451 | tl = tl + hl | 0; | |
19452 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19453 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19454 | tl = tl + xl | 0; | |
19455 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19456 | xl = gl ^ el & (fl ^ gl) | 0; | |
19457 | tl = tl + xl | 0; | |
19458 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19459 | hl = gl; | |
19460 | hh = gh; | |
19461 | gl = fl; | |
19462 | gh = fh; | |
19463 | fl = el; | |
19464 | fh = eh; | |
19465 | el = dl + tl | 0; | |
19466 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19467 | dl = cl; | |
19468 | dh = ch; | |
19469 | cl = bl; | |
19470 | ch = bh; | |
19471 | bl = al; | |
19472 | bh = ah; | |
19473 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19474 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19475 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19476 | al = al + xl | 0; | |
19477 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19478 | w0l = w0l + w9l | 0; | |
19479 | w0h = w0h + w9h + (w0l >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
19480 | xl = (w1l >>> 1 | w1h << 31) ^ (w1l >>> 8 | w1h << 24) ^ (w1l >>> 7 | w1h << 25) | 0; | |
19481 | w0l = w0l + xl | 0; | |
19482 | w0h = w0h + ((w1h >>> 1 | w1l << 31) ^ (w1h >>> 8 | w1l << 24) ^ w1h >>> 7) + (w0l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19483 | xl = (w14l >>> 19 | w14h << 13) ^ (w14l << 3 | w14h >>> 29) ^ (w14l >>> 6 | w14h << 26) | 0; | |
19484 | w0l = w0l + xl | 0; | |
19485 | w0h = w0h + ((w14h >>> 19 | w14l << 13) ^ (w14h << 3 | w14l >>> 29) ^ w14h >>> 6) + (w0l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19486 | tl = 1188179964 + w0l | 0; | |
19487 | th = 666307205 + w0h + (tl >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
19488 | tl = tl + hl | 0; | |
19489 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19490 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19491 | tl = tl + xl | 0; | |
19492 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19493 | xl = gl ^ el & (fl ^ gl) | 0; | |
19494 | tl = tl + xl | 0; | |
19495 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19496 | hl = gl; | |
19497 | hh = gh; | |
19498 | gl = fl; | |
19499 | gh = fh; | |
19500 | fl = el; | |
19501 | fh = eh; | |
19502 | el = dl + tl | 0; | |
19503 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19504 | dl = cl; | |
19505 | dh = ch; | |
19506 | cl = bl; | |
19507 | ch = bh; | |
19508 | bl = al; | |
19509 | bh = ah; | |
19510 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19511 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19512 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19513 | al = al + xl | 0; | |
19514 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19515 | w1l = w1l + w10l | 0; | |
19516 | w1h = w1h + w10h + (w1l >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
19517 | xl = (w2l >>> 1 | w2h << 31) ^ (w2l >>> 8 | w2h << 24) ^ (w2l >>> 7 | w2h << 25) | 0; | |
19518 | w1l = w1l + xl | 0; | |
19519 | w1h = w1h + ((w2h >>> 1 | w2l << 31) ^ (w2h >>> 8 | w2l << 24) ^ w2h >>> 7) + (w1l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19520 | xl = (w15l >>> 19 | w15h << 13) ^ (w15l << 3 | w15h >>> 29) ^ (w15l >>> 6 | w15h << 26) | 0; | |
19521 | w1l = w1l + xl | 0; | |
19522 | w1h = w1h + ((w15h >>> 19 | w15l << 13) ^ (w15h << 3 | w15l >>> 29) ^ w15h >>> 6) + (w1l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19523 | tl = 1546045734 + w1l | 0; | |
19524 | th = 773529912 + w1h + (tl >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
19525 | tl = tl + hl | 0; | |
19526 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19527 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19528 | tl = tl + xl | 0; | |
19529 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19530 | xl = gl ^ el & (fl ^ gl) | 0; | |
19531 | tl = tl + xl | 0; | |
19532 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19533 | hl = gl; | |
19534 | hh = gh; | |
19535 | gl = fl; | |
19536 | gh = fh; | |
19537 | fl = el; | |
19538 | fh = eh; | |
19539 | el = dl + tl | 0; | |
19540 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19541 | dl = cl; | |
19542 | dh = ch; | |
19543 | cl = bl; | |
19544 | ch = bh; | |
19545 | bl = al; | |
19546 | bh = ah; | |
19547 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19548 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19549 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19550 | al = al + xl | 0; | |
19551 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19552 | w2l = w2l + w11l | 0; | |
19553 | w2h = w2h + w11h + (w2l >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
19554 | xl = (w3l >>> 1 | w3h << 31) ^ (w3l >>> 8 | w3h << 24) ^ (w3l >>> 7 | w3h << 25) | 0; | |
19555 | w2l = w2l + xl | 0; | |
19556 | w2h = w2h + ((w3h >>> 1 | w3l << 31) ^ (w3h >>> 8 | w3l << 24) ^ w3h >>> 7) + (w2l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19557 | xl = (w0l >>> 19 | w0h << 13) ^ (w0l << 3 | w0h >>> 29) ^ (w0l >>> 6 | w0h << 26) | 0; | |
19558 | w2l = w2l + xl | 0; | |
19559 | w2h = w2h + ((w0h >>> 19 | w0l << 13) ^ (w0h << 3 | w0l >>> 29) ^ w0h >>> 6) + (w2l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19560 | tl = 1522805485 + w2l | 0; | |
19561 | th = 1294757372 + w2h + (tl >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
19562 | tl = tl + hl | 0; | |
19563 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19564 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19565 | tl = tl + xl | 0; | |
19566 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19567 | xl = gl ^ el & (fl ^ gl) | 0; | |
19568 | tl = tl + xl | 0; | |
19569 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19570 | hl = gl; | |
19571 | hh = gh; | |
19572 | gl = fl; | |
19573 | gh = fh; | |
19574 | fl = el; | |
19575 | fh = eh; | |
19576 | el = dl + tl | 0; | |
19577 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19578 | dl = cl; | |
19579 | dh = ch; | |
19580 | cl = bl; | |
19581 | ch = bh; | |
19582 | bl = al; | |
19583 | bh = ah; | |
19584 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19585 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19586 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19587 | al = al + xl | 0; | |
19588 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19589 | w3l = w3l + w12l | 0; | |
19590 | w3h = w3h + w12h + (w3l >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
19591 | xl = (w4l >>> 1 | w4h << 31) ^ (w4l >>> 8 | w4h << 24) ^ (w4l >>> 7 | w4h << 25) | 0; | |
19592 | w3l = w3l + xl | 0; | |
19593 | w3h = w3h + ((w4h >>> 1 | w4l << 31) ^ (w4h >>> 8 | w4l << 24) ^ w4h >>> 7) + (w3l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19594 | xl = (w1l >>> 19 | w1h << 13) ^ (w1l << 3 | w1h >>> 29) ^ (w1l >>> 6 | w1h << 26) | 0; | |
19595 | w3l = w3l + xl | 0; | |
19596 | w3h = w3h + ((w1h >>> 19 | w1l << 13) ^ (w1h << 3 | w1l >>> 29) ^ w1h >>> 6) + (w3l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19597 | tl = 2643833823 + w3l | 0; | |
19598 | th = 1396182291 + w3h + (tl >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
19599 | tl = tl + hl | 0; | |
19600 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19601 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19602 | tl = tl + xl | 0; | |
19603 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19604 | xl = gl ^ el & (fl ^ gl) | 0; | |
19605 | tl = tl + xl | 0; | |
19606 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19607 | hl = gl; | |
19608 | hh = gh; | |
19609 | gl = fl; | |
19610 | gh = fh; | |
19611 | fl = el; | |
19612 | fh = eh; | |
19613 | el = dl + tl | 0; | |
19614 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19615 | dl = cl; | |
19616 | dh = ch; | |
19617 | cl = bl; | |
19618 | ch = bh; | |
19619 | bl = al; | |
19620 | bh = ah; | |
19621 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19622 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19623 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19624 | al = al + xl | 0; | |
19625 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19626 | w4l = w4l + w13l | 0; | |
19627 | w4h = w4h + w13h + (w4l >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
19628 | xl = (w5l >>> 1 | w5h << 31) ^ (w5l >>> 8 | w5h << 24) ^ (w5l >>> 7 | w5h << 25) | 0; | |
19629 | w4l = w4l + xl | 0; | |
19630 | w4h = w4h + ((w5h >>> 1 | w5l << 31) ^ (w5h >>> 8 | w5l << 24) ^ w5h >>> 7) + (w4l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19631 | xl = (w2l >>> 19 | w2h << 13) ^ (w2l << 3 | w2h >>> 29) ^ (w2l >>> 6 | w2h << 26) | 0; | |
19632 | w4l = w4l + xl | 0; | |
19633 | w4h = w4h + ((w2h >>> 19 | w2l << 13) ^ (w2h << 3 | w2l >>> 29) ^ w2h >>> 6) + (w4l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19634 | tl = 2343527390 + w4l | 0; | |
19635 | th = 1695183700 + w4h + (tl >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
19636 | tl = tl + hl | 0; | |
19637 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19638 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19639 | tl = tl + xl | 0; | |
19640 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19641 | xl = gl ^ el & (fl ^ gl) | 0; | |
19642 | tl = tl + xl | 0; | |
19643 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19644 | hl = gl; | |
19645 | hh = gh; | |
19646 | gl = fl; | |
19647 | gh = fh; | |
19648 | fl = el; | |
19649 | fh = eh; | |
19650 | el = dl + tl | 0; | |
19651 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19652 | dl = cl; | |
19653 | dh = ch; | |
19654 | cl = bl; | |
19655 | ch = bh; | |
19656 | bl = al; | |
19657 | bh = ah; | |
19658 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19659 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19660 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19661 | al = al + xl | 0; | |
19662 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19663 | w5l = w5l + w14l | 0; | |
19664 | w5h = w5h + w14h + (w5l >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
19665 | xl = (w6l >>> 1 | w6h << 31) ^ (w6l >>> 8 | w6h << 24) ^ (w6l >>> 7 | w6h << 25) | 0; | |
19666 | w5l = w5l + xl | 0; | |
19667 | w5h = w5h + ((w6h >>> 1 | w6l << 31) ^ (w6h >>> 8 | w6l << 24) ^ w6h >>> 7) + (w5l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19668 | xl = (w3l >>> 19 | w3h << 13) ^ (w3l << 3 | w3h >>> 29) ^ (w3l >>> 6 | w3h << 26) | 0; | |
19669 | w5l = w5l + xl | 0; | |
19670 | w5h = w5h + ((w3h >>> 19 | w3l << 13) ^ (w3h << 3 | w3l >>> 29) ^ w3h >>> 6) + (w5l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19671 | tl = 1014477480 + w5l | 0; | |
19672 | th = 1986661051 + w5h + (tl >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
19673 | tl = tl + hl | 0; | |
19674 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19675 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19676 | tl = tl + xl | 0; | |
19677 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19678 | xl = gl ^ el & (fl ^ gl) | 0; | |
19679 | tl = tl + xl | 0; | |
19680 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19681 | hl = gl; | |
19682 | hh = gh; | |
19683 | gl = fl; | |
19684 | gh = fh; | |
19685 | fl = el; | |
19686 | fh = eh; | |
19687 | el = dl + tl | 0; | |
19688 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19689 | dl = cl; | |
19690 | dh = ch; | |
19691 | cl = bl; | |
19692 | ch = bh; | |
19693 | bl = al; | |
19694 | bh = ah; | |
19695 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19696 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19697 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19698 | al = al + xl | 0; | |
19699 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19700 | w6l = w6l + w15l | 0; | |
19701 | w6h = w6h + w15h + (w6l >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
19702 | xl = (w7l >>> 1 | w7h << 31) ^ (w7l >>> 8 | w7h << 24) ^ (w7l >>> 7 | w7h << 25) | 0; | |
19703 | w6l = w6l + xl | 0; | |
19704 | w6h = w6h + ((w7h >>> 1 | w7l << 31) ^ (w7h >>> 8 | w7l << 24) ^ w7h >>> 7) + (w6l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19705 | xl = (w4l >>> 19 | w4h << 13) ^ (w4l << 3 | w4h >>> 29) ^ (w4l >>> 6 | w4h << 26) | 0; | |
19706 | w6l = w6l + xl | 0; | |
19707 | w6h = w6h + ((w4h >>> 19 | w4l << 13) ^ (w4h << 3 | w4l >>> 29) ^ w4h >>> 6) + (w6l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19708 | tl = 1206759142 + w6l | 0; | |
19709 | th = 2177026350 + w6h + (tl >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
19710 | tl = tl + hl | 0; | |
19711 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19712 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19713 | tl = tl + xl | 0; | |
19714 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19715 | xl = gl ^ el & (fl ^ gl) | 0; | |
19716 | tl = tl + xl | 0; | |
19717 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19718 | hl = gl; | |
19719 | hh = gh; | |
19720 | gl = fl; | |
19721 | gh = fh; | |
19722 | fl = el; | |
19723 | fh = eh; | |
19724 | el = dl + tl | 0; | |
19725 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19726 | dl = cl; | |
19727 | dh = ch; | |
19728 | cl = bl; | |
19729 | ch = bh; | |
19730 | bl = al; | |
19731 | bh = ah; | |
19732 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19733 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19734 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19735 | al = al + xl | 0; | |
19736 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19737 | w7l = w7l + w0l | 0; | |
19738 | w7h = w7h + w0h + (w7l >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
19739 | xl = (w8l >>> 1 | w8h << 31) ^ (w8l >>> 8 | w8h << 24) ^ (w8l >>> 7 | w8h << 25) | 0; | |
19740 | w7l = w7l + xl | 0; | |
19741 | w7h = w7h + ((w8h >>> 1 | w8l << 31) ^ (w8h >>> 8 | w8l << 24) ^ w8h >>> 7) + (w7l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19742 | xl = (w5l >>> 19 | w5h << 13) ^ (w5l << 3 | w5h >>> 29) ^ (w5l >>> 6 | w5h << 26) | 0; | |
19743 | w7l = w7l + xl | 0; | |
19744 | w7h = w7h + ((w5h >>> 19 | w5l << 13) ^ (w5h << 3 | w5l >>> 29) ^ w5h >>> 6) + (w7l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19745 | tl = 344077627 + w7l | 0; | |
19746 | th = 2456956037 + w7h + (tl >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
19747 | tl = tl + hl | 0; | |
19748 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19749 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19750 | tl = tl + xl | 0; | |
19751 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19752 | xl = gl ^ el & (fl ^ gl) | 0; | |
19753 | tl = tl + xl | 0; | |
19754 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19755 | hl = gl; | |
19756 | hh = gh; | |
19757 | gl = fl; | |
19758 | gh = fh; | |
19759 | fl = el; | |
19760 | fh = eh; | |
19761 | el = dl + tl | 0; | |
19762 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19763 | dl = cl; | |
19764 | dh = ch; | |
19765 | cl = bl; | |
19766 | ch = bh; | |
19767 | bl = al; | |
19768 | bh = ah; | |
19769 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19770 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19771 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19772 | al = al + xl | 0; | |
19773 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19774 | w8l = w8l + w1l | 0; | |
19775 | w8h = w8h + w1h + (w8l >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
19776 | xl = (w9l >>> 1 | w9h << 31) ^ (w9l >>> 8 | w9h << 24) ^ (w9l >>> 7 | w9h << 25) | 0; | |
19777 | w8l = w8l + xl | 0; | |
19778 | w8h = w8h + ((w9h >>> 1 | w9l << 31) ^ (w9h >>> 8 | w9l << 24) ^ w9h >>> 7) + (w8l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19779 | xl = (w6l >>> 19 | w6h << 13) ^ (w6l << 3 | w6h >>> 29) ^ (w6l >>> 6 | w6h << 26) | 0; | |
19780 | w8l = w8l + xl | 0; | |
19781 | w8h = w8h + ((w6h >>> 19 | w6l << 13) ^ (w6h << 3 | w6l >>> 29) ^ w6h >>> 6) + (w8l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19782 | tl = 1290863460 + w8l | 0; | |
19783 | th = 2730485921 + w8h + (tl >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
19784 | tl = tl + hl | 0; | |
19785 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19786 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19787 | tl = tl + xl | 0; | |
19788 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19789 | xl = gl ^ el & (fl ^ gl) | 0; | |
19790 | tl = tl + xl | 0; | |
19791 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19792 | hl = gl; | |
19793 | hh = gh; | |
19794 | gl = fl; | |
19795 | gh = fh; | |
19796 | fl = el; | |
19797 | fh = eh; | |
19798 | el = dl + tl | 0; | |
19799 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19800 | dl = cl; | |
19801 | dh = ch; | |
19802 | cl = bl; | |
19803 | ch = bh; | |
19804 | bl = al; | |
19805 | bh = ah; | |
19806 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19807 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19808 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19809 | al = al + xl | 0; | |
19810 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19811 | w9l = w9l + w2l | 0; | |
19812 | w9h = w9h + w2h + (w9l >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
19813 | xl = (w10l >>> 1 | w10h << 31) ^ (w10l >>> 8 | w10h << 24) ^ (w10l >>> 7 | w10h << 25) | 0; | |
19814 | w9l = w9l + xl | 0; | |
19815 | w9h = w9h + ((w10h >>> 1 | w10l << 31) ^ (w10h >>> 8 | w10l << 24) ^ w10h >>> 7) + (w9l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19816 | xl = (w7l >>> 19 | w7h << 13) ^ (w7l << 3 | w7h >>> 29) ^ (w7l >>> 6 | w7h << 26) | 0; | |
19817 | w9l = w9l + xl | 0; | |
19818 | w9h = w9h + ((w7h >>> 19 | w7l << 13) ^ (w7h << 3 | w7l >>> 29) ^ w7h >>> 6) + (w9l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19819 | tl = 3158454273 + w9l | 0; | |
19820 | th = 2820302411 + w9h + (tl >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
19821 | tl = tl + hl | 0; | |
19822 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19823 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19824 | tl = tl + xl | 0; | |
19825 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19826 | xl = gl ^ el & (fl ^ gl) | 0; | |
19827 | tl = tl + xl | 0; | |
19828 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19829 | hl = gl; | |
19830 | hh = gh; | |
19831 | gl = fl; | |
19832 | gh = fh; | |
19833 | fl = el; | |
19834 | fh = eh; | |
19835 | el = dl + tl | 0; | |
19836 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19837 | dl = cl; | |
19838 | dh = ch; | |
19839 | cl = bl; | |
19840 | ch = bh; | |
19841 | bl = al; | |
19842 | bh = ah; | |
19843 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19844 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19845 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19846 | al = al + xl | 0; | |
19847 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19848 | w10l = w10l + w3l | 0; | |
19849 | w10h = w10h + w3h + (w10l >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
19850 | xl = (w11l >>> 1 | w11h << 31) ^ (w11l >>> 8 | w11h << 24) ^ (w11l >>> 7 | w11h << 25) | 0; | |
19851 | w10l = w10l + xl | 0; | |
19852 | w10h = w10h + ((w11h >>> 1 | w11l << 31) ^ (w11h >>> 8 | w11l << 24) ^ w11h >>> 7) + (w10l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19853 | xl = (w8l >>> 19 | w8h << 13) ^ (w8l << 3 | w8h >>> 29) ^ (w8l >>> 6 | w8h << 26) | 0; | |
19854 | w10l = w10l + xl | 0; | |
19855 | w10h = w10h + ((w8h >>> 19 | w8l << 13) ^ (w8h << 3 | w8l >>> 29) ^ w8h >>> 6) + (w10l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19856 | tl = 3505952657 + w10l | 0; | |
19857 | th = 3259730800 + w10h + (tl >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
19858 | tl = tl + hl | 0; | |
19859 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19860 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19861 | tl = tl + xl | 0; | |
19862 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19863 | xl = gl ^ el & (fl ^ gl) | 0; | |
19864 | tl = tl + xl | 0; | |
19865 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19866 | hl = gl; | |
19867 | hh = gh; | |
19868 | gl = fl; | |
19869 | gh = fh; | |
19870 | fl = el; | |
19871 | fh = eh; | |
19872 | el = dl + tl | 0; | |
19873 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19874 | dl = cl; | |
19875 | dh = ch; | |
19876 | cl = bl; | |
19877 | ch = bh; | |
19878 | bl = al; | |
19879 | bh = ah; | |
19880 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19881 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19882 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19883 | al = al + xl | 0; | |
19884 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19885 | w11l = w11l + w4l | 0; | |
19886 | w11h = w11h + w4h + (w11l >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
19887 | xl = (w12l >>> 1 | w12h << 31) ^ (w12l >>> 8 | w12h << 24) ^ (w12l >>> 7 | w12h << 25) | 0; | |
19888 | w11l = w11l + xl | 0; | |
19889 | w11h = w11h + ((w12h >>> 1 | w12l << 31) ^ (w12h >>> 8 | w12l << 24) ^ w12h >>> 7) + (w11l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19890 | xl = (w9l >>> 19 | w9h << 13) ^ (w9l << 3 | w9h >>> 29) ^ (w9l >>> 6 | w9h << 26) | 0; | |
19891 | w11l = w11l + xl | 0; | |
19892 | w11h = w11h + ((w9h >>> 19 | w9l << 13) ^ (w9h << 3 | w9l >>> 29) ^ w9h >>> 6) + (w11l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19893 | tl = 106217008 + w11l | 0; | |
19894 | th = 3345764771 + w11h + (tl >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
19895 | tl = tl + hl | 0; | |
19896 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19897 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19898 | tl = tl + xl | 0; | |
19899 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19900 | xl = gl ^ el & (fl ^ gl) | 0; | |
19901 | tl = tl + xl | 0; | |
19902 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19903 | hl = gl; | |
19904 | hh = gh; | |
19905 | gl = fl; | |
19906 | gh = fh; | |
19907 | fl = el; | |
19908 | fh = eh; | |
19909 | el = dl + tl | 0; | |
19910 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19911 | dl = cl; | |
19912 | dh = ch; | |
19913 | cl = bl; | |
19914 | ch = bh; | |
19915 | bl = al; | |
19916 | bh = ah; | |
19917 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19918 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19919 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19920 | al = al + xl | 0; | |
19921 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19922 | w12l = w12l + w5l | 0; | |
19923 | w12h = w12h + w5h + (w12l >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
19924 | xl = (w13l >>> 1 | w13h << 31) ^ (w13l >>> 8 | w13h << 24) ^ (w13l >>> 7 | w13h << 25) | 0; | |
19925 | w12l = w12l + xl | 0; | |
19926 | w12h = w12h + ((w13h >>> 1 | w13l << 31) ^ (w13h >>> 8 | w13l << 24) ^ w13h >>> 7) + (w12l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19927 | xl = (w10l >>> 19 | w10h << 13) ^ (w10l << 3 | w10h >>> 29) ^ (w10l >>> 6 | w10h << 26) | 0; | |
19928 | w12l = w12l + xl | 0; | |
19929 | w12h = w12h + ((w10h >>> 19 | w10l << 13) ^ (w10h << 3 | w10l >>> 29) ^ w10h >>> 6) + (w12l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19930 | tl = 3606008344 + w12l | 0; | |
19931 | th = 3516065817 + w12h + (tl >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
19932 | tl = tl + hl | 0; | |
19933 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19934 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19935 | tl = tl + xl | 0; | |
19936 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19937 | xl = gl ^ el & (fl ^ gl) | 0; | |
19938 | tl = tl + xl | 0; | |
19939 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19940 | hl = gl; | |
19941 | hh = gh; | |
19942 | gl = fl; | |
19943 | gh = fh; | |
19944 | fl = el; | |
19945 | fh = eh; | |
19946 | el = dl + tl | 0; | |
19947 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19948 | dl = cl; | |
19949 | dh = ch; | |
19950 | cl = bl; | |
19951 | ch = bh; | |
19952 | bl = al; | |
19953 | bh = ah; | |
19954 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19955 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19956 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19957 | al = al + xl | 0; | |
19958 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19959 | w13l = w13l + w6l | 0; | |
19960 | w13h = w13h + w6h + (w13l >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
19961 | xl = (w14l >>> 1 | w14h << 31) ^ (w14l >>> 8 | w14h << 24) ^ (w14l >>> 7 | w14h << 25) | 0; | |
19962 | w13l = w13l + xl | 0; | |
19963 | w13h = w13h + ((w14h >>> 1 | w14l << 31) ^ (w14h >>> 8 | w14l << 24) ^ w14h >>> 7) + (w13l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19964 | xl = (w11l >>> 19 | w11h << 13) ^ (w11l << 3 | w11h >>> 29) ^ (w11l >>> 6 | w11h << 26) | 0; | |
19965 | w13l = w13l + xl | 0; | |
19966 | w13h = w13h + ((w11h >>> 19 | w11l << 13) ^ (w11h << 3 | w11l >>> 29) ^ w11h >>> 6) + (w13l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19967 | tl = 1432725776 + w13l | 0; | |
19968 | th = 3600352804 + w13h + (tl >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
19969 | tl = tl + hl | 0; | |
19970 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
19971 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
19972 | tl = tl + xl | 0; | |
19973 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19974 | xl = gl ^ el & (fl ^ gl) | 0; | |
19975 | tl = tl + xl | 0; | |
19976 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19977 | hl = gl; | |
19978 | hh = gh; | |
19979 | gl = fl; | |
19980 | gh = fh; | |
19981 | fl = el; | |
19982 | fh = eh; | |
19983 | el = dl + tl | 0; | |
19984 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
19985 | dl = cl; | |
19986 | dh = ch; | |
19987 | cl = bl; | |
19988 | ch = bh; | |
19989 | bl = al; | |
19990 | bh = ah; | |
19991 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
19992 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
19993 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
19994 | al = al + xl | 0; | |
19995 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
19996 | w14l = w14l + w7l | 0; | |
19997 | w14h = w14h + w7h + (w14l >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
19998 | xl = (w15l >>> 1 | w15h << 31) ^ (w15l >>> 8 | w15h << 24) ^ (w15l >>> 7 | w15h << 25) | 0; | |
19999 | w14l = w14l + xl | 0; | |
20000 | w14h = w14h + ((w15h >>> 1 | w15l << 31) ^ (w15h >>> 8 | w15l << 24) ^ w15h >>> 7) + (w14l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20001 | xl = (w12l >>> 19 | w12h << 13) ^ (w12l << 3 | w12h >>> 29) ^ (w12l >>> 6 | w12h << 26) | 0; | |
20002 | w14l = w14l + xl | 0; | |
20003 | w14h = w14h + ((w12h >>> 19 | w12l << 13) ^ (w12h << 3 | w12l >>> 29) ^ w12h >>> 6) + (w14l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20004 | tl = 1467031594 + w14l | 0; | |
20005 | th = 4094571909 + w14h + (tl >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
20006 | tl = tl + hl | 0; | |
20007 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20008 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20009 | tl = tl + xl | 0; | |
20010 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20011 | xl = gl ^ el & (fl ^ gl) | 0; | |
20012 | tl = tl + xl | 0; | |
20013 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20014 | hl = gl; | |
20015 | hh = gh; | |
20016 | gl = fl; | |
20017 | gh = fh; | |
20018 | fl = el; | |
20019 | fh = eh; | |
20020 | el = dl + tl | 0; | |
20021 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20022 | dl = cl; | |
20023 | dh = ch; | |
20024 | cl = bl; | |
20025 | ch = bh; | |
20026 | bl = al; | |
20027 | bh = ah; | |
20028 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20029 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20030 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20031 | al = al + xl | 0; | |
20032 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20033 | w15l = w15l + w8l | 0; | |
20034 | w15h = w15h + w8h + (w15l >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
20035 | xl = (w0l >>> 1 | w0h << 31) ^ (w0l >>> 8 | w0h << 24) ^ (w0l >>> 7 | w0h << 25) | 0; | |
20036 | w15l = w15l + xl | 0; | |
20037 | w15h = w15h + ((w0h >>> 1 | w0l << 31) ^ (w0h >>> 8 | w0l << 24) ^ w0h >>> 7) + (w15l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20038 | xl = (w13l >>> 19 | w13h << 13) ^ (w13l << 3 | w13h >>> 29) ^ (w13l >>> 6 | w13h << 26) | 0; | |
20039 | w15l = w15l + xl | 0; | |
20040 | w15h = w15h + ((w13h >>> 19 | w13l << 13) ^ (w13h << 3 | w13l >>> 29) ^ w13h >>> 6) + (w15l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20041 | tl = 851169720 + w15l | 0; | |
20042 | th = 275423344 + w15h + (tl >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
20043 | tl = tl + hl | 0; | |
20044 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20045 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20046 | tl = tl + xl | 0; | |
20047 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20048 | xl = gl ^ el & (fl ^ gl) | 0; | |
20049 | tl = tl + xl | 0; | |
20050 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20051 | hl = gl; | |
20052 | hh = gh; | |
20053 | gl = fl; | |
20054 | gh = fh; | |
20055 | fl = el; | |
20056 | fh = eh; | |
20057 | el = dl + tl | 0; | |
20058 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20059 | dl = cl; | |
20060 | dh = ch; | |
20061 | cl = bl; | |
20062 | ch = bh; | |
20063 | bl = al; | |
20064 | bh = ah; | |
20065 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20066 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20067 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20068 | al = al + xl | 0; | |
20069 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20070 | w0l = w0l + w9l | 0; | |
20071 | w0h = w0h + w9h + (w0l >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
20072 | xl = (w1l >>> 1 | w1h << 31) ^ (w1l >>> 8 | w1h << 24) ^ (w1l >>> 7 | w1h << 25) | 0; | |
20073 | w0l = w0l + xl | 0; | |
20074 | w0h = w0h + ((w1h >>> 1 | w1l << 31) ^ (w1h >>> 8 | w1l << 24) ^ w1h >>> 7) + (w0l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20075 | xl = (w14l >>> 19 | w14h << 13) ^ (w14l << 3 | w14h >>> 29) ^ (w14l >>> 6 | w14h << 26) | 0; | |
20076 | w0l = w0l + xl | 0; | |
20077 | w0h = w0h + ((w14h >>> 19 | w14l << 13) ^ (w14h << 3 | w14l >>> 29) ^ w14h >>> 6) + (w0l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20078 | tl = 3100823752 + w0l | 0; | |
20079 | th = 430227734 + w0h + (tl >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
20080 | tl = tl + hl | 0; | |
20081 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20082 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20083 | tl = tl + xl | 0; | |
20084 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20085 | xl = gl ^ el & (fl ^ gl) | 0; | |
20086 | tl = tl + xl | 0; | |
20087 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20088 | hl = gl; | |
20089 | hh = gh; | |
20090 | gl = fl; | |
20091 | gh = fh; | |
20092 | fl = el; | |
20093 | fh = eh; | |
20094 | el = dl + tl | 0; | |
20095 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20096 | dl = cl; | |
20097 | dh = ch; | |
20098 | cl = bl; | |
20099 | ch = bh; | |
20100 | bl = al; | |
20101 | bh = ah; | |
20102 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20103 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20104 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20105 | al = al + xl | 0; | |
20106 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20107 | w1l = w1l + w10l | 0; | |
20108 | w1h = w1h + w10h + (w1l >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
20109 | xl = (w2l >>> 1 | w2h << 31) ^ (w2l >>> 8 | w2h << 24) ^ (w2l >>> 7 | w2h << 25) | 0; | |
20110 | w1l = w1l + xl | 0; | |
20111 | w1h = w1h + ((w2h >>> 1 | w2l << 31) ^ (w2h >>> 8 | w2l << 24) ^ w2h >>> 7) + (w1l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20112 | xl = (w15l >>> 19 | w15h << 13) ^ (w15l << 3 | w15h >>> 29) ^ (w15l >>> 6 | w15h << 26) | 0; | |
20113 | w1l = w1l + xl | 0; | |
20114 | w1h = w1h + ((w15h >>> 19 | w15l << 13) ^ (w15h << 3 | w15l >>> 29) ^ w15h >>> 6) + (w1l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20115 | tl = 1363258195 + w1l | 0; | |
20116 | th = 506948616 + w1h + (tl >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
20117 | tl = tl + hl | 0; | |
20118 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20119 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20120 | tl = tl + xl | 0; | |
20121 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20122 | xl = gl ^ el & (fl ^ gl) | 0; | |
20123 | tl = tl + xl | 0; | |
20124 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20125 | hl = gl; | |
20126 | hh = gh; | |
20127 | gl = fl; | |
20128 | gh = fh; | |
20129 | fl = el; | |
20130 | fh = eh; | |
20131 | el = dl + tl | 0; | |
20132 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20133 | dl = cl; | |
20134 | dh = ch; | |
20135 | cl = bl; | |
20136 | ch = bh; | |
20137 | bl = al; | |
20138 | bh = ah; | |
20139 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20140 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20141 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20142 | al = al + xl | 0; | |
20143 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20144 | w2l = w2l + w11l | 0; | |
20145 | w2h = w2h + w11h + (w2l >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
20146 | xl = (w3l >>> 1 | w3h << 31) ^ (w3l >>> 8 | w3h << 24) ^ (w3l >>> 7 | w3h << 25) | 0; | |
20147 | w2l = w2l + xl | 0; | |
20148 | w2h = w2h + ((w3h >>> 1 | w3l << 31) ^ (w3h >>> 8 | w3l << 24) ^ w3h >>> 7) + (w2l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20149 | xl = (w0l >>> 19 | w0h << 13) ^ (w0l << 3 | w0h >>> 29) ^ (w0l >>> 6 | w0h << 26) | 0; | |
20150 | w2l = w2l + xl | 0; | |
20151 | w2h = w2h + ((w0h >>> 19 | w0l << 13) ^ (w0h << 3 | w0l >>> 29) ^ w0h >>> 6) + (w2l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20152 | tl = 3750685593 + w2l | 0; | |
20153 | th = 659060556 + w2h + (tl >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
20154 | tl = tl + hl | 0; | |
20155 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20156 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20157 | tl = tl + xl | 0; | |
20158 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20159 | xl = gl ^ el & (fl ^ gl) | 0; | |
20160 | tl = tl + xl | 0; | |
20161 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20162 | hl = gl; | |
20163 | hh = gh; | |
20164 | gl = fl; | |
20165 | gh = fh; | |
20166 | fl = el; | |
20167 | fh = eh; | |
20168 | el = dl + tl | 0; | |
20169 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20170 | dl = cl; | |
20171 | dh = ch; | |
20172 | cl = bl; | |
20173 | ch = bh; | |
20174 | bl = al; | |
20175 | bh = ah; | |
20176 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20177 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20178 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20179 | al = al + xl | 0; | |
20180 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20181 | w3l = w3l + w12l | 0; | |
20182 | w3h = w3h + w12h + (w3l >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
20183 | xl = (w4l >>> 1 | w4h << 31) ^ (w4l >>> 8 | w4h << 24) ^ (w4l >>> 7 | w4h << 25) | 0; | |
20184 | w3l = w3l + xl | 0; | |
20185 | w3h = w3h + ((w4h >>> 1 | w4l << 31) ^ (w4h >>> 8 | w4l << 24) ^ w4h >>> 7) + (w3l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20186 | xl = (w1l >>> 19 | w1h << 13) ^ (w1l << 3 | w1h >>> 29) ^ (w1l >>> 6 | w1h << 26) | 0; | |
20187 | w3l = w3l + xl | 0; | |
20188 | w3h = w3h + ((w1h >>> 19 | w1l << 13) ^ (w1h << 3 | w1l >>> 29) ^ w1h >>> 6) + (w3l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20189 | tl = 3785050280 + w3l | 0; | |
20190 | th = 883997877 + w3h + (tl >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
20191 | tl = tl + hl | 0; | |
20192 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20193 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20194 | tl = tl + xl | 0; | |
20195 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20196 | xl = gl ^ el & (fl ^ gl) | 0; | |
20197 | tl = tl + xl | 0; | |
20198 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20199 | hl = gl; | |
20200 | hh = gh; | |
20201 | gl = fl; | |
20202 | gh = fh; | |
20203 | fl = el; | |
20204 | fh = eh; | |
20205 | el = dl + tl | 0; | |
20206 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20207 | dl = cl; | |
20208 | dh = ch; | |
20209 | cl = bl; | |
20210 | ch = bh; | |
20211 | bl = al; | |
20212 | bh = ah; | |
20213 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20214 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20215 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20216 | al = al + xl | 0; | |
20217 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20218 | w4l = w4l + w13l | 0; | |
20219 | w4h = w4h + w13h + (w4l >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
20220 | xl = (w5l >>> 1 | w5h << 31) ^ (w5l >>> 8 | w5h << 24) ^ (w5l >>> 7 | w5h << 25) | 0; | |
20221 | w4l = w4l + xl | 0; | |
20222 | w4h = w4h + ((w5h >>> 1 | w5l << 31) ^ (w5h >>> 8 | w5l << 24) ^ w5h >>> 7) + (w4l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20223 | xl = (w2l >>> 19 | w2h << 13) ^ (w2l << 3 | w2h >>> 29) ^ (w2l >>> 6 | w2h << 26) | 0; | |
20224 | w4l = w4l + xl | 0; | |
20225 | w4h = w4h + ((w2h >>> 19 | w2l << 13) ^ (w2h << 3 | w2l >>> 29) ^ w2h >>> 6) + (w4l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20226 | tl = 3318307427 + w4l | 0; | |
20227 | th = 958139571 + w4h + (tl >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
20228 | tl = tl + hl | 0; | |
20229 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20230 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20231 | tl = tl + xl | 0; | |
20232 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20233 | xl = gl ^ el & (fl ^ gl) | 0; | |
20234 | tl = tl + xl | 0; | |
20235 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20236 | hl = gl; | |
20237 | hh = gh; | |
20238 | gl = fl; | |
20239 | gh = fh; | |
20240 | fl = el; | |
20241 | fh = eh; | |
20242 | el = dl + tl | 0; | |
20243 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20244 | dl = cl; | |
20245 | dh = ch; | |
20246 | cl = bl; | |
20247 | ch = bh; | |
20248 | bl = al; | |
20249 | bh = ah; | |
20250 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20251 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20252 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20253 | al = al + xl | 0; | |
20254 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20255 | w5l = w5l + w14l | 0; | |
20256 | w5h = w5h + w14h + (w5l >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
20257 | xl = (w6l >>> 1 | w6h << 31) ^ (w6l >>> 8 | w6h << 24) ^ (w6l >>> 7 | w6h << 25) | 0; | |
20258 | w5l = w5l + xl | 0; | |
20259 | w5h = w5h + ((w6h >>> 1 | w6l << 31) ^ (w6h >>> 8 | w6l << 24) ^ w6h >>> 7) + (w5l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20260 | xl = (w3l >>> 19 | w3h << 13) ^ (w3l << 3 | w3h >>> 29) ^ (w3l >>> 6 | w3h << 26) | 0; | |
20261 | w5l = w5l + xl | 0; | |
20262 | w5h = w5h + ((w3h >>> 19 | w3l << 13) ^ (w3h << 3 | w3l >>> 29) ^ w3h >>> 6) + (w5l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20263 | tl = 3812723403 + w5l | 0; | |
20264 | th = 1322822218 + w5h + (tl >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
20265 | tl = tl + hl | 0; | |
20266 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20267 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20268 | tl = tl + xl | 0; | |
20269 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20270 | xl = gl ^ el & (fl ^ gl) | 0; | |
20271 | tl = tl + xl | 0; | |
20272 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20273 | hl = gl; | |
20274 | hh = gh; | |
20275 | gl = fl; | |
20276 | gh = fh; | |
20277 | fl = el; | |
20278 | fh = eh; | |
20279 | el = dl + tl | 0; | |
20280 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20281 | dl = cl; | |
20282 | dh = ch; | |
20283 | cl = bl; | |
20284 | ch = bh; | |
20285 | bl = al; | |
20286 | bh = ah; | |
20287 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20288 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20289 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20290 | al = al + xl | 0; | |
20291 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20292 | w6l = w6l + w15l | 0; | |
20293 | w6h = w6h + w15h + (w6l >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
20294 | xl = (w7l >>> 1 | w7h << 31) ^ (w7l >>> 8 | w7h << 24) ^ (w7l >>> 7 | w7h << 25) | 0; | |
20295 | w6l = w6l + xl | 0; | |
20296 | w6h = w6h + ((w7h >>> 1 | w7l << 31) ^ (w7h >>> 8 | w7l << 24) ^ w7h >>> 7) + (w6l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20297 | xl = (w4l >>> 19 | w4h << 13) ^ (w4l << 3 | w4h >>> 29) ^ (w4l >>> 6 | w4h << 26) | 0; | |
20298 | w6l = w6l + xl | 0; | |
20299 | w6h = w6h + ((w4h >>> 19 | w4l << 13) ^ (w4h << 3 | w4l >>> 29) ^ w4h >>> 6) + (w6l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20300 | tl = 2003034995 + w6l | 0; | |
20301 | th = 1537002063 + w6h + (tl >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
20302 | tl = tl + hl | 0; | |
20303 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20304 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20305 | tl = tl + xl | 0; | |
20306 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20307 | xl = gl ^ el & (fl ^ gl) | 0; | |
20308 | tl = tl + xl | 0; | |
20309 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20310 | hl = gl; | |
20311 | hh = gh; | |
20312 | gl = fl; | |
20313 | gh = fh; | |
20314 | fl = el; | |
20315 | fh = eh; | |
20316 | el = dl + tl | 0; | |
20317 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20318 | dl = cl; | |
20319 | dh = ch; | |
20320 | cl = bl; | |
20321 | ch = bh; | |
20322 | bl = al; | |
20323 | bh = ah; | |
20324 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20325 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20326 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20327 | al = al + xl | 0; | |
20328 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20329 | w7l = w7l + w0l | 0; | |
20330 | w7h = w7h + w0h + (w7l >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
20331 | xl = (w8l >>> 1 | w8h << 31) ^ (w8l >>> 8 | w8h << 24) ^ (w8l >>> 7 | w8h << 25) | 0; | |
20332 | w7l = w7l + xl | 0; | |
20333 | w7h = w7h + ((w8h >>> 1 | w8l << 31) ^ (w8h >>> 8 | w8l << 24) ^ w8h >>> 7) + (w7l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20334 | xl = (w5l >>> 19 | w5h << 13) ^ (w5l << 3 | w5h >>> 29) ^ (w5l >>> 6 | w5h << 26) | 0; | |
20335 | w7l = w7l + xl | 0; | |
20336 | w7h = w7h + ((w5h >>> 19 | w5l << 13) ^ (w5h << 3 | w5l >>> 29) ^ w5h >>> 6) + (w7l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20337 | tl = 3602036899 + w7l | 0; | |
20338 | th = 1747873779 + w7h + (tl >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
20339 | tl = tl + hl | 0; | |
20340 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20341 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20342 | tl = tl + xl | 0; | |
20343 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20344 | xl = gl ^ el & (fl ^ gl) | 0; | |
20345 | tl = tl + xl | 0; | |
20346 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20347 | hl = gl; | |
20348 | hh = gh; | |
20349 | gl = fl; | |
20350 | gh = fh; | |
20351 | fl = el; | |
20352 | fh = eh; | |
20353 | el = dl + tl | 0; | |
20354 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20355 | dl = cl; | |
20356 | dh = ch; | |
20357 | cl = bl; | |
20358 | ch = bh; | |
20359 | bl = al; | |
20360 | bh = ah; | |
20361 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20362 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20363 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20364 | al = al + xl | 0; | |
20365 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20366 | w8l = w8l + w1l | 0; | |
20367 | w8h = w8h + w1h + (w8l >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
20368 | xl = (w9l >>> 1 | w9h << 31) ^ (w9l >>> 8 | w9h << 24) ^ (w9l >>> 7 | w9h << 25) | 0; | |
20369 | w8l = w8l + xl | 0; | |
20370 | w8h = w8h + ((w9h >>> 1 | w9l << 31) ^ (w9h >>> 8 | w9l << 24) ^ w9h >>> 7) + (w8l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20371 | xl = (w6l >>> 19 | w6h << 13) ^ (w6l << 3 | w6h >>> 29) ^ (w6l >>> 6 | w6h << 26) | 0; | |
20372 | w8l = w8l + xl | 0; | |
20373 | w8h = w8h + ((w6h >>> 19 | w6l << 13) ^ (w6h << 3 | w6l >>> 29) ^ w6h >>> 6) + (w8l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20374 | tl = 1575990012 + w8l | 0; | |
20375 | th = 1955562222 + w8h + (tl >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
20376 | tl = tl + hl | 0; | |
20377 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20378 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20379 | tl = tl + xl | 0; | |
20380 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20381 | xl = gl ^ el & (fl ^ gl) | 0; | |
20382 | tl = tl + xl | 0; | |
20383 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20384 | hl = gl; | |
20385 | hh = gh; | |
20386 | gl = fl; | |
20387 | gh = fh; | |
20388 | fl = el; | |
20389 | fh = eh; | |
20390 | el = dl + tl | 0; | |
20391 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20392 | dl = cl; | |
20393 | dh = ch; | |
20394 | cl = bl; | |
20395 | ch = bh; | |
20396 | bl = al; | |
20397 | bh = ah; | |
20398 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20399 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20400 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20401 | al = al + xl | 0; | |
20402 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20403 | w9l = w9l + w2l | 0; | |
20404 | w9h = w9h + w2h + (w9l >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
20405 | xl = (w10l >>> 1 | w10h << 31) ^ (w10l >>> 8 | w10h << 24) ^ (w10l >>> 7 | w10h << 25) | 0; | |
20406 | w9l = w9l + xl | 0; | |
20407 | w9h = w9h + ((w10h >>> 1 | w10l << 31) ^ (w10h >>> 8 | w10l << 24) ^ w10h >>> 7) + (w9l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20408 | xl = (w7l >>> 19 | w7h << 13) ^ (w7l << 3 | w7h >>> 29) ^ (w7l >>> 6 | w7h << 26) | 0; | |
20409 | w9l = w9l + xl | 0; | |
20410 | w9h = w9h + ((w7h >>> 19 | w7l << 13) ^ (w7h << 3 | w7l >>> 29) ^ w7h >>> 6) + (w9l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20411 | tl = 1125592928 + w9l | 0; | |
20412 | th = 2024104815 + w9h + (tl >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
20413 | tl = tl + hl | 0; | |
20414 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20415 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20416 | tl = tl + xl | 0; | |
20417 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20418 | xl = gl ^ el & (fl ^ gl) | 0; | |
20419 | tl = tl + xl | 0; | |
20420 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20421 | hl = gl; | |
20422 | hh = gh; | |
20423 | gl = fl; | |
20424 | gh = fh; | |
20425 | fl = el; | |
20426 | fh = eh; | |
20427 | el = dl + tl | 0; | |
20428 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20429 | dl = cl; | |
20430 | dh = ch; | |
20431 | cl = bl; | |
20432 | ch = bh; | |
20433 | bl = al; | |
20434 | bh = ah; | |
20435 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20436 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20437 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20438 | al = al + xl | 0; | |
20439 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20440 | w10l = w10l + w3l | 0; | |
20441 | w10h = w10h + w3h + (w10l >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
20442 | xl = (w11l >>> 1 | w11h << 31) ^ (w11l >>> 8 | w11h << 24) ^ (w11l >>> 7 | w11h << 25) | 0; | |
20443 | w10l = w10l + xl | 0; | |
20444 | w10h = w10h + ((w11h >>> 1 | w11l << 31) ^ (w11h >>> 8 | w11l << 24) ^ w11h >>> 7) + (w10l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20445 | xl = (w8l >>> 19 | w8h << 13) ^ (w8l << 3 | w8h >>> 29) ^ (w8l >>> 6 | w8h << 26) | 0; | |
20446 | w10l = w10l + xl | 0; | |
20447 | w10h = w10h + ((w8h >>> 19 | w8l << 13) ^ (w8h << 3 | w8l >>> 29) ^ w8h >>> 6) + (w10l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20448 | tl = 2716904306 + w10l | 0; | |
20449 | th = 2227730452 + w10h + (tl >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
20450 | tl = tl + hl | 0; | |
20451 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20452 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20453 | tl = tl + xl | 0; | |
20454 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20455 | xl = gl ^ el & (fl ^ gl) | 0; | |
20456 | tl = tl + xl | 0; | |
20457 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20458 | hl = gl; | |
20459 | hh = gh; | |
20460 | gl = fl; | |
20461 | gh = fh; | |
20462 | fl = el; | |
20463 | fh = eh; | |
20464 | el = dl + tl | 0; | |
20465 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20466 | dl = cl; | |
20467 | dh = ch; | |
20468 | cl = bl; | |
20469 | ch = bh; | |
20470 | bl = al; | |
20471 | bh = ah; | |
20472 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20473 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20474 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20475 | al = al + xl | 0; | |
20476 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20477 | w11l = w11l + w4l | 0; | |
20478 | w11h = w11h + w4h + (w11l >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
20479 | xl = (w12l >>> 1 | w12h << 31) ^ (w12l >>> 8 | w12h << 24) ^ (w12l >>> 7 | w12h << 25) | 0; | |
20480 | w11l = w11l + xl | 0; | |
20481 | w11h = w11h + ((w12h >>> 1 | w12l << 31) ^ (w12h >>> 8 | w12l << 24) ^ w12h >>> 7) + (w11l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20482 | xl = (w9l >>> 19 | w9h << 13) ^ (w9l << 3 | w9h >>> 29) ^ (w9l >>> 6 | w9h << 26) | 0; | |
20483 | w11l = w11l + xl | 0; | |
20484 | w11h = w11h + ((w9h >>> 19 | w9l << 13) ^ (w9h << 3 | w9l >>> 29) ^ w9h >>> 6) + (w11l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20485 | tl = 442776044 + w11l | 0; | |
20486 | th = 2361852424 + w11h + (tl >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
20487 | tl = tl + hl | 0; | |
20488 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20489 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20490 | tl = tl + xl | 0; | |
20491 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20492 | xl = gl ^ el & (fl ^ gl) | 0; | |
20493 | tl = tl + xl | 0; | |
20494 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20495 | hl = gl; | |
20496 | hh = gh; | |
20497 | gl = fl; | |
20498 | gh = fh; | |
20499 | fl = el; | |
20500 | fh = eh; | |
20501 | el = dl + tl | 0; | |
20502 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20503 | dl = cl; | |
20504 | dh = ch; | |
20505 | cl = bl; | |
20506 | ch = bh; | |
20507 | bl = al; | |
20508 | bh = ah; | |
20509 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20510 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20511 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20512 | al = al + xl | 0; | |
20513 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20514 | w12l = w12l + w5l | 0; | |
20515 | w12h = w12h + w5h + (w12l >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
20516 | xl = (w13l >>> 1 | w13h << 31) ^ (w13l >>> 8 | w13h << 24) ^ (w13l >>> 7 | w13h << 25) | 0; | |
20517 | w12l = w12l + xl | 0; | |
20518 | w12h = w12h + ((w13h >>> 1 | w13l << 31) ^ (w13h >>> 8 | w13l << 24) ^ w13h >>> 7) + (w12l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20519 | xl = (w10l >>> 19 | w10h << 13) ^ (w10l << 3 | w10h >>> 29) ^ (w10l >>> 6 | w10h << 26) | 0; | |
20520 | w12l = w12l + xl | 0; | |
20521 | w12h = w12h + ((w10h >>> 19 | w10l << 13) ^ (w10h << 3 | w10l >>> 29) ^ w10h >>> 6) + (w12l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20522 | tl = 593698344 + w12l | 0; | |
20523 | th = 2428436474 + w12h + (tl >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
20524 | tl = tl + hl | 0; | |
20525 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20526 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20527 | tl = tl + xl | 0; | |
20528 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20529 | xl = gl ^ el & (fl ^ gl) | 0; | |
20530 | tl = tl + xl | 0; | |
20531 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20532 | hl = gl; | |
20533 | hh = gh; | |
20534 | gl = fl; | |
20535 | gh = fh; | |
20536 | fl = el; | |
20537 | fh = eh; | |
20538 | el = dl + tl | 0; | |
20539 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20540 | dl = cl; | |
20541 | dh = ch; | |
20542 | cl = bl; | |
20543 | ch = bh; | |
20544 | bl = al; | |
20545 | bh = ah; | |
20546 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20547 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20548 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20549 | al = al + xl | 0; | |
20550 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20551 | w13l = w13l + w6l | 0; | |
20552 | w13h = w13h + w6h + (w13l >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
20553 | xl = (w14l >>> 1 | w14h << 31) ^ (w14l >>> 8 | w14h << 24) ^ (w14l >>> 7 | w14h << 25) | 0; | |
20554 | w13l = w13l + xl | 0; | |
20555 | w13h = w13h + ((w14h >>> 1 | w14l << 31) ^ (w14h >>> 8 | w14l << 24) ^ w14h >>> 7) + (w13l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20556 | xl = (w11l >>> 19 | w11h << 13) ^ (w11l << 3 | w11h >>> 29) ^ (w11l >>> 6 | w11h << 26) | 0; | |
20557 | w13l = w13l + xl | 0; | |
20558 | w13h = w13h + ((w11h >>> 19 | w11l << 13) ^ (w11h << 3 | w11l >>> 29) ^ w11h >>> 6) + (w13l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20559 | tl = 3733110249 + w13l | 0; | |
20560 | th = 2756734187 + w13h + (tl >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
20561 | tl = tl + hl | 0; | |
20562 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20563 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20564 | tl = tl + xl | 0; | |
20565 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20566 | xl = gl ^ el & (fl ^ gl) | 0; | |
20567 | tl = tl + xl | 0; | |
20568 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20569 | hl = gl; | |
20570 | hh = gh; | |
20571 | gl = fl; | |
20572 | gh = fh; | |
20573 | fl = el; | |
20574 | fh = eh; | |
20575 | el = dl + tl | 0; | |
20576 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20577 | dl = cl; | |
20578 | dh = ch; | |
20579 | cl = bl; | |
20580 | ch = bh; | |
20581 | bl = al; | |
20582 | bh = ah; | |
20583 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20584 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20585 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20586 | al = al + xl | 0; | |
20587 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20588 | w14l = w14l + w7l | 0; | |
20589 | w14h = w14h + w7h + (w14l >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
20590 | xl = (w15l >>> 1 | w15h << 31) ^ (w15l >>> 8 | w15h << 24) ^ (w15l >>> 7 | w15h << 25) | 0; | |
20591 | w14l = w14l + xl | 0; | |
20592 | w14h = w14h + ((w15h >>> 1 | w15l << 31) ^ (w15h >>> 8 | w15l << 24) ^ w15h >>> 7) + (w14l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20593 | xl = (w12l >>> 19 | w12h << 13) ^ (w12l << 3 | w12h >>> 29) ^ (w12l >>> 6 | w12h << 26) | 0; | |
20594 | w14l = w14l + xl | 0; | |
20595 | w14h = w14h + ((w12h >>> 19 | w12l << 13) ^ (w12h << 3 | w12l >>> 29) ^ w12h >>> 6) + (w14l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20596 | tl = 2999351573 + w14l | 0; | |
20597 | th = 3204031479 + w14h + (tl >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
20598 | tl = tl + hl | 0; | |
20599 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20600 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20601 | tl = tl + xl | 0; | |
20602 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20603 | xl = gl ^ el & (fl ^ gl) | 0; | |
20604 | tl = tl + xl | 0; | |
20605 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20606 | hl = gl; | |
20607 | hh = gh; | |
20608 | gl = fl; | |
20609 | gh = fh; | |
20610 | fl = el; | |
20611 | fh = eh; | |
20612 | el = dl + tl | 0; | |
20613 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20614 | dl = cl; | |
20615 | dh = ch; | |
20616 | cl = bl; | |
20617 | ch = bh; | |
20618 | bl = al; | |
20619 | bh = ah; | |
20620 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20621 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20622 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20623 | al = al + xl | 0; | |
20624 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20625 | w15l = w15l + w8l | 0; | |
20626 | w15h = w15h + w8h + (w15l >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
20627 | xl = (w0l >>> 1 | w0h << 31) ^ (w0l >>> 8 | w0h << 24) ^ (w0l >>> 7 | w0h << 25) | 0; | |
20628 | w15l = w15l + xl | 0; | |
20629 | w15h = w15h + ((w0h >>> 1 | w0l << 31) ^ (w0h >>> 8 | w0l << 24) ^ w0h >>> 7) + (w15l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20630 | xl = (w13l >>> 19 | w13h << 13) ^ (w13l << 3 | w13h >>> 29) ^ (w13l >>> 6 | w13h << 26) | 0; | |
20631 | w15l = w15l + xl | 0; | |
20632 | w15h = w15h + ((w13h >>> 19 | w13l << 13) ^ (w13h << 3 | w13l >>> 29) ^ w13h >>> 6) + (w15l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20633 | tl = 3815920427 + w15l | 0; | |
20634 | th = 3329325298 + w15h + (tl >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
20635 | tl = tl + hl | 0; | |
20636 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20637 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20638 | tl = tl + xl | 0; | |
20639 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20640 | xl = gl ^ el & (fl ^ gl) | 0; | |
20641 | tl = tl + xl | 0; | |
20642 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20643 | hl = gl; | |
20644 | hh = gh; | |
20645 | gl = fl; | |
20646 | gh = fh; | |
20647 | fl = el; | |
20648 | fh = eh; | |
20649 | el = dl + tl | 0; | |
20650 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20651 | dl = cl; | |
20652 | dh = ch; | |
20653 | cl = bl; | |
20654 | ch = bh; | |
20655 | bl = al; | |
20656 | bh = ah; | |
20657 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20658 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20659 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20660 | al = al + xl | 0; | |
20661 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20662 | w0l = w0l + w9l | 0; | |
20663 | w0h = w0h + w9h + (w0l >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
20664 | xl = (w1l >>> 1 | w1h << 31) ^ (w1l >>> 8 | w1h << 24) ^ (w1l >>> 7 | w1h << 25) | 0; | |
20665 | w0l = w0l + xl | 0; | |
20666 | w0h = w0h + ((w1h >>> 1 | w1l << 31) ^ (w1h >>> 8 | w1l << 24) ^ w1h >>> 7) + (w0l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20667 | xl = (w14l >>> 19 | w14h << 13) ^ (w14l << 3 | w14h >>> 29) ^ (w14l >>> 6 | w14h << 26) | 0; | |
20668 | w0l = w0l + xl | 0; | |
20669 | w0h = w0h + ((w14h >>> 19 | w14l << 13) ^ (w14h << 3 | w14l >>> 29) ^ w14h >>> 6) + (w0l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20670 | tl = 3928383900 + w0l | 0; | |
20671 | th = 3391569614 + w0h + (tl >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
20672 | tl = tl + hl | 0; | |
20673 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20674 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20675 | tl = tl + xl | 0; | |
20676 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20677 | xl = gl ^ el & (fl ^ gl) | 0; | |
20678 | tl = tl + xl | 0; | |
20679 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20680 | hl = gl; | |
20681 | hh = gh; | |
20682 | gl = fl; | |
20683 | gh = fh; | |
20684 | fl = el; | |
20685 | fh = eh; | |
20686 | el = dl + tl | 0; | |
20687 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20688 | dl = cl; | |
20689 | dh = ch; | |
20690 | cl = bl; | |
20691 | ch = bh; | |
20692 | bl = al; | |
20693 | bh = ah; | |
20694 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20695 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20696 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20697 | al = al + xl | 0; | |
20698 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20699 | w1l = w1l + w10l | 0; | |
20700 | w1h = w1h + w10h + (w1l >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
20701 | xl = (w2l >>> 1 | w2h << 31) ^ (w2l >>> 8 | w2h << 24) ^ (w2l >>> 7 | w2h << 25) | 0; | |
20702 | w1l = w1l + xl | 0; | |
20703 | w1h = w1h + ((w2h >>> 1 | w2l << 31) ^ (w2h >>> 8 | w2l << 24) ^ w2h >>> 7) + (w1l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20704 | xl = (w15l >>> 19 | w15h << 13) ^ (w15l << 3 | w15h >>> 29) ^ (w15l >>> 6 | w15h << 26) | 0; | |
20705 | w1l = w1l + xl | 0; | |
20706 | w1h = w1h + ((w15h >>> 19 | w15l << 13) ^ (w15h << 3 | w15l >>> 29) ^ w15h >>> 6) + (w1l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20707 | tl = 566280711 + w1l | 0; | |
20708 | th = 3515267271 + w1h + (tl >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
20709 | tl = tl + hl | 0; | |
20710 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20711 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20712 | tl = tl + xl | 0; | |
20713 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20714 | xl = gl ^ el & (fl ^ gl) | 0; | |
20715 | tl = tl + xl | 0; | |
20716 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20717 | hl = gl; | |
20718 | hh = gh; | |
20719 | gl = fl; | |
20720 | gh = fh; | |
20721 | fl = el; | |
20722 | fh = eh; | |
20723 | el = dl + tl | 0; | |
20724 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20725 | dl = cl; | |
20726 | dh = ch; | |
20727 | cl = bl; | |
20728 | ch = bh; | |
20729 | bl = al; | |
20730 | bh = ah; | |
20731 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20732 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20733 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20734 | al = al + xl | 0; | |
20735 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20736 | w2l = w2l + w11l | 0; | |
20737 | w2h = w2h + w11h + (w2l >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
20738 | xl = (w3l >>> 1 | w3h << 31) ^ (w3l >>> 8 | w3h << 24) ^ (w3l >>> 7 | w3h << 25) | 0; | |
20739 | w2l = w2l + xl | 0; | |
20740 | w2h = w2h + ((w3h >>> 1 | w3l << 31) ^ (w3h >>> 8 | w3l << 24) ^ w3h >>> 7) + (w2l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20741 | xl = (w0l >>> 19 | w0h << 13) ^ (w0l << 3 | w0h >>> 29) ^ (w0l >>> 6 | w0h << 26) | 0; | |
20742 | w2l = w2l + xl | 0; | |
20743 | w2h = w2h + ((w0h >>> 19 | w0l << 13) ^ (w0h << 3 | w0l >>> 29) ^ w0h >>> 6) + (w2l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20744 | tl = 3454069534 + w2l | 0; | |
20745 | th = 3940187606 + w2h + (tl >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
20746 | tl = tl + hl | 0; | |
20747 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20748 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20749 | tl = tl + xl | 0; | |
20750 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20751 | xl = gl ^ el & (fl ^ gl) | 0; | |
20752 | tl = tl + xl | 0; | |
20753 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20754 | hl = gl; | |
20755 | hh = gh; | |
20756 | gl = fl; | |
20757 | gh = fh; | |
20758 | fl = el; | |
20759 | fh = eh; | |
20760 | el = dl + tl | 0; | |
20761 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20762 | dl = cl; | |
20763 | dh = ch; | |
20764 | cl = bl; | |
20765 | ch = bh; | |
20766 | bl = al; | |
20767 | bh = ah; | |
20768 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20769 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20770 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20771 | al = al + xl | 0; | |
20772 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20773 | w3l = w3l + w12l | 0; | |
20774 | w3h = w3h + w12h + (w3l >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
20775 | xl = (w4l >>> 1 | w4h << 31) ^ (w4l >>> 8 | w4h << 24) ^ (w4l >>> 7 | w4h << 25) | 0; | |
20776 | w3l = w3l + xl | 0; | |
20777 | w3h = w3h + ((w4h >>> 1 | w4l << 31) ^ (w4h >>> 8 | w4l << 24) ^ w4h >>> 7) + (w3l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20778 | xl = (w1l >>> 19 | w1h << 13) ^ (w1l << 3 | w1h >>> 29) ^ (w1l >>> 6 | w1h << 26) | 0; | |
20779 | w3l = w3l + xl | 0; | |
20780 | w3h = w3h + ((w1h >>> 19 | w1l << 13) ^ (w1h << 3 | w1l >>> 29) ^ w1h >>> 6) + (w3l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20781 | tl = 4000239992 + w3l | 0; | |
20782 | th = 4118630271 + w3h + (tl >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
20783 | tl = tl + hl | 0; | |
20784 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20785 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20786 | tl = tl + xl | 0; | |
20787 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20788 | xl = gl ^ el & (fl ^ gl) | 0; | |
20789 | tl = tl + xl | 0; | |
20790 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20791 | hl = gl; | |
20792 | hh = gh; | |
20793 | gl = fl; | |
20794 | gh = fh; | |
20795 | fl = el; | |
20796 | fh = eh; | |
20797 | el = dl + tl | 0; | |
20798 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20799 | dl = cl; | |
20800 | dh = ch; | |
20801 | cl = bl; | |
20802 | ch = bh; | |
20803 | bl = al; | |
20804 | bh = ah; | |
20805 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20806 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20807 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20808 | al = al + xl | 0; | |
20809 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20810 | w4l = w4l + w13l | 0; | |
20811 | w4h = w4h + w13h + (w4l >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
20812 | xl = (w5l >>> 1 | w5h << 31) ^ (w5l >>> 8 | w5h << 24) ^ (w5l >>> 7 | w5h << 25) | 0; | |
20813 | w4l = w4l + xl | 0; | |
20814 | w4h = w4h + ((w5h >>> 1 | w5l << 31) ^ (w5h >>> 8 | w5l << 24) ^ w5h >>> 7) + (w4l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20815 | xl = (w2l >>> 19 | w2h << 13) ^ (w2l << 3 | w2h >>> 29) ^ (w2l >>> 6 | w2h << 26) | 0; | |
20816 | w4l = w4l + xl | 0; | |
20817 | w4h = w4h + ((w2h >>> 19 | w2l << 13) ^ (w2h << 3 | w2l >>> 29) ^ w2h >>> 6) + (w4l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20818 | tl = 1914138554 + w4l | 0; | |
20819 | th = 116418474 + w4h + (tl >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
20820 | tl = tl + hl | 0; | |
20821 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20822 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20823 | tl = tl + xl | 0; | |
20824 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20825 | xl = gl ^ el & (fl ^ gl) | 0; | |
20826 | tl = tl + xl | 0; | |
20827 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20828 | hl = gl; | |
20829 | hh = gh; | |
20830 | gl = fl; | |
20831 | gh = fh; | |
20832 | fl = el; | |
20833 | fh = eh; | |
20834 | el = dl + tl | 0; | |
20835 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20836 | dl = cl; | |
20837 | dh = ch; | |
20838 | cl = bl; | |
20839 | ch = bh; | |
20840 | bl = al; | |
20841 | bh = ah; | |
20842 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20843 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20844 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20845 | al = al + xl | 0; | |
20846 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20847 | w5l = w5l + w14l | 0; | |
20848 | w5h = w5h + w14h + (w5l >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
20849 | xl = (w6l >>> 1 | w6h << 31) ^ (w6l >>> 8 | w6h << 24) ^ (w6l >>> 7 | w6h << 25) | 0; | |
20850 | w5l = w5l + xl | 0; | |
20851 | w5h = w5h + ((w6h >>> 1 | w6l << 31) ^ (w6h >>> 8 | w6l << 24) ^ w6h >>> 7) + (w5l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20852 | xl = (w3l >>> 19 | w3h << 13) ^ (w3l << 3 | w3h >>> 29) ^ (w3l >>> 6 | w3h << 26) | 0; | |
20853 | w5l = w5l + xl | 0; | |
20854 | w5h = w5h + ((w3h >>> 19 | w3l << 13) ^ (w3h << 3 | w3l >>> 29) ^ w3h >>> 6) + (w5l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20855 | tl = 2731055270 + w5l | 0; | |
20856 | th = 174292421 + w5h + (tl >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
20857 | tl = tl + hl | 0; | |
20858 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20859 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20860 | tl = tl + xl | 0; | |
20861 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20862 | xl = gl ^ el & (fl ^ gl) | 0; | |
20863 | tl = tl + xl | 0; | |
20864 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20865 | hl = gl; | |
20866 | hh = gh; | |
20867 | gl = fl; | |
20868 | gh = fh; | |
20869 | fl = el; | |
20870 | fh = eh; | |
20871 | el = dl + tl | 0; | |
20872 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20873 | dl = cl; | |
20874 | dh = ch; | |
20875 | cl = bl; | |
20876 | ch = bh; | |
20877 | bl = al; | |
20878 | bh = ah; | |
20879 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20880 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20881 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20882 | al = al + xl | 0; | |
20883 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20884 | w6l = w6l + w15l | 0; | |
20885 | w6h = w6h + w15h + (w6l >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
20886 | xl = (w7l >>> 1 | w7h << 31) ^ (w7l >>> 8 | w7h << 24) ^ (w7l >>> 7 | w7h << 25) | 0; | |
20887 | w6l = w6l + xl | 0; | |
20888 | w6h = w6h + ((w7h >>> 1 | w7l << 31) ^ (w7h >>> 8 | w7l << 24) ^ w7h >>> 7) + (w6l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20889 | xl = (w4l >>> 19 | w4h << 13) ^ (w4l << 3 | w4h >>> 29) ^ (w4l >>> 6 | w4h << 26) | 0; | |
20890 | w6l = w6l + xl | 0; | |
20891 | w6h = w6h + ((w4h >>> 19 | w4l << 13) ^ (w4h << 3 | w4l >>> 29) ^ w4h >>> 6) + (w6l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20892 | tl = 3203993006 + w6l | 0; | |
20893 | th = 289380356 + w6h + (tl >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
20894 | tl = tl + hl | 0; | |
20895 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20896 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20897 | tl = tl + xl | 0; | |
20898 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20899 | xl = gl ^ el & (fl ^ gl) | 0; | |
20900 | tl = tl + xl | 0; | |
20901 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20902 | hl = gl; | |
20903 | hh = gh; | |
20904 | gl = fl; | |
20905 | gh = fh; | |
20906 | fl = el; | |
20907 | fh = eh; | |
20908 | el = dl + tl | 0; | |
20909 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20910 | dl = cl; | |
20911 | dh = ch; | |
20912 | cl = bl; | |
20913 | ch = bh; | |
20914 | bl = al; | |
20915 | bh = ah; | |
20916 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20917 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20918 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20919 | al = al + xl | 0; | |
20920 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20921 | w7l = w7l + w0l | 0; | |
20922 | w7h = w7h + w0h + (w7l >>> 0 < w0l >>> 0 ? 1 : 0) | 0; | |
20923 | xl = (w8l >>> 1 | w8h << 31) ^ (w8l >>> 8 | w8h << 24) ^ (w8l >>> 7 | w8h << 25) | 0; | |
20924 | w7l = w7l + xl | 0; | |
20925 | w7h = w7h + ((w8h >>> 1 | w8l << 31) ^ (w8h >>> 8 | w8l << 24) ^ w8h >>> 7) + (w7l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20926 | xl = (w5l >>> 19 | w5h << 13) ^ (w5l << 3 | w5h >>> 29) ^ (w5l >>> 6 | w5h << 26) | 0; | |
20927 | w7l = w7l + xl | 0; | |
20928 | w7h = w7h + ((w5h >>> 19 | w5l << 13) ^ (w5h << 3 | w5l >>> 29) ^ w5h >>> 6) + (w7l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20929 | tl = 320620315 + w7l | 0; | |
20930 | th = 460393269 + w7h + (tl >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
20931 | tl = tl + hl | 0; | |
20932 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20933 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20934 | tl = tl + xl | 0; | |
20935 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20936 | xl = gl ^ el & (fl ^ gl) | 0; | |
20937 | tl = tl + xl | 0; | |
20938 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20939 | hl = gl; | |
20940 | hh = gh; | |
20941 | gl = fl; | |
20942 | gh = fh; | |
20943 | fl = el; | |
20944 | fh = eh; | |
20945 | el = dl + tl | 0; | |
20946 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20947 | dl = cl; | |
20948 | dh = ch; | |
20949 | cl = bl; | |
20950 | ch = bh; | |
20951 | bl = al; | |
20952 | bh = ah; | |
20953 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20954 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20955 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20956 | al = al + xl | 0; | |
20957 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20958 | w8l = w8l + w1l | 0; | |
20959 | w8h = w8h + w1h + (w8l >>> 0 < w1l >>> 0 ? 1 : 0) | 0; | |
20960 | xl = (w9l >>> 1 | w9h << 31) ^ (w9l >>> 8 | w9h << 24) ^ (w9l >>> 7 | w9h << 25) | 0; | |
20961 | w8l = w8l + xl | 0; | |
20962 | w8h = w8h + ((w9h >>> 1 | w9l << 31) ^ (w9h >>> 8 | w9l << 24) ^ w9h >>> 7) + (w8l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20963 | xl = (w6l >>> 19 | w6h << 13) ^ (w6l << 3 | w6h >>> 29) ^ (w6l >>> 6 | w6h << 26) | 0; | |
20964 | w8l = w8l + xl | 0; | |
20965 | w8h = w8h + ((w6h >>> 19 | w6l << 13) ^ (w6h << 3 | w6l >>> 29) ^ w6h >>> 6) + (w8l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20966 | tl = 587496836 + w8l | 0; | |
20967 | th = 685471733 + w8h + (tl >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
20968 | tl = tl + hl | 0; | |
20969 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
20970 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
20971 | tl = tl + xl | 0; | |
20972 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20973 | xl = gl ^ el & (fl ^ gl) | 0; | |
20974 | tl = tl + xl | 0; | |
20975 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20976 | hl = gl; | |
20977 | hh = gh; | |
20978 | gl = fl; | |
20979 | gh = fh; | |
20980 | fl = el; | |
20981 | fh = eh; | |
20982 | el = dl + tl | 0; | |
20983 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
20984 | dl = cl; | |
20985 | dh = ch; | |
20986 | cl = bl; | |
20987 | ch = bh; | |
20988 | bl = al; | |
20989 | bh = ah; | |
20990 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
20991 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
20992 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
20993 | al = al + xl | 0; | |
20994 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
20995 | w9l = w9l + w2l | 0; | |
20996 | w9h = w9h + w2h + (w9l >>> 0 < w2l >>> 0 ? 1 : 0) | 0; | |
20997 | xl = (w10l >>> 1 | w10h << 31) ^ (w10l >>> 8 | w10h << 24) ^ (w10l >>> 7 | w10h << 25) | 0; | |
20998 | w9l = w9l + xl | 0; | |
20999 | w9h = w9h + ((w10h >>> 1 | w10l << 31) ^ (w10h >>> 8 | w10l << 24) ^ w10h >>> 7) + (w9l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21000 | xl = (w7l >>> 19 | w7h << 13) ^ (w7l << 3 | w7h >>> 29) ^ (w7l >>> 6 | w7h << 26) | 0; | |
21001 | w9l = w9l + xl | 0; | |
21002 | w9h = w9h + ((w7h >>> 19 | w7l << 13) ^ (w7h << 3 | w7l >>> 29) ^ w7h >>> 6) + (w9l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21003 | tl = 1086792851 + w9l | 0; | |
21004 | th = 852142971 + w9h + (tl >>> 0 < w9l >>> 0 ? 1 : 0) | 0; | |
21005 | tl = tl + hl | 0; | |
21006 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21007 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
21008 | tl = tl + xl | 0; | |
21009 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21010 | xl = gl ^ el & (fl ^ gl) | 0; | |
21011 | tl = tl + xl | 0; | |
21012 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21013 | hl = gl; | |
21014 | hh = gh; | |
21015 | gl = fl; | |
21016 | gh = fh; | |
21017 | fl = el; | |
21018 | fh = eh; | |
21019 | el = dl + tl | 0; | |
21020 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21021 | dl = cl; | |
21022 | dh = ch; | |
21023 | cl = bl; | |
21024 | ch = bh; | |
21025 | bl = al; | |
21026 | bh = ah; | |
21027 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
21028 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
21029 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
21030 | al = al + xl | 0; | |
21031 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21032 | w10l = w10l + w3l | 0; | |
21033 | w10h = w10h + w3h + (w10l >>> 0 < w3l >>> 0 ? 1 : 0) | 0; | |
21034 | xl = (w11l >>> 1 | w11h << 31) ^ (w11l >>> 8 | w11h << 24) ^ (w11l >>> 7 | w11h << 25) | 0; | |
21035 | w10l = w10l + xl | 0; | |
21036 | w10h = w10h + ((w11h >>> 1 | w11l << 31) ^ (w11h >>> 8 | w11l << 24) ^ w11h >>> 7) + (w10l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21037 | xl = (w8l >>> 19 | w8h << 13) ^ (w8l << 3 | w8h >>> 29) ^ (w8l >>> 6 | w8h << 26) | 0; | |
21038 | w10l = w10l + xl | 0; | |
21039 | w10h = w10h + ((w8h >>> 19 | w8l << 13) ^ (w8h << 3 | w8l >>> 29) ^ w8h >>> 6) + (w10l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21040 | tl = 365543100 + w10l | 0; | |
21041 | th = 1017036298 + w10h + (tl >>> 0 < w10l >>> 0 ? 1 : 0) | 0; | |
21042 | tl = tl + hl | 0; | |
21043 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21044 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
21045 | tl = tl + xl | 0; | |
21046 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21047 | xl = gl ^ el & (fl ^ gl) | 0; | |
21048 | tl = tl + xl | 0; | |
21049 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21050 | hl = gl; | |
21051 | hh = gh; | |
21052 | gl = fl; | |
21053 | gh = fh; | |
21054 | fl = el; | |
21055 | fh = eh; | |
21056 | el = dl + tl | 0; | |
21057 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21058 | dl = cl; | |
21059 | dh = ch; | |
21060 | cl = bl; | |
21061 | ch = bh; | |
21062 | bl = al; | |
21063 | bh = ah; | |
21064 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
21065 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
21066 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
21067 | al = al + xl | 0; | |
21068 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21069 | w11l = w11l + w4l | 0; | |
21070 | w11h = w11h + w4h + (w11l >>> 0 < w4l >>> 0 ? 1 : 0) | 0; | |
21071 | xl = (w12l >>> 1 | w12h << 31) ^ (w12l >>> 8 | w12h << 24) ^ (w12l >>> 7 | w12h << 25) | 0; | |
21072 | w11l = w11l + xl | 0; | |
21073 | w11h = w11h + ((w12h >>> 1 | w12l << 31) ^ (w12h >>> 8 | w12l << 24) ^ w12h >>> 7) + (w11l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21074 | xl = (w9l >>> 19 | w9h << 13) ^ (w9l << 3 | w9h >>> 29) ^ (w9l >>> 6 | w9h << 26) | 0; | |
21075 | w11l = w11l + xl | 0; | |
21076 | w11h = w11h + ((w9h >>> 19 | w9l << 13) ^ (w9h << 3 | w9l >>> 29) ^ w9h >>> 6) + (w11l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21077 | tl = 2618297676 + w11l | 0; | |
21078 | th = 1126000580 + w11h + (tl >>> 0 < w11l >>> 0 ? 1 : 0) | 0; | |
21079 | tl = tl + hl | 0; | |
21080 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21081 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
21082 | tl = tl + xl | 0; | |
21083 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21084 | xl = gl ^ el & (fl ^ gl) | 0; | |
21085 | tl = tl + xl | 0; | |
21086 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21087 | hl = gl; | |
21088 | hh = gh; | |
21089 | gl = fl; | |
21090 | gh = fh; | |
21091 | fl = el; | |
21092 | fh = eh; | |
21093 | el = dl + tl | 0; | |
21094 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21095 | dl = cl; | |
21096 | dh = ch; | |
21097 | cl = bl; | |
21098 | ch = bh; | |
21099 | bl = al; | |
21100 | bh = ah; | |
21101 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
21102 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
21103 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
21104 | al = al + xl | 0; | |
21105 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21106 | w12l = w12l + w5l | 0; | |
21107 | w12h = w12h + w5h + (w12l >>> 0 < w5l >>> 0 ? 1 : 0) | 0; | |
21108 | xl = (w13l >>> 1 | w13h << 31) ^ (w13l >>> 8 | w13h << 24) ^ (w13l >>> 7 | w13h << 25) | 0; | |
21109 | w12l = w12l + xl | 0; | |
21110 | w12h = w12h + ((w13h >>> 1 | w13l << 31) ^ (w13h >>> 8 | w13l << 24) ^ w13h >>> 7) + (w12l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21111 | xl = (w10l >>> 19 | w10h << 13) ^ (w10l << 3 | w10h >>> 29) ^ (w10l >>> 6 | w10h << 26) | 0; | |
21112 | w12l = w12l + xl | 0; | |
21113 | w12h = w12h + ((w10h >>> 19 | w10l << 13) ^ (w10h << 3 | w10l >>> 29) ^ w10h >>> 6) + (w12l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21114 | tl = 3409855158 + w12l | 0; | |
21115 | th = 1288033470 + w12h + (tl >>> 0 < w12l >>> 0 ? 1 : 0) | 0; | |
21116 | tl = tl + hl | 0; | |
21117 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21118 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
21119 | tl = tl + xl | 0; | |
21120 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21121 | xl = gl ^ el & (fl ^ gl) | 0; | |
21122 | tl = tl + xl | 0; | |
21123 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21124 | hl = gl; | |
21125 | hh = gh; | |
21126 | gl = fl; | |
21127 | gh = fh; | |
21128 | fl = el; | |
21129 | fh = eh; | |
21130 | el = dl + tl | 0; | |
21131 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21132 | dl = cl; | |
21133 | dh = ch; | |
21134 | cl = bl; | |
21135 | ch = bh; | |
21136 | bl = al; | |
21137 | bh = ah; | |
21138 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
21139 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
21140 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
21141 | al = al + xl | 0; | |
21142 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21143 | w13l = w13l + w6l | 0; | |
21144 | w13h = w13h + w6h + (w13l >>> 0 < w6l >>> 0 ? 1 : 0) | 0; | |
21145 | xl = (w14l >>> 1 | w14h << 31) ^ (w14l >>> 8 | w14h << 24) ^ (w14l >>> 7 | w14h << 25) | 0; | |
21146 | w13l = w13l + xl | 0; | |
21147 | w13h = w13h + ((w14h >>> 1 | w14l << 31) ^ (w14h >>> 8 | w14l << 24) ^ w14h >>> 7) + (w13l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21148 | xl = (w11l >>> 19 | w11h << 13) ^ (w11l << 3 | w11h >>> 29) ^ (w11l >>> 6 | w11h << 26) | 0; | |
21149 | w13l = w13l + xl | 0; | |
21150 | w13h = w13h + ((w11h >>> 19 | w11l << 13) ^ (w11h << 3 | w11l >>> 29) ^ w11h >>> 6) + (w13l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21151 | tl = 4234509866 + w13l | 0; | |
21152 | th = 1501505948 + w13h + (tl >>> 0 < w13l >>> 0 ? 1 : 0) | 0; | |
21153 | tl = tl + hl | 0; | |
21154 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21155 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
21156 | tl = tl + xl | 0; | |
21157 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21158 | xl = gl ^ el & (fl ^ gl) | 0; | |
21159 | tl = tl + xl | 0; | |
21160 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21161 | hl = gl; | |
21162 | hh = gh; | |
21163 | gl = fl; | |
21164 | gh = fh; | |
21165 | fl = el; | |
21166 | fh = eh; | |
21167 | el = dl + tl | 0; | |
21168 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21169 | dl = cl; | |
21170 | dh = ch; | |
21171 | cl = bl; | |
21172 | ch = bh; | |
21173 | bl = al; | |
21174 | bh = ah; | |
21175 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
21176 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
21177 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
21178 | al = al + xl | 0; | |
21179 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21180 | w14l = w14l + w7l | 0; | |
21181 | w14h = w14h + w7h + (w14l >>> 0 < w7l >>> 0 ? 1 : 0) | 0; | |
21182 | xl = (w15l >>> 1 | w15h << 31) ^ (w15l >>> 8 | w15h << 24) ^ (w15l >>> 7 | w15h << 25) | 0; | |
21183 | w14l = w14l + xl | 0; | |
21184 | w14h = w14h + ((w15h >>> 1 | w15l << 31) ^ (w15h >>> 8 | w15l << 24) ^ w15h >>> 7) + (w14l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21185 | xl = (w12l >>> 19 | w12h << 13) ^ (w12l << 3 | w12h >>> 29) ^ (w12l >>> 6 | w12h << 26) | 0; | |
21186 | w14l = w14l + xl | 0; | |
21187 | w14h = w14h + ((w12h >>> 19 | w12l << 13) ^ (w12h << 3 | w12l >>> 29) ^ w12h >>> 6) + (w14l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21188 | tl = 987167468 + w14l | 0; | |
21189 | th = 1607167915 + w14h + (tl >>> 0 < w14l >>> 0 ? 1 : 0) | 0; | |
21190 | tl = tl + hl | 0; | |
21191 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21192 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
21193 | tl = tl + xl | 0; | |
21194 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21195 | xl = gl ^ el & (fl ^ gl) | 0; | |
21196 | tl = tl + xl | 0; | |
21197 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21198 | hl = gl; | |
21199 | hh = gh; | |
21200 | gl = fl; | |
21201 | gh = fh; | |
21202 | fl = el; | |
21203 | fh = eh; | |
21204 | el = dl + tl | 0; | |
21205 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21206 | dl = cl; | |
21207 | dh = ch; | |
21208 | cl = bl; | |
21209 | ch = bh; | |
21210 | bl = al; | |
21211 | bh = ah; | |
21212 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
21213 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
21214 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
21215 | al = al + xl | 0; | |
21216 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21217 | w15l = w15l + w8l | 0; | |
21218 | w15h = w15h + w8h + (w15l >>> 0 < w8l >>> 0 ? 1 : 0) | 0; | |
21219 | xl = (w0l >>> 1 | w0h << 31) ^ (w0l >>> 8 | w0h << 24) ^ (w0l >>> 7 | w0h << 25) | 0; | |
21220 | w15l = w15l + xl | 0; | |
21221 | w15h = w15h + ((w0h >>> 1 | w0l << 31) ^ (w0h >>> 8 | w0l << 24) ^ w0h >>> 7) + (w15l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21222 | xl = (w13l >>> 19 | w13h << 13) ^ (w13l << 3 | w13h >>> 29) ^ (w13l >>> 6 | w13h << 26) | 0; | |
21223 | w15l = w15l + xl | 0; | |
21224 | w15h = w15h + ((w13h >>> 19 | w13l << 13) ^ (w13h << 3 | w13l >>> 29) ^ w13h >>> 6) + (w15l >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21225 | tl = 1246189591 + w15l | 0; | |
21226 | th = 1816402316 + w15h + (tl >>> 0 < w15l >>> 0 ? 1 : 0) | 0; | |
21227 | tl = tl + hl | 0; | |
21228 | th = th + hh + (tl >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21229 | xl = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9) | 0; | |
21230 | tl = tl + xl | 0; | |
21231 | th = th + ((eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21232 | xl = gl ^ el & (fl ^ gl) | 0; | |
21233 | tl = tl + xl | 0; | |
21234 | th = th + (gh ^ eh & (fh ^ gh)) + (tl >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21235 | hl = gl; | |
21236 | hh = gh; | |
21237 | gl = fl; | |
21238 | gh = fh; | |
21239 | fl = el; | |
21240 | fh = eh; | |
21241 | el = dl + tl | 0; | |
21242 | eh = dh + th + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21243 | dl = cl; | |
21244 | dh = ch; | |
21245 | cl = bl; | |
21246 | ch = bh; | |
21247 | bl = al; | |
21248 | bh = ah; | |
21249 | al = tl + (bl & cl ^ dl & (bl ^ cl)) | 0; | |
21250 | ah = th + (bh & ch ^ dh & (bh ^ ch)) + (al >>> 0 < tl >>> 0 ? 1 : 0) | 0; | |
21251 | xl = (bl >>> 28 | bh << 4) ^ (bl << 30 | bh >>> 2) ^ (bl << 25 | bh >>> 7) | 0; | |
21252 | al = al + xl | 0; | |
21253 | ah = ah + ((bh >>> 28 | bl << 4) ^ (bh << 30 | bl >>> 2) ^ (bh << 25 | bl >>> 7)) + (al >>> 0 < xl >>> 0 ? 1 : 0) | 0; | |
21254 | H0l = H0l + al | 0; | |
21255 | H0h = H0h + ah + (H0l >>> 0 < al >>> 0 ? 1 : 0) | 0; | |
21256 | H1l = H1l + bl | 0; | |
21257 | H1h = H1h + bh + (H1l >>> 0 < bl >>> 0 ? 1 : 0) | 0; | |
21258 | H2l = H2l + cl | 0; | |
21259 | H2h = H2h + ch + (H2l >>> 0 < cl >>> 0 ? 1 : 0) | 0; | |
21260 | H3l = H3l + dl | 0; | |
21261 | H3h = H3h + dh + (H3l >>> 0 < dl >>> 0 ? 1 : 0) | 0; | |
21262 | H4l = H4l + el | 0; | |
21263 | H4h = H4h + eh + (H4l >>> 0 < el >>> 0 ? 1 : 0) | 0; | |
21264 | H5l = H5l + fl | 0; | |
21265 | H5h = H5h + fh + (H5l >>> 0 < fl >>> 0 ? 1 : 0) | 0; | |
21266 | H6l = H6l + gl | 0; | |
21267 | H6h = H6h + gh + (H6l >>> 0 < gl >>> 0 ? 1 : 0) | 0; | |
21268 | H7l = H7l + hl | 0; | |
21269 | H7h = H7h + hh + (H7l >>> 0 < hl >>> 0 ? 1 : 0) | 0; | |
21270 | } | |
21271 | function _core_heap(offset) { | |
21272 | offset = offset | 0; | |
21273 | _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]); | |
21274 | } | |
21275 | function _state_to_heap(output) { | |
21276 | output = output | 0; | |
21277 | HEAP[output | 0] = H0h >>> 24; | |
21278 | HEAP[output | 1] = H0h >>> 16 & 255; | |
21279 | HEAP[output | 2] = H0h >>> 8 & 255; | |
21280 | HEAP[output | 3] = H0h & 255; | |
21281 | HEAP[output | 4] = H0l >>> 24; | |
21282 | HEAP[output | 5] = H0l >>> 16 & 255; | |
21283 | HEAP[output | 6] = H0l >>> 8 & 255; | |
21284 | HEAP[output | 7] = H0l & 255; | |
21285 | HEAP[output | 8] = H1h >>> 24; | |
21286 | HEAP[output | 9] = H1h >>> 16 & 255; | |
21287 | HEAP[output | 10] = H1h >>> 8 & 255; | |
21288 | HEAP[output | 11] = H1h & 255; | |
21289 | HEAP[output | 12] = H1l >>> 24; | |
21290 | HEAP[output | 13] = H1l >>> 16 & 255; | |
21291 | HEAP[output | 14] = H1l >>> 8 & 255; | |
21292 | HEAP[output | 15] = H1l & 255; | |
21293 | HEAP[output | 16] = H2h >>> 24; | |
21294 | HEAP[output | 17] = H2h >>> 16 & 255; | |
21295 | HEAP[output | 18] = H2h >>> 8 & 255; | |
21296 | HEAP[output | 19] = H2h & 255; | |
21297 | HEAP[output | 20] = H2l >>> 24; | |
21298 | HEAP[output | 21] = H2l >>> 16 & 255; | |
21299 | HEAP[output | 22] = H2l >>> 8 & 255; | |
21300 | HEAP[output | 23] = H2l & 255; | |
21301 | HEAP[output | 24] = H3h >>> 24; | |
21302 | HEAP[output | 25] = H3h >>> 16 & 255; | |
21303 | HEAP[output | 26] = H3h >>> 8 & 255; | |
21304 | HEAP[output | 27] = H3h & 255; | |
21305 | HEAP[output | 28] = H3l >>> 24; | |
21306 | HEAP[output | 29] = H3l >>> 16 & 255; | |
21307 | HEAP[output | 30] = H3l >>> 8 & 255; | |
21308 | HEAP[output | 31] = H3l & 255; | |
21309 | HEAP[output | 32] = H4h >>> 24; | |
21310 | HEAP[output | 33] = H4h >>> 16 & 255; | |
21311 | HEAP[output | 34] = H4h >>> 8 & 255; | |
21312 | HEAP[output | 35] = H4h & 255; | |
21313 | HEAP[output | 36] = H4l >>> 24; | |
21314 | HEAP[output | 37] = H4l >>> 16 & 255; | |
21315 | HEAP[output | 38] = H4l >>> 8 & 255; | |
21316 | HEAP[output | 39] = H4l & 255; | |
21317 | HEAP[output | 40] = H5h >>> 24; | |
21318 | HEAP[output | 41] = H5h >>> 16 & 255; | |
21319 | HEAP[output | 42] = H5h >>> 8 & 255; | |
21320 | HEAP[output | 43] = H5h & 255; | |
21321 | HEAP[output | 44] = H5l >>> 24; | |
21322 | HEAP[output | 45] = H5l >>> 16 & 255; | |
21323 | HEAP[output | 46] = H5l >>> 8 & 255; | |
21324 | HEAP[output | 47] = H5l & 255; | |
21325 | HEAP[output | 48] = H6h >>> 24; | |
21326 | HEAP[output | 49] = H6h >>> 16 & 255; | |
21327 | HEAP[output | 50] = H6h >>> 8 & 255; | |
21328 | HEAP[output | 51] = H6h & 255; | |
21329 | HEAP[output | 52] = H6l >>> 24; | |
21330 | HEAP[output | 53] = H6l >>> 16 & 255; | |
21331 | HEAP[output | 54] = H6l >>> 8 & 255; | |
21332 | HEAP[output | 55] = H6l & 255; | |
21333 | HEAP[output | 56] = H7h >>> 24; | |
21334 | HEAP[output | 57] = H7h >>> 16 & 255; | |
21335 | HEAP[output | 58] = H7h >>> 8 & 255; | |
21336 | HEAP[output | 59] = H7h & 255; | |
21337 | HEAP[output | 60] = H7l >>> 24; | |
21338 | HEAP[output | 61] = H7l >>> 16 & 255; | |
21339 | HEAP[output | 62] = H7l >>> 8 & 255; | |
21340 | HEAP[output | 63] = H7l & 255; | |
21341 | } | |
21342 | function reset() { | |
21343 | H0h = 1779033703; | |
21344 | H0l = 4089235720; | |
21345 | H1h = 3144134277; | |
21346 | H1l = 2227873595; | |
21347 | H2h = 1013904242; | |
21348 | H2l = 4271175723; | |
21349 | H3h = 2773480762; | |
21350 | H3l = 1595750129; | |
21351 | H4h = 1359893119; | |
21352 | H4l = 2917565137; | |
21353 | H5h = 2600822924; | |
21354 | H5l = 725511199; | |
21355 | H6h = 528734635; | |
21356 | H6l = 4215389547; | |
21357 | H7h = 1541459225; | |
21358 | H7l = 327033209; | |
21359 | TOTAL = 0; | |
21360 | } | |
21361 | function init(h0h, h0l, h1h, h1l, h2h, h2l, h3h, h3l, h4h, h4l, h5h, h5l, h6h, h6l, h7h, h7l, total) { | |
21362 | h0h = h0h | 0; | |
21363 | h0l = h0l | 0; | |
21364 | h1h = h1h | 0; | |
21365 | h1l = h1l | 0; | |
21366 | h2h = h2h | 0; | |
21367 | h2l = h2l | 0; | |
21368 | h3h = h3h | 0; | |
21369 | h3l = h3l | 0; | |
21370 | h4h = h4h | 0; | |
21371 | h4l = h4l | 0; | |
21372 | h5h = h5h | 0; | |
21373 | h5l = h5l | 0; | |
21374 | h6h = h6h | 0; | |
21375 | h6l = h6l | 0; | |
21376 | h7h = h7h | 0; | |
21377 | h7l = h7l | 0; | |
21378 | total = total | 0; | |
21379 | H0h = h0h; | |
21380 | H0l = h0l; | |
21381 | H1h = h1h; | |
21382 | H1l = h1l; | |
21383 | H2h = h2h; | |
21384 | H2l = h2l; | |
21385 | H3h = h3h; | |
21386 | H3l = h3l; | |
21387 | H4h = h4h; | |
21388 | H4l = h4l; | |
21389 | H5h = h5h; | |
21390 | H5l = h5l; | |
21391 | H6h = h6h; | |
21392 | H6l = h6l; | |
21393 | H7h = h7h; | |
21394 | H7l = h7l; | |
21395 | TOTAL = total; | |
21396 | } | |
21397 | function process(offset, length) { | |
21398 | offset = offset | 0; | |
21399 | length = length | 0; | |
21400 | var hashed = 0; | |
21401 | if (offset & 127) return -1; | |
21402 | while ((length | 0) >= 128) { | |
21403 | _core_heap(offset); | |
21404 | offset = offset + 128 | 0; | |
21405 | length = length - 128 | 0; | |
21406 | hashed = hashed + 128 | 0; | |
21407 | } | |
21408 | TOTAL = TOTAL + hashed | 0; | |
21409 | return hashed | 0; | |
21410 | } | |
21411 | function finish(offset, length, output) { | |
21412 | offset = offset | 0; | |
21413 | length = length | 0; | |
21414 | output = output | 0; | |
21415 | var hashed = 0, i = 0; | |
21416 | if (offset & 127) return -1; | |
21417 | if (~output) if (output & 63) return -1; | |
21418 | if ((length | 0) >= 128) { | |
21419 | hashed = process(offset, length) | 0; | |
21420 | if ((hashed | 0) == -1) return -1; | |
21421 | offset = offset + hashed | 0; | |
21422 | length = length - hashed | 0; | |
21423 | } | |
21424 | hashed = hashed + length | 0; | |
21425 | TOTAL = TOTAL + length | 0; | |
21426 | HEAP[offset | length] = 128; | |
21427 | if ((length | 0) >= 112) { | |
21428 | for (i = length + 1 | 0; (i | 0) < 128; i = i + 1 | 0) HEAP[offset | i] = 0; | |
21429 | _core_heap(offset); | |
21430 | length = 0; | |
21431 | HEAP[offset | 0] = 0; | |
21432 | } | |
21433 | for (i = length + 1 | 0; (i | 0) < 123; i = i + 1 | 0) HEAP[offset | i] = 0; | |
21434 | HEAP[offset | 123] = TOTAL >>> 29; | |
21435 | HEAP[offset | 124] = TOTAL >>> 21 & 255; | |
21436 | HEAP[offset | 125] = TOTAL >>> 13 & 255; | |
21437 | HEAP[offset | 126] = TOTAL >>> 5 & 255; | |
21438 | HEAP[offset | 127] = TOTAL << 3 & 255; | |
21439 | _core_heap(offset); | |
21440 | if (~output) _state_to_heap(output); | |
21441 | return hashed | 0; | |
21442 | } | |
21443 | function hmac_reset() { | |
21444 | H0h = I0h; | |
21445 | H0l = I0l; | |
21446 | H1h = I1h; | |
21447 | H1l = I1l; | |
21448 | H2h = I2h; | |
21449 | H2l = I2l; | |
21450 | H3h = I3h; | |
21451 | H3l = I3l; | |
21452 | H4h = I4h; | |
21453 | H4l = I4l; | |
21454 | H5h = I5h; | |
21455 | H5l = I5l; | |
21456 | H6h = I6h; | |
21457 | H6l = I6l; | |
21458 | H7h = I7h; | |
21459 | H7l = I7l; | |
21460 | TOTAL = 128; | |
21461 | } | |
21462 | function _hmac_opad() { | |
21463 | H0h = O0h; | |
21464 | H0l = O0l; | |
21465 | H1h = O1h; | |
21466 | H1l = O1l; | |
21467 | H2h = O2h; | |
21468 | H2l = O2l; | |
21469 | H3h = O3h; | |
21470 | H3l = O3l; | |
21471 | H4h = O4h; | |
21472 | H4l = O4l; | |
21473 | H5h = O5h; | |
21474 | H5l = O5l; | |
21475 | H6h = O6h; | |
21476 | H6l = O6l; | |
21477 | H7h = O7h; | |
21478 | H7l = O7l; | |
21479 | TOTAL = 128; | |
21480 | } | |
21481 | 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) { | |
21482 | p0h = p0h | 0; | |
21483 | p0l = p0l | 0; | |
21484 | p1h = p1h | 0; | |
21485 | p1l = p1l | 0; | |
21486 | p2h = p2h | 0; | |
21487 | p2l = p2l | 0; | |
21488 | p3h = p3h | 0; | |
21489 | p3l = p3l | 0; | |
21490 | p4h = p4h | 0; | |
21491 | p4l = p4l | 0; | |
21492 | p5h = p5h | 0; | |
21493 | p5l = p5l | 0; | |
21494 | p6h = p6h | 0; | |
21495 | p6l = p6l | 0; | |
21496 | p7h = p7h | 0; | |
21497 | p7l = p7l | 0; | |
21498 | p8h = p8h | 0; | |
21499 | p8l = p8l | 0; | |
21500 | p9h = p9h | 0; | |
21501 | p9l = p9l | 0; | |
21502 | p10h = p10h | 0; | |
21503 | p10l = p10l | 0; | |
21504 | p11h = p11h | 0; | |
21505 | p11l = p11l | 0; | |
21506 | p12h = p12h | 0; | |
21507 | p12l = p12l | 0; | |
21508 | p13h = p13h | 0; | |
21509 | p13l = p13l | 0; | |
21510 | p14h = p14h | 0; | |
21511 | p14l = p14l | 0; | |
21512 | p15h = p15h | 0; | |
21513 | p15l = p15l | 0; | |
21514 | reset(); | |
21515 | _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); | |
21516 | O0h = H0h; | |
21517 | O0l = H0l; | |
21518 | O1h = H1h; | |
21519 | O1l = H1l; | |
21520 | O2h = H2h; | |
21521 | O2l = H2l; | |
21522 | O3h = H3h; | |
21523 | O3l = H3l; | |
21524 | O4h = H4h; | |
21525 | O4l = H4l; | |
21526 | O5h = H5h; | |
21527 | O5l = H5l; | |
21528 | O6h = H6h; | |
21529 | O6l = H6l; | |
21530 | O7h = H7h; | |
21531 | O7l = H7l; | |
21532 | reset(); | |
21533 | _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); | |
21534 | I0h = H0h; | |
21535 | I0l = H0l; | |
21536 | I1h = H1h; | |
21537 | I1l = H1l; | |
21538 | I2h = H2h; | |
21539 | I2l = H2l; | |
21540 | I3h = H3h; | |
21541 | I3l = H3l; | |
21542 | I4h = H4h; | |
21543 | I4l = H4l; | |
21544 | I5h = H5h; | |
21545 | I5l = H5l; | |
21546 | I6h = H6h; | |
21547 | I6l = H6l; | |
21548 | I7h = H7h; | |
21549 | I7l = H7l; | |
21550 | TOTAL = 128; | |
21551 | } | |
21552 | function hmac_finish(offset, length, output) { | |
21553 | offset = offset | 0; | |
21554 | length = length | 0; | |
21555 | output = output | 0; | |
21556 | 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; | |
21557 | if (offset & 127) return -1; | |
21558 | if (~output) if (output & 63) return -1; | |
21559 | hashed = finish(offset, length, -1) | 0; | |
21560 | t0h = H0h; | |
21561 | t0l = H0l; | |
21562 | t1h = H1h; | |
21563 | t1l = H1l; | |
21564 | t2h = H2h; | |
21565 | t2l = H2l; | |
21566 | t3h = H3h; | |
21567 | t3l = H3l; | |
21568 | t4h = H4h; | |
21569 | t4l = H4l; | |
21570 | t5h = H5h; | |
21571 | t5l = H5l; | |
21572 | t6h = H6h; | |
21573 | t6l = H6l; | |
21574 | t7h = H7h; | |
21575 | t7l = H7l; | |
21576 | _hmac_opad(); | |
21577 | _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); | |
21578 | if (~output) _state_to_heap(output); | |
21579 | return hashed | 0; | |
21580 | } | |
21581 | function pbkdf2_generate_block(offset, length, block, count, output) { | |
21582 | offset = offset | 0; | |
21583 | length = length | 0; | |
21584 | block = block | 0; | |
21585 | count = count | 0; | |
21586 | output = output | 0; | |
21587 | 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; | |
21588 | if (offset & 127) return -1; | |
21589 | if (~output) if (output & 63) return -1; | |
21590 | HEAP[offset + length | 0] = block >>> 24; | |
21591 | HEAP[offset + length + 1 | 0] = block >>> 16 & 255; | |
21592 | HEAP[offset + length + 2 | 0] = block >>> 8 & 255; | |
21593 | HEAP[offset + length + 3 | 0] = block & 255; | |
21594 | // Closure compiler warning - The result of the 'bitor' operator is not being used | |
21595 | //hmac_finish(offset, length + 4 | 0, -1) | 0; | |
21596 | hmac_finish(offset, length + 4 | 0, -1); | |
21597 | h0h = t0h = H0h; | |
21598 | h0l = t0l = H0l; | |
21599 | h1h = t1h = H1h; | |
21600 | h1l = t1l = H1l; | |
21601 | h2h = t2h = H2h; | |
21602 | h2l = t2l = H2l; | |
21603 | h3h = t3h = H3h; | |
21604 | h3l = t3l = H3l; | |
21605 | h4h = t4h = H4h; | |
21606 | h4l = t4l = H4l; | |
21607 | h5h = t5h = H5h; | |
21608 | h5l = t5l = H5l; | |
21609 | h6h = t6h = H6h; | |
21610 | h6l = t6l = H6l; | |
21611 | h7h = t7h = H7h; | |
21612 | h7l = t7l = H7l; | |
21613 | count = count - 1 | 0; | |
21614 | while ((count | 0) > 0) { | |
21615 | hmac_reset(); | |
21616 | _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); | |
21617 | t0h = H0h; | |
21618 | t0l = H0l; | |
21619 | t1h = H1h; | |
21620 | t1l = H1l; | |
21621 | t2h = H2h; | |
21622 | t2l = H2l; | |
21623 | t3h = H3h; | |
21624 | t3l = H3l; | |
21625 | t4h = H4h; | |
21626 | t4l = H4l; | |
21627 | t5h = H5h; | |
21628 | t5l = H5l; | |
21629 | t6h = H6h; | |
21630 | t6l = H6l; | |
21631 | t7h = H7h; | |
21632 | t7l = H7l; | |
21633 | _hmac_opad(); | |
21634 | _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); | |
21635 | t0h = H0h; | |
21636 | t0l = H0l; | |
21637 | t1h = H1h; | |
21638 | t1l = H1l; | |
21639 | t2h = H2h; | |
21640 | t2l = H2l; | |
21641 | t3h = H3h; | |
21642 | t3l = H3l; | |
21643 | t4h = H4h; | |
21644 | t4l = H4l; | |
21645 | t5h = H5h; | |
21646 | t5l = H5l; | |
21647 | t6h = H6h; | |
21648 | t6l = H6l; | |
21649 | t7h = H7h; | |
21650 | t7l = H7l; | |
21651 | h0h = h0h ^ H0h; | |
21652 | h0l = h0l ^ H0l; | |
21653 | h1h = h1h ^ H1h; | |
21654 | h1l = h1l ^ H1l; | |
21655 | h2h = h2h ^ H2h; | |
21656 | h2l = h2l ^ H2l; | |
21657 | h3h = h3h ^ H3h; | |
21658 | h3l = h3l ^ H3l; | |
21659 | h4h = h4h ^ H4h; | |
21660 | h4l = h4l ^ H4l; | |
21661 | h5h = h5h ^ H5h; | |
21662 | h5l = h5l ^ H5l; | |
21663 | h6h = h6h ^ H6h; | |
21664 | h6l = h6l ^ H6l; | |
21665 | h7h = h7h ^ H7h; | |
21666 | h7l = h7l ^ H7l; | |
21667 | count = count - 1 | 0; | |
21668 | } | |
21669 | H0h = h0h; | |
21670 | H0l = h0l; | |
21671 | H1h = h1h; | |
21672 | H1l = h1l; | |
21673 | H2h = h2h; | |
21674 | H2l = h2l; | |
21675 | H3h = h3h; | |
21676 | H3l = h3l; | |
21677 | H4h = h4h; | |
21678 | H4l = h4l; | |
21679 | H5h = h5h; | |
21680 | H5l = h5l; | |
21681 | H6h = h6h; | |
21682 | H6l = h6l; | |
21683 | H7h = h7h; | |
21684 | H7l = h7l; | |
21685 | if (~output) _state_to_heap(output); | |
21686 | return 0; | |
21687 | } | |
21688 | return { | |
21689 | reset: reset, | |
21690 | init: init, | |
21691 | process: process, | |
21692 | finish: finish, | |
21693 | hmac_reset: hmac_reset, | |
21694 | hmac_init: hmac_init, | |
21695 | hmac_finish: hmac_finish, | |
21696 | pbkdf2_generate_block: pbkdf2_generate_block | |
21697 | }; | |
21698 | } | |
21699 | var _sha512_block_size = 128, _sha512_hash_size = 64; | |
21700 | function sha512_constructor(options) { | |
21701 | options = options || {}; | |
21702 | options.heapSize = options.heapSize || 4096; | |
21703 | if (options.heapSize <= 0 || options.heapSize % 4096) throw new IllegalArgumentError("heapSize must be a positive number and multiple of 4096"); | |
21704 | this.heap = options.heap || new Uint8Array(options.heapSize); | |
21705 | this.asm = options.asm || sha512_asm(global, null, this.heap.buffer); | |
21706 | this.BLOCK_SIZE = _sha512_block_size; | |
21707 | this.HASH_SIZE = _sha512_hash_size; | |
21708 | this.reset(); | |
21709 | } | |
21710 | function sha512_reset() { | |
21711 | this.result = null; | |
21712 | this.pos = 0; | |
21713 | this.len = 0; | |
21714 | this.asm.reset(); | |
21715 | return this; | |
21716 | } | |
21717 | function sha512_process(data) { | |
21718 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
21719 | var dpos = 0, dlen = 0, clen = 0; | |
21720 | if (is_buffer(data) || is_bytes(data)) { | |
21721 | dpos = data.byteOffset || 0; | |
21722 | dlen = data.byteLength; | |
21723 | } else if (is_string(data)) { | |
21724 | dlen = data.length; | |
21725 | } else { | |
21726 | throw new TypeError("data isn't of expected type"); | |
21727 | } | |
21728 | while (dlen > 0) { | |
21729 | clen = this.heap.byteLength - this.pos - this.len; | |
21730 | clen = clen < dlen ? clen : dlen; | |
21731 | if (is_buffer(data) || is_bytes(data)) { | |
21732 | this.heap.set(new Uint8Array(data.buffer || data, dpos, clen), this.pos + this.len); | |
21733 | } else { | |
21734 | for (var i = 0; i < clen; i++) this.heap[this.pos + this.len + i] = data.charCodeAt(dpos + i); | |
21735 | } | |
21736 | this.len += clen; | |
21737 | dpos += clen; | |
21738 | dlen -= clen; | |
21739 | clen = this.asm.process(this.pos, this.len); | |
21740 | if (clen < this.len) { | |
21741 | this.pos += clen; | |
21742 | this.len -= clen; | |
21743 | } else { | |
21744 | this.pos = 0; | |
21745 | this.len = 0; | |
21746 | } | |
21747 | } | |
21748 | return this; | |
21749 | } | |
21750 | function sha512_finish() { | |
21751 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
21752 | this.asm.finish(this.pos, this.len, 0); | |
21753 | this.result = new Uint8Array(_sha512_hash_size); | |
21754 | this.result.set(this.heap.subarray(0, _sha512_hash_size)); | |
21755 | this.pos = 0; | |
21756 | this.len = 0; | |
21757 | return this; | |
21758 | } | |
21759 | sha512_constructor.BLOCK_SIZE = _sha512_block_size; | |
21760 | sha512_constructor.HASH_SIZE = _sha512_hash_size; | |
21761 | var sha512_prototype = sha512_constructor.prototype; | |
21762 | sha512_prototype.reset = sha512_reset; | |
21763 | sha512_prototype.process = sha512_process; | |
21764 | sha512_prototype.finish = sha512_finish; | |
21765 | function hmac_constructor(options) { | |
21766 | options = options || {}; | |
21767 | if (!options.hash) throw new SyntaxError("option 'hash' is required"); | |
21768 | if (!options.hash.HASH_SIZE) throw new SyntaxError("option 'hash' supplied doesn't seem to be a valid hash function"); | |
21769 | this.hash = options.hash; | |
21770 | this.BLOCK_SIZE = this.hash.BLOCK_SIZE; | |
21771 | this.HMAC_SIZE = this.hash.HASH_SIZE; | |
21772 | this.key = null; | |
21773 | this.verify = null; | |
21774 | this.result = null; | |
21775 | if (options.password !== undefined || options.verify !== undefined) this.reset(options); | |
21776 | return this; | |
21777 | } | |
21778 | function hmac_sha256_constructor(options) { | |
21779 | options = options || {}; | |
21780 | if (!(options.hash instanceof sha256_constructor)) options.hash = new sha256_constructor(options); | |
21781 | hmac_constructor.call(this, options); | |
21782 | return this; | |
21783 | } | |
21784 | function hmac_sha512_constructor(options) { | |
21785 | options = options || {}; | |
21786 | if (!(options.hash instanceof sha512_constructor)) options.hash = new sha512_constructor(options); | |
21787 | hmac_constructor.call(this, options); | |
21788 | return this; | |
21789 | } | |
21790 | function _hmac_key(hash, password) { | |
21791 | var key; | |
21792 | if (is_buffer(password) || is_bytes(password)) { | |
21793 | key = new Uint8Array(hash.BLOCK_SIZE); | |
21794 | if (password.byteLength > hash.BLOCK_SIZE) { | |
21795 | key.set(new Uint8Array(hash.reset().process(password).finish().result)); | |
21796 | } else if (is_buffer(password)) { | |
21797 | key.set(new Uint8Array(password)); | |
21798 | } else { | |
21799 | key.set(password); | |
21800 | } | |
21801 | } else if (is_string(password)) { | |
21802 | key = new Uint8Array(hash.BLOCK_SIZE); | |
21803 | if (password.length > hash.BLOCK_SIZE) { | |
21804 | key.set(new Uint8Array(hash.reset().process(password).finish().result)); | |
21805 | } else { | |
21806 | for (var i = 0; i < password.length; ++i) key[i] = password.charCodeAt(i); | |
21807 | } | |
21808 | } else { | |
21809 | throw new TypeError("password isn't of expected type"); | |
21810 | } | |
21811 | return key; | |
21812 | } | |
21813 | function _hmac_init_verify(verify) { | |
21814 | if (is_buffer(verify) || is_bytes(verify)) { | |
21815 | verify = new Uint8Array(verify); | |
21816 | } else if (is_string(verify)) { | |
21817 | verify = string_to_bytes(verify); | |
21818 | } else { | |
21819 | throw new TypeError("verify tag isn't of expected type"); | |
21820 | } | |
21821 | if (verify.length !== this.HMAC_SIZE) throw new IllegalArgumentError("illegal verification tag size"); | |
21822 | this.verify = verify; | |
21823 | } | |
21824 | function hmac_reset(options) { | |
21825 | options = options || {}; | |
21826 | var password = options.password; | |
21827 | if (this.key === null && !is_string(password) && !password) throw new IllegalStateError("no key is associated with the instance"); | |
21828 | this.result = null; | |
21829 | this.hash.reset(); | |
21830 | if (password || is_string(password)) this.key = _hmac_key(this.hash, password); | |
21831 | var ipad = new Uint8Array(this.key); | |
21832 | for (var i = 0; i < ipad.length; ++i) ipad[i] ^= 54; | |
21833 | this.hash.process(ipad); | |
21834 | var verify = options.verify; | |
21835 | if (verify !== undefined) { | |
21836 | _hmac_init_verify.call(this, verify); | |
21837 | } else { | |
21838 | this.verify = null; | |
21839 | } | |
21840 | return this; | |
21841 | } | |
21842 | function hmac_sha256_reset(options) { | |
21843 | options = options || {}; | |
21844 | var password = options.password; | |
21845 | if (this.key === null && !is_string(password) && !password) throw new IllegalStateError("no key is associated with the instance"); | |
21846 | this.result = null; | |
21847 | this.hash.reset(); | |
21848 | if (password || is_string(password)) { | |
21849 | this.key = _hmac_key(this.hash, password); | |
21850 | 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]); | |
21851 | } else { | |
21852 | this.hash.asm.hmac_reset(); | |
21853 | } | |
21854 | var verify = options.verify; | |
21855 | if (verify !== undefined) { | |
21856 | _hmac_init_verify.call(this, verify); | |
21857 | } else { | |
21858 | this.verify = null; | |
21859 | } | |
21860 | return this; | |
21861 | } | |
21862 | function hmac_sha512_reset(options) { | |
21863 | options = options || {}; | |
21864 | var password = options.password; | |
21865 | if (this.key === null && !is_string(password) && !password) throw new IllegalStateError("no key is associated with the instance"); | |
21866 | this.result = null; | |
21867 | this.hash.reset(); | |
21868 | if (password || is_string(password)) { | |
21869 | this.key = _hmac_key(this.hash, password); | |
21870 | 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]); | |
21871 | } else { | |
21872 | this.hash.asm.hmac_reset(); | |
21873 | } | |
21874 | var verify = options.verify; | |
21875 | if (verify !== undefined) { | |
21876 | _hmac_init_verify.call(this, verify); | |
21877 | } else { | |
21878 | this.verify = null; | |
21879 | } | |
21880 | return this; | |
21881 | } | |
21882 | function hmac_process(data) { | |
21883 | if (this.key === null) throw new IllegalStateError("no key is associated with the instance"); | |
21884 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
21885 | this.hash.process(data); | |
21886 | return this; | |
21887 | } | |
21888 | function hmac_finish() { | |
21889 | if (this.key === null) throw new IllegalStateError("no key is associated with the instance"); | |
21890 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
21891 | var inner_result = this.hash.finish().result; | |
21892 | var opad = new Uint8Array(this.key); | |
21893 | for (var i = 0; i < opad.length; ++i) opad[i] ^= 92; | |
21894 | var verify = this.verify; | |
21895 | var result = this.hash.reset().process(opad).process(inner_result).finish().result; | |
21896 | if (verify) { | |
21897 | if (verify.length === result.length) { | |
21898 | var diff = 0; | |
21899 | for (var i = 0; i < verify.length; i++) { | |
21900 | diff |= verify[i] ^ result[i]; | |
21901 | } | |
21902 | this.result = !diff; | |
21903 | } else { | |
21904 | this.result = false; | |
21905 | } | |
21906 | } else { | |
21907 | this.result = result; | |
21908 | } | |
21909 | return this; | |
21910 | } | |
21911 | function hmac_sha256_finish() { | |
21912 | if (this.key === null) throw new IllegalStateError("no key is associated with the instance"); | |
21913 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
21914 | var hash = this.hash, asm = this.hash.asm, heap = this.hash.heap; | |
21915 | asm.hmac_finish(hash.pos, hash.len, 0); | |
21916 | var verify = this.verify; | |
21917 | var result = new Uint8Array(_sha256_hash_size); | |
21918 | result.set(heap.subarray(0, _sha256_hash_size)); | |
21919 | if (verify) { | |
21920 | if (verify.length === result.length) { | |
21921 | var diff = 0; | |
21922 | for (var i = 0; i < verify.length; i++) { | |
21923 | diff |= verify[i] ^ result[i]; | |
21924 | } | |
21925 | this.result = !diff; | |
21926 | } else { | |
21927 | this.result = false; | |
21928 | } | |
21929 | } else { | |
21930 | this.result = result; | |
21931 | } | |
21932 | return this; | |
21933 | } | |
21934 | function hmac_sha512_finish() { | |
21935 | if (this.key === null) throw new IllegalStateError("no key is associated with the instance"); | |
21936 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
21937 | var hash = this.hash, asm = this.hash.asm, heap = this.hash.heap; | |
21938 | asm.hmac_finish(hash.pos, hash.len, 0); | |
21939 | var verify = this.verify; | |
21940 | var result = new Uint8Array(_sha512_hash_size); | |
21941 | result.set(heap.subarray(0, _sha512_hash_size)); | |
21942 | if (verify) { | |
21943 | if (verify.length === result.length) { | |
21944 | var diff = 0; | |
21945 | for (var i = 0; i < verify.length; i++) { | |
21946 | diff |= verify[i] ^ result[i]; | |
21947 | } | |
21948 | this.result = !diff; | |
21949 | } else { | |
21950 | this.result = false; | |
21951 | } | |
21952 | } else { | |
21953 | this.result = result; | |
21954 | } | |
21955 | return this; | |
21956 | } | |
21957 | var hmac_prototype = hmac_constructor.prototype; | |
21958 | hmac_prototype.reset = hmac_reset; | |
21959 | hmac_prototype.process = hmac_process; | |
21960 | hmac_prototype.finish = hmac_finish; | |
21961 | hmac_sha256_constructor.BLOCK_SIZE = sha256_constructor.BLOCK_SIZE; | |
21962 | hmac_sha256_constructor.HMAC_SIZE = sha256_constructor.HASH_SIZE; | |
21963 | var hmac_sha256_prototype = hmac_sha256_constructor.prototype; | |
21964 | hmac_sha256_prototype.reset = hmac_sha256_reset; | |
21965 | hmac_sha256_prototype.process = hmac_process; | |
21966 | hmac_sha256_prototype.finish = hmac_sha256_finish; | |
21967 | hmac_sha512_constructor.BLOCK_SIZE = sha512_constructor.BLOCK_SIZE; | |
21968 | hmac_sha512_constructor.HMAC_SIZE = sha512_constructor.HASH_SIZE; | |
21969 | var hmac_sha512_prototype = hmac_sha512_constructor.prototype; | |
21970 | hmac_sha512_prototype.reset = hmac_sha512_reset; | |
21971 | hmac_sha512_prototype.process = hmac_process; | |
21972 | hmac_sha512_prototype.finish = hmac_sha512_finish; | |
21973 | function pbkdf2_constructor(options) { | |
21974 | options = options || {}; | |
21975 | if (!options.hmac) throw new SyntaxError("option 'hmac' is required"); | |
21976 | if (!options.hmac.HMAC_SIZE) throw new SyntaxError("option 'hmac' supplied doesn't seem to be a valid HMAC function"); | |
21977 | this.hmac = options.hmac; | |
21978 | this.count = options.count || 4096; | |
21979 | this.length = options.length || this.hmac.HMAC_SIZE; | |
21980 | this.result = null; | |
21981 | var password = options.password; | |
21982 | if (password || is_string(password)) this.reset(options); | |
21983 | return this; | |
21984 | } | |
21985 | function pbkdf2_hmac_sha256_constructor(options) { | |
21986 | options = options || {}; | |
21987 | if (!(options.hmac instanceof hmac_sha256_constructor)) options.hmac = new hmac_sha256_constructor(options); | |
21988 | pbkdf2_constructor.call(this, options); | |
21989 | return this; | |
21990 | } | |
21991 | function pbkdf2_hmac_sha512_constructor(options) { | |
21992 | options = options || {}; | |
21993 | if (!(options.hmac instanceof hmac_sha512_constructor)) options.hmac = new hmac_sha512_constructor(options); | |
21994 | pbkdf2_constructor.call(this, options); | |
21995 | return this; | |
21996 | } | |
21997 | function pbkdf2_reset(options) { | |
21998 | this.result = null; | |
21999 | this.hmac.reset(options); | |
22000 | return this; | |
22001 | } | |
22002 | function pbkdf2_generate(salt, count, length) { | |
22003 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
22004 | if (!salt && !is_string(salt)) throw new IllegalArgumentError("bad 'salt' value"); | |
22005 | count = count || this.count; | |
22006 | length = length || this.length; | |
22007 | this.result = new Uint8Array(length); | |
22008 | var blocks = Math.ceil(length / this.hmac.HMAC_SIZE); | |
22009 | for (var i = 1; i <= blocks; ++i) { | |
22010 | var j = (i - 1) * this.hmac.HMAC_SIZE; | |
22011 | var l = (i < blocks ? 0 : length % this.hmac.HMAC_SIZE) || this.hmac.HMAC_SIZE; | |
22012 | 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); | |
22013 | this.result.set(tmp.subarray(0, l), j); | |
22014 | for (var k = 1; k < count; ++k) { | |
22015 | tmp = new Uint8Array(this.hmac.reset().process(tmp).finish().result); | |
22016 | for (var r = 0; r < l; ++r) this.result[j + r] ^= tmp[r]; | |
22017 | } | |
22018 | } | |
22019 | return this; | |
22020 | } | |
22021 | function pbkdf2_hmac_sha256_generate(salt, count, length) { | |
22022 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
22023 | if (!salt && !is_string(salt)) throw new IllegalArgumentError("bad 'salt' value"); | |
22024 | count = count || this.count; | |
22025 | length = length || this.length; | |
22026 | this.result = new Uint8Array(length); | |
22027 | var blocks = Math.ceil(length / this.hmac.HMAC_SIZE); | |
22028 | for (var i = 1; i <= blocks; ++i) { | |
22029 | var j = (i - 1) * this.hmac.HMAC_SIZE; | |
22030 | var l = (i < blocks ? 0 : length % this.hmac.HMAC_SIZE) || this.hmac.HMAC_SIZE; | |
22031 | this.hmac.reset().process(salt); | |
22032 | this.hmac.hash.asm.pbkdf2_generate_block(this.hmac.hash.pos, this.hmac.hash.len, i, count, 0); | |
22033 | this.result.set(this.hmac.hash.heap.subarray(0, l), j); | |
22034 | } | |
22035 | return this; | |
22036 | } | |
22037 | function pbkdf2_hmac_sha512_generate(salt, count, length) { | |
22038 | if (this.result !== null) throw new IllegalStateError("state must be reset before processing new data"); | |
22039 | if (!salt && !is_string(salt)) throw new IllegalArgumentError("bad 'salt' value"); | |
22040 | count = count || this.count; | |
22041 | length = length || this.length; | |
22042 | this.result = new Uint8Array(length); | |
22043 | var blocks = Math.ceil(length / this.hmac.HMAC_SIZE); | |
22044 | for (var i = 1; i <= blocks; ++i) { | |
22045 | var j = (i - 1) * this.hmac.HMAC_SIZE; | |
22046 | var l = (i < blocks ? 0 : length % this.hmac.HMAC_SIZE) || this.hmac.HMAC_SIZE; | |
22047 | this.hmac.reset().process(salt); | |
22048 | this.hmac.hash.asm.pbkdf2_generate_block(this.hmac.hash.pos, this.hmac.hash.len, i, count, 0); | |
22049 | this.result.set(this.hmac.hash.heap.subarray(0, l), j); | |
22050 | } | |
22051 | return this; | |
22052 | } | |
22053 | var pbkdf2_prototype = pbkdf2_constructor.prototype; | |
22054 | pbkdf2_prototype.reset = pbkdf2_reset; | |
22055 | pbkdf2_prototype.generate = pbkdf2_generate; | |
22056 | var pbkdf2_hmac_sha256_prototype = pbkdf2_hmac_sha256_constructor.prototype; | |
22057 | pbkdf2_hmac_sha256_prototype.reset = pbkdf2_reset; | |
22058 | pbkdf2_hmac_sha256_prototype.generate = pbkdf2_hmac_sha256_generate; | |
22059 | var pbkdf2_hmac_sha512_prototype = pbkdf2_hmac_sha512_constructor.prototype; | |
22060 | pbkdf2_hmac_sha512_prototype.reset = pbkdf2_reset; | |
22061 | pbkdf2_hmac_sha512_prototype.generate = pbkdf2_hmac_sha512_generate; | |
22062 | global.IllegalStateError = IllegalStateError; | |
22063 | global.IllegalArgumentError = IllegalArgumentError; | |
22064 | global.SecurityError = SecurityError; | |
22065 | exports.string_to_bytes = string_to_bytes; | |
22066 | exports.hex_to_bytes = hex_to_bytes; | |
22067 | exports.base64_to_bytes = base64_to_bytes; | |
22068 | exports.bytes_to_string = bytes_to_string; | |
22069 | exports.bytes_to_hex = bytes_to_hex; | |
22070 | exports.bytes_to_base64 = bytes_to_base64; | |
22071 | var SHA256_instance = new sha256_constructor({ | |
22072 | heapSize: 1048576 | |
22073 | }); | |
22074 | function sha256_bytes(data) { | |
22075 | if (data === undefined) throw new SyntaxError("data required"); | |
22076 | return SHA256_instance.reset().process(data).finish().result; | |
22077 | } | |
22078 | function sha256_hex(data) { | |
22079 | var result = sha256_bytes(data); | |
22080 | return bytes_to_hex(result); | |
22081 | } | |
22082 | function sha256_base64(data) { | |
22083 | var result = sha256_bytes(data); | |
22084 | return bytes_to_base64(result); | |
22085 | } | |
22086 | exports.SHA256 = { | |
22087 | bytes: sha256_bytes, | |
22088 | hex: sha256_hex, | |
22089 | base64: sha256_base64 | |
22090 | }; | |
22091 | var SHA512_instance = new sha512_constructor({ | |
22092 | heapSize: 1048576 | |
22093 | }); | |
22094 | function sha512_bytes(data) { | |
22095 | if (data === undefined) throw new SyntaxError("data required"); | |
22096 | return SHA512_instance.reset().process(data).finish().result; | |
22097 | } | |
22098 | function sha512_hex(data) { | |
22099 | var result = sha512_bytes(data); | |
22100 | return bytes_to_hex(result); | |
22101 | } | |
22102 | function sha512_base64(data) { | |
22103 | var result = sha512_bytes(data); | |
22104 | return bytes_to_base64(result); | |
22105 | } | |
22106 | exports.SHA512 = { | |
22107 | bytes: sha512_bytes, | |
22108 | hex: sha512_hex, | |
22109 | base64: sha512_base64 | |
22110 | }; | |
22111 | var hmac_sha256_instance = new hmac_sha256_constructor({ | |
22112 | hash: SHA256_instance | |
22113 | }); | |
22114 | function hmac_sha256_bytes(data, password) { | |
22115 | if (data === undefined) throw new SyntaxError("data required"); | |
22116 | if (password === undefined) throw new SyntaxError("password required"); | |
22117 | return hmac_sha256_instance.reset({ | |
22118 | password: password | |
22119 | }).process(data).finish().result; | |
22120 | } | |
22121 | function hmac_sha256_hex(data, password) { | |
22122 | var result = hmac_sha256_bytes(data, password); | |
22123 | return bytes_to_hex(result); | |
22124 | } | |
22125 | function hmac_sha256_base64(data, password) { | |
22126 | var result = hmac_sha256_bytes(data, password); | |
22127 | return bytes_to_base64(result); | |
22128 | } | |
22129 | exports.HMAC = exports.HMAC_SHA256 = { | |
22130 | bytes: hmac_sha256_bytes, | |
22131 | hex: hmac_sha256_hex, | |
22132 | base64: hmac_sha256_base64 | |
22133 | }; | |
22134 | var hmac_sha512_instance = new hmac_sha512_constructor({ | |
22135 | hash: SHA512_instance | |
22136 | }); | |
22137 | function hmac_sha512_bytes(data, password) { | |
22138 | if (data === undefined) throw new SyntaxError("data required"); | |
22139 | if (password === undefined) throw new SyntaxError("password required"); | |
22140 | return hmac_sha512_instance.reset({ | |
22141 | password: password | |
22142 | }).process(data).finish().result; | |
22143 | } | |
22144 | function hmac_sha512_hex(data, password) { | |
22145 | var result = hmac_sha512_bytes(data, password); | |
22146 | return bytes_to_hex(result); | |
22147 | } | |
22148 | function hmac_sha512_base64(data, password) { | |
22149 | var result = hmac_sha512_bytes(data, password); | |
22150 | return bytes_to_base64(result); | |
22151 | } | |
22152 | exports.HMAC_SHA512 = { | |
22153 | bytes: hmac_sha512_bytes, | |
22154 | hex: hmac_sha512_hex, | |
22155 | base64: hmac_sha512_base64 | |
22156 | }; | |
22157 | var pbkdf2_hmac_sha256_instance = new pbkdf2_hmac_sha256_constructor({ | |
22158 | hmac: hmac_sha256_instance | |
22159 | }); | |
22160 | function pbkdf2_hmac_sha256_bytes(password, salt, iterations, dklen) { | |
22161 | if (password === undefined) throw new SyntaxError("password required"); | |
22162 | if (salt === undefined) throw new SyntaxError("salt required"); | |
22163 | return pbkdf2_hmac_sha256_instance.reset({ | |
22164 | password: password | |
22165 | }).generate(salt, iterations, dklen).result; | |
22166 | } | |
22167 | function pbkdf2_hmac_sha256_hex(password, salt, iterations, dklen) { | |
22168 | var result = pbkdf2_hmac_sha256_bytes(password, salt, iterations, dklen); | |
22169 | return bytes_to_hex(result); | |
22170 | } | |
22171 | function pbkdf2_hmac_sha256_base64(password, salt, iterations, dklen) { | |
22172 | var result = pbkdf2_hmac_sha256_bytes(password, salt, iterations, dklen); | |
22173 | return bytes_to_base64(result); | |
22174 | } | |
22175 | exports.PBKDF2 = exports.PBKDF2_HMAC_SHA256 = { | |
22176 | bytes: pbkdf2_hmac_sha256_bytes, | |
22177 | hex: pbkdf2_hmac_sha256_hex, | |
22178 | base64: pbkdf2_hmac_sha256_base64 | |
22179 | }; | |
22180 | var pbkdf2_hmac_sha512_instance = new pbkdf2_hmac_sha512_constructor({ | |
22181 | hmac: hmac_sha512_instance | |
22182 | }); | |
22183 | function pbkdf2_hmac_sha512_bytes(password, salt, iterations, dklen) { | |
22184 | if (password === undefined) throw new SyntaxError("password required"); | |
22185 | if (salt === undefined) throw new SyntaxError("salt required"); | |
22186 | return pbkdf2_hmac_sha512_instance.reset({ | |
22187 | password: password | |
22188 | }).generate(salt, iterations, dklen).result; | |
22189 | } | |
22190 | function pbkdf2_hmac_sha512_hex(password, salt, iterations, dklen) { | |
22191 | var result = pbkdf2_hmac_sha512_bytes(password, salt, iterations, dklen); | |
22192 | return bytes_to_hex(result); | |
22193 | } | |
22194 | function pbkdf2_hmac_sha512_base64(password, salt, iterations, dklen) { | |
22195 | var result = pbkdf2_hmac_sha512_bytes(password, salt, iterations, dklen); | |
22196 | return bytes_to_base64(result); | |
22197 | } | |
22198 | exports.PBKDF2_HMAC_SHA512 = { | |
22199 | bytes: pbkdf2_hmac_sha512_bytes, | |
22200 | hex: pbkdf2_hmac_sha512_hex, | |
22201 | base64: pbkdf2_hmac_sha512_base64 | |
22202 | }; | |
22203 | var cbc_aes_instance = new cbc_aes_constructor({ | |
22204 | heapSize: 1048576 | |
22205 | }); | |
22206 | function cbc_aes_encrypt_bytes(data, key, padding, iv) { | |
22207 | if (data === undefined) throw new SyntaxError("data required"); | |
22208 | if (key === undefined) throw new SyntaxError("key required"); | |
22209 | return cbc_aes_instance.reset({ | |
22210 | key: key, | |
22211 | padding: padding, | |
22212 | iv: iv | |
22213 | }).encrypt(data).result; | |
22214 | } | |
22215 | function cbc_aes_decrypt_bytes(data, key, padding, iv) { | |
22216 | if (data === undefined) throw new SyntaxError("data required"); | |
22217 | if (key === undefined) throw new SyntaxError("key required"); | |
22218 | return cbc_aes_instance.reset({ | |
22219 | key: key, | |
22220 | padding: padding, | |
22221 | iv: iv | |
22222 | }).decrypt(data).result; | |
22223 | } | |
22224 | exports.AES = exports.AES_CBC = { | |
22225 | encrypt: cbc_aes_encrypt_bytes, | |
22226 | decrypt: cbc_aes_decrypt_bytes | |
22227 | }; | |
22228 | var ccm_aes_instance = new ccm_aes_constructor({ | |
22229 | heap: cbc_aes_instance.heap, | |
22230 | asm: cbc_aes_instance.asm | |
22231 | }); | |
22232 | function ccm_aes_encrypt_bytes(data, key, nonce, adata, tagSize) { | |
22233 | if (data === undefined) throw new SyntaxError("data required"); | |
22234 | if (key === undefined) throw new SyntaxError("key required"); | |
22235 | if (nonce === undefined) throw new SyntaxError("nonce required"); | |
22236 | var dataLength = data.byteLength || data.length || 0; | |
22237 | return ccm_aes_instance.reset({ | |
22238 | key: key, | |
22239 | nonce: nonce, | |
22240 | adata: adata, | |
22241 | tagSize: tagSize, | |
22242 | dataLength: dataLength | |
22243 | }).encrypt(data).result; | |
22244 | } | |
22245 | function ccm_aes_decrypt_bytes(data, key, nonce, adata, tagSize) { | |
22246 | if (data === undefined) throw new SyntaxError("data required"); | |
22247 | if (key === undefined) throw new SyntaxError("key required"); | |
22248 | if (nonce === undefined) throw new SyntaxError("nonce required"); | |
22249 | var dataLength = data.byteLength || data.length || 0; | |
22250 | tagSize = tagSize || _aes_block_size; | |
22251 | return ccm_aes_instance.reset({ | |
22252 | key: key, | |
22253 | nonce: nonce, | |
22254 | adata: adata, | |
22255 | tagSize: tagSize, | |
22256 | dataLength: dataLength - tagSize | |
22257 | }).decrypt(data).result; | |
22258 | } | |
22259 | exports.AES_CCM = { | |
22260 | encrypt: ccm_aes_encrypt_bytes, | |
22261 | decrypt: ccm_aes_decrypt_bytes | |
22262 | }; | |
22263 | var cfb_aes_instance = new cfb_aes_constructor({ | |
22264 | heap: cbc_aes_instance.heap, | |
22265 | asm: cbc_aes_instance.asm | |
22266 | }); | |
22267 | function cfb_aes_encrypt_bytes(data, key, padding, iv) { | |
22268 | if (data === undefined) throw new SyntaxError("data required"); | |
22269 | if (key === undefined) throw new SyntaxError("key required"); | |
22270 | return cfb_aes_instance.reset({ | |
22271 | key: key, | |
22272 | padding: padding, | |
22273 | iv: iv | |
22274 | }).encrypt(data).result; | |
22275 | } | |
22276 | function cfb_aes_decrypt_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 cfb_aes_instance.reset({ | |
22280 | key: key, | |
22281 | padding: padding, | |
22282 | iv: iv | |
22283 | }).decrypt(data).result; | |
22284 | } | |
22285 | exports.AES_CFB = { | |
22286 | encrypt: cfb_aes_encrypt_bytes, | |
22287 | decrypt: cfb_aes_decrypt_bytes | |
22288 | }; | |
22289 | var cfb_aes_decrypt_instance = new cfb_aes_decrypt_constructor({ | |
22290 | heap: cbc_aes_instance.heap, | |
22291 | asm: cbc_aes_instance.asm | |
22292 | }); | |
22293 | function cfb_aes_decrypt_init(key, padding, iv) { | |
22294 | if (key === undefined) throw new SyntaxError("key required"); | |
22295 | return cfb_aes_decrypt_instance.reset({ | |
22296 | key: key, | |
22297 | padding: padding, | |
22298 | iv: iv | |
22299 | }); | |
22300 | } | |
22301 | exports.AES_CFB = exports.AES_CFB || {}; | |
22302 | exports.AES_CFB.decryptor = { | |
22303 | init: cfb_aes_decrypt_init | |
22304 | }; | |
22305 | })({}, function() { | |
22306 | return this; | |
22307 | }()); | |
22308 | </script> | |
22309 | ||
22310 | <!--<script src="/js/jsbip39.js"></script>--> | |
22311 | <script> | |
22312 | /* | |
22313 | * Copyright (c) 2013 Pavol Rusnak | |
22314 | * | |
22315 | * Permission is hereby granted, free of charge, to any person obtaining a copy of | |
22316 | * this software and associated documentation files (the "Software"), to deal in | |
22317 | * the Software without restriction, including without limitation the rights to | |
22318 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | |
22319 | * of the Software, and to permit persons to whom the Software is furnished to do | |
22320 | * so, subject to the following conditions: | |
22321 | * | |
22322 | * The above copyright notice and this permission notice shall be included in all | |
22323 | * copies or substantial portions of the Software. | |
22324 | * | |
22325 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
22326 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
22327 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
22328 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |
22329 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |
22330 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
22331 | */ | |
22332 | ||
22333 | /* | |
22334 | * Javascript port from python by Ian Coleman | |
22335 | * | |
22336 | * Includes code from asmCrypto | |
22337 | * https://github.com/tresorit/asmcrypto.js | |
22338 | */ | |
22339 | ||
22340 | var Mnemonic = function(language) { | |
22341 | ||
22342 | var PBKDF2_ROUNDS = 2048; | |
22343 | var RADIX = 2048; | |
22344 | ||
22345 | var self = this; | |
22346 | var wordlist = []; | |
22347 | ||
22348 | function init() { | |
22349 | wordlist = WORDLISTS[language]; | |
22350 | if (wordlist.length != RADIX) { | |
22351 | err = 'Wordlist should contain ' + RADIX + ' words, but it contains ' + wordlist.length + ' words.'; | |
22352 | throw err; | |
22353 | } | |
22354 | } | |
22355 | ||
22356 | self.generate = function(strength) { | |
22357 | strength = strength || 128; | |
22358 | var r = strength % 32; | |
22359 | if (r > 0) { | |
22360 | throw 'Strength should be divisible by 32, but it is not (' + r + ').'; | |
22361 | } | |
22362 | var hasStrongCrypto = 'crypto' in window && window['crypto'] !== null; | |
22363 | if (!hasStrongCrypto) { | |
22364 | throw 'Mnemonic should be generated with strong randomness, but crypto.getRandomValues is unavailable'; | |
22365 | } | |
22366 | var buffer = new Uint8Array(strength / 8); | |
22367 | var data = crypto.getRandomValues(buffer); | |
22368 | return self.toMnemonic(data); | |
22369 | } | |
22370 | ||
22371 | self.toMnemonic = function(data) { | |
22372 | if (data.length % 4 > 0) { | |
22373 | throw 'Data length in bits should be divisible by 32, but it is not (' + data.length + ' bytes = ' + data.length*8 + ' bits).' | |
22374 | } | |
22375 | ||
22376 | //h = hashlib.sha256(data).hexdigest() | |
22377 | var uintArray = new Uint8Array(data); | |
22378 | var h = asmCrypto.SHA256.bytes(uintArray); | |
22379 | ||
22380 | // b is a binary string, eg '00111010101100...' | |
22381 | //b = bin(int(binascii.hexlify(data), 16))[2:].zfill(len(data) * 8) + \ | |
22382 | // bin(int(h, 16))[2:].zfill(256)[:len(data) * 8 / 32] | |
22383 | // | |
22384 | // a = bin(int(binascii.hexlify(data), 16))[2:].zfill(len(data) * 8) | |
22385 | // c = bin(int(h, 16))[2:].zfill(256) | |
22386 | // d = c[:len(data) * 8 / 32] | |
22387 | var a = byteArrayToBinaryString(data); | |
22388 | var c = byteArrayToBinaryString(h); | |
22389 | var d = c.substring(0, data.length * 8 / 32); | |
22390 | // b = line1 + line2 | |
22391 | var b = a + d; | |
22392 | ||
22393 | var result = []; | |
22394 | var blen = b.length / 11; | |
22395 | for (var i=0; i<blen; i++) { | |
22396 | var idx = parseInt(b.substring(i * 11, (i + 1) * 11), 2); | |
22397 | result.push(wordlist[idx]); | |
22398 | } | |
22399 | return result.join(' '); | |
22400 | } | |
22401 | ||
22402 | self.check = function(mnemonic) { | |
22403 | var mnemonic = mnemonic.split(' ') | |
22404 | if (mnemonic.length % 3 > 0) { | |
22405 | return false | |
22406 | } | |
22407 | // idx = map(lambda x: bin(self.wordlist.index(x))[2:].zfill(11), mnemonic) | |
22408 | var idx = []; | |
22409 | for (var i=0; i<mnemonic.length; i++) { | |
22410 | var word = mnemonic[i]; | |
22411 | var wordIndex = wordlist.indexOf(word); | |
22412 | if (wordIndex == -1) { | |
22413 | return false; | |
22414 | } | |
22415 | var binaryIndex = zfill(wordIndex.toString(2), 11); | |
22416 | idx.push(binaryIndex); | |
22417 | } | |
22418 | var b = idx.join(''); | |
22419 | var l = b.length; | |
22420 | //d = b[:l / 33 * 32] | |
22421 | //h = b[-l / 33:] | |
22422 | var d = b.substring(0, l / 33 * 32); | |
22423 | var h = b.substring(l - l / 33, l); | |
22424 | //nd = binascii.unhexlify(hex(int(d, 2))[2:].rstrip('L').zfill(l / 33 * 8)) | |
22425 | //nh = bin(int(hashlib.sha256(nd).hexdigest(), 16))[2:].zfill(256)[:l / 33] | |
22426 | var nd = binaryStringToByteArray(d); | |
22427 | var ndHash = asmCrypto.SHA256.bytes(nd); | |
22428 | var ndBstr = zfill(byteArrayToBinaryString(ndHash), 256); | |
22429 | var nh = ndBstr.substring(0,l/33); | |
22430 | return h == nh; | |
22431 | } | |
22432 | ||
22433 | self.toSeed = function(mnemonic, passphrase) { | |
22434 | passphrase = passphrase || ''; | |
22435 | mnemonic = normalizeString(mnemonic) | |
22436 | passphrase = normalizeString(passphrase) | |
22437 | passphrase = "mnemonic" + passphrase; | |
22438 | //return PBKDF2(mnemonic, 'mnemonic' + passphrase, iterations=PBKDF2_ROUNDS, macmodule=hmac, digestmodule=hashlib.sha512).read(64) | |
22439 | return asmCrypto.PBKDF2_HMAC_SHA512.hex(mnemonic, passphrase, PBKDF2_ROUNDS, 512/8); | |
22440 | } | |
22441 | ||
22442 | function normalizeString(str) { | |
22443 | if (typeof str.normalize == "function") { | |
22444 | return str.normalize("NFKD"); | |
22445 | } | |
22446 | else { | |
22447 | // TODO find a library to do this | |
22448 | // Not supported on firefox mobile | |
22449 | console.warn("NFKD Normalization is unavailable"); | |
22450 | return str; | |
22451 | } | |
22452 | } | |
22453 | ||
22454 | function byteArrayToBinaryString(data) { | |
22455 | var bin = ""; | |
22456 | for (var i=0; i<data.length; i++) { | |
22457 | bin += zfill(data[i].toString(2), 8); | |
22458 | } | |
22459 | return bin; | |
22460 | } | |
22461 | ||
22462 | function binaryStringToByteArray(str) { | |
22463 | var arrayLen = str.length / 8; | |
22464 | var array = new Uint8Array(arrayLen); | |
22465 | for (var i=0; i<arrayLen; i++) { | |
22466 | var valueStr = str.substring(0,8); | |
22467 | var value = parseInt(valueStr, 2); | |
22468 | array[i] = value; | |
22469 | str = str.slice(8); | |
22470 | } | |
22471 | return array; | |
22472 | } | |
22473 | ||
22474 | // Pad a numeric string on the left with zero digits until the given width | |
22475 | // is reached. | |
22476 | // Note this differs to the python implementation because it does not | |
22477 | // handle numbers starting with a sign. | |
22478 | function zfill(source, length) { | |
22479 | source = source.toString(); | |
22480 | while (source.length < length) { | |
22481 | source = '0' + source; | |
22482 | } | |
22483 | return source; | |
22484 | } | |
22485 | ||
22486 | init(); | |
22487 | ||
22488 | } | |
22489 | ||
22490 | WORDLISTS = { | |
22491 | "english": [ | |
22492 | "abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse", | |
22493 | "access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act", | |
22494 | "action","actor","actress","actual","adapt","add","addict","address","adjust","admit", | |
22495 | "adult","advance","advice","aerobic","affair","afford","afraid","again","age","agent", | |
22496 | "agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert", | |
22497 | "alien","all","alley","allow","almost","alone","alpha","already","also","alter", | |
22498 | "always","amateur","amazing","among","amount","amused","analyst","anchor","ancient","anger", | |
22499 | "angle","angry","animal","ankle","announce","annual","another","answer","antenna","antique", | |
22500 | "anxiety","any","apart","apology","appear","apple","approve","april","arch","arctic", | |
22501 | "area","arena","argue","arm","armed","armor","army","around","arrange","arrest", | |
22502 | "arrive","arrow","art","artefact","artist","artwork","ask","aspect","assault","asset", | |
22503 | "assist","assume","asthma","athlete","atom","attack","attend","attitude","attract","auction", | |
22504 | "audit","august","aunt","author","auto","autumn","average","avocado","avoid","awake", | |
22505 | "aware","away","awesome","awful","awkward","axis","baby","bachelor","bacon","badge", | |
22506 | "bag","balance","balcony","ball","bamboo","banana","banner","bar","barely","bargain", | |
22507 | "barrel","base","basic","basket","battle","beach","bean","beauty","because","become", | |
22508 | "beef","before","begin","behave","behind","believe","below","belt","bench","benefit", | |
22509 | "best","betray","better","between","beyond","bicycle","bid","bike","bind","biology", | |
22510 | "bird","birth","bitter","black","blade","blame","blanket","blast","bleak","bless", | |
22511 | "blind","blood","blossom","blouse","blue","blur","blush","board","boat","body", | |
22512 | "boil","bomb","bone","bonus","book","boost","border","boring","borrow","boss", | |
22513 | "bottom","bounce","box","boy","bracket","brain","brand","brass","brave","bread", | |
22514 | "breeze","brick","bridge","brief","bright","bring","brisk","broccoli","broken","bronze", | |
22515 | "broom","brother","brown","brush","bubble","buddy","budget","buffalo","build","bulb", | |
22516 | "bulk","bullet","bundle","bunker","burden","burger","burst","bus","business","busy", | |
22517 | "butter","buyer","buzz","cabbage","cabin","cable","cactus","cage","cake","call", | |
22518 | "calm","camera","camp","can","canal","cancel","candy","cannon","canoe","canvas", | |
22519 | "canyon","capable","capital","captain","car","carbon","card","cargo","carpet","carry", | |
22520 | "cart","case","cash","casino","castle","casual","cat","catalog","catch","category", | |
22521 | "cattle","caught","cause","caution","cave","ceiling","celery","cement","census","century", | |
22522 | "cereal","certain","chair","chalk","champion","change","chaos","chapter","charge","chase", | |
22523 | "chat","cheap","check","cheese","chef","cherry","chest","chicken","chief","child", | |
22524 | "chimney","choice","choose","chronic","chuckle","chunk","churn","cigar","cinnamon","circle", | |
22525 | "citizen","city","civil","claim","clap","clarify","claw","clay","clean","clerk", | |
22526 | "clever","click","client","cliff","climb","clinic","clip","clock","clog","close", | |
22527 | "cloth","cloud","clown","club","clump","cluster","clutch","coach","coast","coconut", | |
22528 | "code","coffee","coil","coin","collect","color","column","combine","come","comfort", | |
22529 | "comic","common","company","concert","conduct","confirm","congress","connect","consider","control", | |
22530 | "convince","cook","cool","copper","copy","coral","core","corn","correct","cost", | |
22531 | "cotton","couch","country","couple","course","cousin","cover","coyote","crack","cradle", | |
22532 | "craft","cram","crane","crash","crater","crawl","crazy","cream","credit","creek", | |
22533 | "crew","cricket","crime","crisp","critic","crop","cross","crouch","crowd","crucial", | |
22534 | "cruel","cruise","crumble","crunch","crush","cry","crystal","cube","culture","cup", | |
22535 | "cupboard","curious","current","curtain","curve","cushion","custom","cute","cycle","dad", | |
22536 | "damage","damp","dance","danger","daring","dash","daughter","dawn","day","deal", | |
22537 | "debate","debris","decade","december","decide","decline","decorate","decrease","deer","defense", | |
22538 | "define","defy","degree","delay","deliver","demand","demise","denial","dentist","deny", | |
22539 | "depart","depend","deposit","depth","deputy","derive","describe","desert","design","desk", | |
22540 | "despair","destroy","detail","detect","develop","device","devote","diagram","dial","diamond", | |
22541 | "diary","dice","diesel","diet","differ","digital","dignity","dilemma","dinner","dinosaur", | |
22542 | "direct","dirt","disagree","discover","disease","dish","dismiss","disorder","display","distance", | |
22543 | "divert","divide","divorce","dizzy","doctor","document","dog","doll","dolphin","domain", | |
22544 | "donate","donkey","donor","door","dose","double","dove","draft","dragon","drama", | |
22545 | "drastic","draw","dream","dress","drift","drill","drink","drip","drive","drop", | |
22546 | "drum","dry","duck","dumb","dune","during","dust","dutch","duty","dwarf", | |
22547 | "dynamic","eager","eagle","early","earn","earth","easily","east","easy","echo", | |
22548 | "ecology","economy","edge","edit","educate","effort","egg","eight","either","elbow", | |
22549 | "elder","electric","elegant","element","elephant","elevator","elite","else","embark","embody", | |
22550 | "embrace","emerge","emotion","employ","empower","empty","enable","enact","end","endless", | |
22551 | "endorse","enemy","energy","enforce","engage","engine","enhance","enjoy","enlist","enough", | |
22552 | "enrich","enroll","ensure","enter","entire","entry","envelope","episode","equal","equip", | |
22553 | "era","erase","erode","erosion","error","erupt","escape","essay","essence","estate", | |
22554 | "eternal","ethics","evidence","evil","evoke","evolve","exact","example","excess","exchange", | |
22555 | "excite","exclude","excuse","execute","exercise","exhaust","exhibit","exile","exist","exit", | |
22556 | "exotic","expand","expect","expire","explain","expose","express","extend","extra","eye", | |
22557 | "eyebrow","fabric","face","faculty","fade","faint","faith","fall","false","fame", | |
22558 | "family","famous","fan","fancy","fantasy","farm","fashion","fat","fatal","father", | |
22559 | "fatigue","fault","favorite","feature","february","federal","fee","feed","feel","female", | |
22560 | "fence","festival","fetch","fever","few","fiber","fiction","field","figure","file", | |
22561 | "film","filter","final","find","fine","finger","finish","fire","firm","first", | |
22562 | "fiscal","fish","fit","fitness","fix","flag","flame","flash","flat","flavor", | |
22563 | "flee","flight","flip","float","flock","floor","flower","fluid","flush","fly", | |
22564 | "foam","focus","fog","foil","fold","follow","food","foot","force","forest", | |
22565 | "forget","fork","fortune","forum","forward","fossil","foster","found","fox","fragile", | |
22566 | "frame","frequent","fresh","friend","fringe","frog","front","frost","frown","frozen", | |
22567 | "fruit","fuel","fun","funny","furnace","fury","future","gadget","gain","galaxy", | |
22568 | "gallery","game","gap","garage","garbage","garden","garlic","garment","gas","gasp", | |
22569 | "gate","gather","gauge","gaze","general","genius","genre","gentle","genuine","gesture", | |
22570 | "ghost","giant","gift","giggle","ginger","giraffe","girl","give","glad","glance", | |
22571 | "glare","glass","glide","glimpse","globe","gloom","glory","glove","glow","glue", | |
22572 | "goat","goddess","gold","good","goose","gorilla","gospel","gossip","govern","gown", | |
22573 | "grab","grace","grain","grant","grape","grass","gravity","great","green","grid", | |
22574 | "grief","grit","grocery","group","grow","grunt","guard","guess","guide","guilt", | |
22575 | "guitar","gun","gym","habit","hair","half","hammer","hamster","hand","happy", | |
22576 | "harbor","hard","harsh","harvest","hat","have","hawk","hazard","head","health", | |
22577 | "heart","heavy","hedgehog","height","hello","helmet","help","hen","hero","hidden", | |
22578 | "high","hill","hint","hip","hire","history","hobby","hockey","hold","hole", | |
22579 | "holiday","hollow","home","honey","hood","hope","horn","horror","horse","hospital", | |
22580 | "host","hotel","hour","hover","hub","huge","human","humble","humor","hundred", | |
22581 | "hungry","hunt","hurdle","hurry","hurt","husband","hybrid","ice","icon","idea", | |
22582 | "identify","idle","ignore","ill","illegal","illness","image","imitate","immense","immune", | |
22583 | "impact","impose","improve","impulse","inch","include","income","increase","index","indicate", | |
22584 | "indoor","industry","infant","inflict","inform","inhale","inherit","initial","inject","injury", | |
22585 | "inmate","inner","innocent","input","inquiry","insane","insect","inside","inspire","install", | |
22586 | "intact","interest","into","invest","invite","involve","iron","island","isolate","issue", | |
22587 | "item","ivory","jacket","jaguar","jar","jazz","jealous","jeans","jelly","jewel", | |
22588 | "job","join","joke","journey","joy","judge","juice","jump","jungle","junior", | |
22589 | "junk","just","kangaroo","keen","keep","ketchup","key","kick","kid","kidney", | |
22590 | "kind","kingdom","kiss","kit","kitchen","kite","kitten","kiwi","knee","knife", | |
22591 | "knock","know","lab","label","labor","ladder","lady","lake","lamp","language", | |
22592 | "laptop","large","later","latin","laugh","laundry","lava","law","lawn","lawsuit", | |
22593 | "layer","lazy","leader","leaf","learn","leave","lecture","left","leg","legal", | |
22594 | "legend","leisure","lemon","lend","length","lens","leopard","lesson","letter","level", | |
22595 | "liar","liberty","library","license","life","lift","light","like","limb","limit", | |
22596 | "link","lion","liquid","list","little","live","lizard","load","loan","lobster", | |
22597 | "local","lock","logic","lonely","long","loop","lottery","loud","lounge","love", | |
22598 | "loyal","lucky","luggage","lumber","lunar","lunch","luxury","lyrics","machine","mad", | |
22599 | "magic","magnet","maid","mail","main","major","make","mammal","man","manage", | |
22600 | "mandate","mango","mansion","manual","maple","marble","march","margin","marine","market", | |
22601 | "marriage","mask","mass","master","match","material","math","matrix","matter","maximum", | |
22602 | "maze","meadow","mean","measure","meat","mechanic","medal","media","melody","melt", | |
22603 | "member","memory","mention","menu","mercy","merge","merit","merry","mesh","message", | |
22604 | "metal","method","middle","midnight","milk","million","mimic","mind","minimum","minor", | |
22605 | "minute","miracle","mirror","misery","miss","mistake","mix","mixed","mixture","mobile", | |
22606 | "model","modify","mom","moment","monitor","monkey","monster","month","moon","moral", | |
22607 | "more","morning","mosquito","mother","motion","motor","mountain","mouse","move","movie", | |
22608 | "much","muffin","mule","multiply","muscle","museum","mushroom","music","must","mutual", | |
22609 | "myself","mystery","myth","naive","name","napkin","narrow","nasty","nation","nature", | |
22610 | "near","neck","need","negative","neglect","neither","nephew","nerve","nest","net", | |
22611 | "network","neutral","never","news","next","nice","night","noble","noise","nominee", | |
22612 | "noodle","normal","north","nose","notable","note","nothing","notice","novel","now", | |
22613 | "nuclear","number","nurse","nut","oak","obey","object","oblige","obscure","observe", | |
22614 | "obtain","obvious","occur","ocean","october","odor","off","offer","office","often", | |
22615 | "oil","okay","old","olive","olympic","omit","once","one","onion","online", | |
22616 | "only","open","opera","opinion","oppose","option","orange","orbit","orchard","order", | |
22617 | "ordinary","organ","orient","original","orphan","ostrich","other","outdoor","outer","output", | |
22618 | "outside","oval","oven","over","own","owner","oxygen","oyster","ozone","pact", | |
22619 | "paddle","page","pair","palace","palm","panda","panel","panic","panther","paper", | |
22620 | "parade","parent","park","parrot","party","pass","patch","path","patient","patrol", | |
22621 | "pattern","pause","pave","payment","peace","peanut","pear","peasant","pelican","pen", | |
22622 | "penalty","pencil","people","pepper","perfect","permit","person","pet","phone","photo", | |
22623 | "phrase","physical","piano","picnic","picture","piece","pig","pigeon","pill","pilot", | |
22624 | "pink","pioneer","pipe","pistol","pitch","pizza","place","planet","plastic","plate", | |
22625 | "play","please","pledge","pluck","plug","plunge","poem","poet","point","polar", | |
22626 | "pole","police","pond","pony","pool","popular","portion","position","possible","post", | |
22627 | "potato","pottery","poverty","powder","power","practice","praise","predict","prefer","prepare", | |
22628 | "present","pretty","prevent","price","pride","primary","print","priority","prison","private", | |
22629 | "prize","problem","process","produce","profit","program","project","promote","proof","property", | |
22630 | "prosper","protect","proud","provide","public","pudding","pull","pulp","pulse","pumpkin", | |
22631 | "punch","pupil","puppy","purchase","purity","purpose","purse","push","put","puzzle", | |
22632 | "pyramid","quality","quantum","quarter","question","quick","quit","quiz","quote","rabbit", | |
22633 | "raccoon","race","rack","radar","radio","rail","rain","raise","rally","ramp", | |
22634 | "ranch","random","range","rapid","rare","rate","rather","raven","raw","razor", | |
22635 | "ready","real","reason","rebel","rebuild","recall","receive","recipe","record","recycle", | |
22636 | "reduce","reflect","reform","refuse","region","regret","regular","reject","relax","release", | |
22637 | "relief","rely","remain","remember","remind","remove","render","renew","rent","reopen", | |
22638 | "repair","repeat","replace","report","require","rescue","resemble","resist","resource","response", | |
22639 | "result","retire","retreat","return","reunion","reveal","review","reward","rhythm","rib", | |
22640 | "ribbon","rice","rich","ride","ridge","rifle","right","rigid","ring","riot", | |
22641 | "ripple","risk","ritual","rival","river","road","roast","robot","robust","rocket", | |
22642 | "romance","roof","rookie","room","rose","rotate","rough","round","route","royal", | |
22643 | "rubber","rude","rug","rule","run","runway","rural","sad","saddle","sadness", | |
22644 | "safe","sail","salad","salmon","salon","salt","salute","same","sample","sand", | |
22645 | "satisfy","satoshi","sauce","sausage","save","say","scale","scan","scare","scatter", | |
22646 | "scene","scheme","school","science","scissors","scorpion","scout","scrap","screen","script", | |
22647 | "scrub","sea","search","season","seat","second","secret","section","security","seed", | |
22648 | "seek","segment","select","sell","seminar","senior","sense","sentence","series","service", | |
22649 | "session","settle","setup","seven","shadow","shaft","shallow","share","shed","shell", | |
22650 | "sheriff","shield","shift","shine","ship","shiver","shock","shoe","shoot","shop", | |
22651 | "short","shoulder","shove","shrimp","shrug","shuffle","shy","sibling","sick","side", | |
22652 | "siege","sight","sign","silent","silk","silly","silver","similar","simple","since", | |
22653 | "sing","siren","sister","situate","six","size","skate","sketch","ski","skill", | |
22654 | "skin","skirt","skull","slab","slam","sleep","slender","slice","slide","slight", | |
22655 | "slim","slogan","slot","slow","slush","small","smart","smile","smoke","smooth", | |
22656 | "snack","snake","snap","sniff","snow","soap","soccer","social","sock","soda", | |
22657 | "soft","solar","soldier","solid","solution","solve","someone","song","soon","sorry", | |
22658 | "sort","soul","sound","soup","source","south","space","spare","spatial","spawn", | |
22659 | "speak","special","speed","spell","spend","sphere","spice","spider","spike","spin", | |
22660 | "spirit","split","spoil","sponsor","spoon","sport","spot","spray","spread","spring", | |
22661 | "spy","square","squeeze","squirrel","stable","stadium","staff","stage","stairs","stamp", | |
22662 | "stand","start","state","stay","steak","steel","stem","step","stereo","stick", | |
22663 | "still","sting","stock","stomach","stone","stool","story","stove","strategy","street", | |
22664 | "strike","strong","struggle","student","stuff","stumble","style","subject","submit","subway", | |
22665 | "success","such","sudden","suffer","sugar","suggest","suit","summer","sun","sunny", | |
22666 | "sunset","super","supply","supreme","sure","surface","surge","surprise","surround","survey", | |
22667 | "suspect","sustain","swallow","swamp","swap","swarm","swear","sweet","swift","swim", | |
22668 | "swing","switch","sword","symbol","symptom","syrup","system","table","tackle","tag", | |
22669 | "tail","talent","talk","tank","tape","target","task","taste","tattoo","taxi", | |
22670 | "teach","team","tell","ten","tenant","tennis","tent","term","test","text", | |
22671 | "thank","that","theme","then","theory","there","they","thing","this","thought", | |
22672 | "three","thrive","throw","thumb","thunder","ticket","tide","tiger","tilt","timber", | |
22673 | "time","tiny","tip","tired","tissue","title","toast","tobacco","today","toddler", | |
22674 | "toe","together","toilet","token","tomato","tomorrow","tone","tongue","tonight","tool", | |
22675 | "tooth","top","topic","topple","torch","tornado","tortoise","toss","total","tourist", | |
22676 | "toward","tower","town","toy","track","trade","traffic","tragic","train","transfer", | |
22677 | "trap","trash","travel","tray","treat","tree","trend","trial","tribe","trick", | |
22678 | "trigger","trim","trip","trophy","trouble","truck","true","truly","trumpet","trust", | |
22679 | "truth","try","tube","tuition","tumble","tuna","tunnel","turkey","turn","turtle", | |
22680 | "twelve","twenty","twice","twin","twist","two","type","typical","ugly","umbrella", | |
22681 | "unable","unaware","uncle","uncover","under","undo","unfair","unfold","unhappy","uniform", | |
22682 | "unique","unit","universe","unknown","unlock","until","unusual","unveil","update","upgrade", | |
22683 | "uphold","upon","upper","upset","urban","urge","usage","use","used","useful", | |
22684 | "useless","usual","utility","vacant","vacuum","vague","valid","valley","valve","van", | |
22685 | "vanish","vapor","various","vast","vault","vehicle","velvet","vendor","venture","venue", | |
22686 | "verb","verify","version","very","vessel","veteran","viable","vibrant","vicious","victory", | |
22687 | "video","view","village","vintage","violin","virtual","virus","visa","visit","visual", | |
22688 | "vital","vivid","vocal","voice","void","volcano","volume","vote","voyage","wage", | |
22689 | "wagon","wait","walk","wall","walnut","want","warfare","warm","warrior","wash", | |
22690 | "wasp","waste","water","wave","way","wealth","weapon","wear","weasel","weather", | |
22691 | "web","wedding","weekend","weird","welcome","west","wet","whale","what","wheat", | |
22692 | "wheel","when","where","whip","whisper","wide","width","wife","wild","will", | |
22693 | "win","window","wine","wing","wink","winner","winter","wire","wisdom","wise", | |
22694 | "wish","witness","wolf","woman","wonder","wood","wool","word","work","world", | |
22695 | "worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year", | |
22696 | "yellow","you","young","youth","zebra","zero","zone","zoo"] | |
22697 | }; | |
22698 | </script> | |
22699 | ||
22700 | <!--<script src="/js/index.js"></script>--> | |
22701 | <script> | |
22702 | (function() { | |
22703 | ||
22704 | var mnemonic = new Mnemonic("english"); | |
22705 | var bip32RootKey = null; | |
22706 | var bip32ExtendedKey = null; | |
22707 | var network = Bitcoin.networks.bitcoin; | |
22708 | var addressRowTemplate = $("#address-row-template"); | |
22709 | ||
22710 | var phraseChangeTimeoutEvent = null; | |
22711 | ||
22712 | var DOM = {}; | |
22713 | DOM.phrase = $(".phrase"); | |
721b7284 | 22714 | DOM.passphrase = $(".passphrase"); |
ebd8d4e8 IC |
22715 | DOM.generate = $(".generate"); |
22716 | DOM.rootKey = $(".root-key"); | |
22717 | DOM.extendedPrivKey = $(".extended-priv-key"); | |
22718 | DOM.extendedPubKey = $(".extended-pub-key"); | |
22719 | DOM.bip32path = $("#bip32-path"); | |
22720 | DOM.bip44path = $("#bip44-path"); | |
22721 | DOM.bip44purpose = $("#bip44 .purpose"); | |
22722 | DOM.bip44coin = $("#bip44 .coin"); | |
22723 | DOM.bip44account = $("#bip44 .account"); | |
22724 | DOM.bip44change = $("#bip44 .change"); | |
22725 | DOM.strength = $(".strength"); | |
22726 | DOM.addresses = $(".addresses"); | |
22727 | DOM.rowsToAdd = $(".rows-to-add"); | |
22728 | DOM.more = $(".more"); | |
22729 | DOM.feedback = $(".feedback"); | |
22730 | DOM.tab = $(".derivation-type a"); | |
22731 | DOM.indexToggle = $(".index-toggle"); | |
22732 | DOM.addressToggle = $(".address-toggle"); | |
22733 | DOM.privateKeyToggle = $(".private-key-toggle"); | |
22734 | ||
22735 | var derivationPath = DOM.bip44path.val(); | |
22736 | ||
22737 | function init() { | |
22738 | // Events | |
a19a5498 IC |
22739 | DOM.phrase.on("input", delayedPhraseChanged); |
22740 | DOM.passphrase.on("input", delayedPhraseChanged); | |
ebd8d4e8 IC |
22741 | DOM.generate.on("click", generateClicked); |
22742 | DOM.more.on("click", showMore); | |
a19a5498 IC |
22743 | DOM.bip32path.on("input", bip32Changed); |
22744 | DOM.bip44purpose.on("input", bip44Changed); | |
22745 | DOM.bip44coin.on("input", bip44Changed); | |
22746 | DOM.bip44account.on("input", bip44Changed); | |
22747 | DOM.bip44change.on("input", bip44Changed); | |
ebd8d4e8 IC |
22748 | DOM.tab.on("click", tabClicked); |
22749 | DOM.indexToggle.on("click", toggleIndexes); | |
22750 | DOM.addressToggle.on("click", toggleAddresses); | |
22751 | DOM.privateKeyToggle.on("click", togglePrivateKeys); | |
22752 | disableForms(); | |
22753 | hidePending(); | |
22754 | hideValidationError(); | |
22755 | } | |
22756 | ||
22757 | // Event handlers | |
22758 | ||
22759 | function delayedPhraseChanged() { | |
22760 | hideValidationError(); | |
22761 | showPending(); | |
22762 | if (phraseChangeTimeoutEvent != null) { | |
22763 | clearTimeout(phraseChangeTimeoutEvent); | |
22764 | } | |
22765 | phraseChangeTimeoutEvent = setTimeout(phraseChanged, 400); | |
22766 | } | |
22767 | ||
22768 | function phraseChanged() { | |
22769 | showPending(); | |
22770 | hideValidationError(); | |
22771 | // Get the mnemonic phrase | |
22772 | var phrase = DOM.phrase.val(); | |
721b7284 | 22773 | var passphrase = DOM.passphrase.val(); |
ebd8d4e8 IC |
22774 | var errorText = findPhraseErrors(phrase); |
22775 | if (errorText) { | |
22776 | showValidationError(errorText); | |
22777 | return; | |
22778 | } | |
22779 | // Get the derivation path | |
22780 | var errorText = findDerivationPathErrors(); | |
22781 | if (errorText) { | |
22782 | showValidationError(errorText); | |
22783 | return; | |
22784 | } | |
22785 | // Calculate and display | |
721b7284 | 22786 | calcBip32Seed(phrase, passphrase, derivationPath); |
ebd8d4e8 IC |
22787 | displayBip32Info(); |
22788 | hidePending(); | |
22789 | } | |
22790 | ||
22791 | function generateClicked() { | |
22792 | clearDisplay(); | |
22793 | showPending(); | |
22794 | setTimeout(function() { | |
22795 | var phrase = generateRandomPhrase(); | |
22796 | if (!phrase) { | |
22797 | return; | |
22798 | } | |
22799 | phraseChanged(); | |
22800 | }, 50); | |
22801 | } | |
22802 | ||
22803 | function tabClicked(e) { | |
22804 | var activePath = $(e.target.getAttribute("href") + " .path"); | |
22805 | derivationPath = activePath.val(); | |
22806 | derivationChanged(); | |
22807 | } | |
22808 | ||
22809 | function derivationChanged() { | |
59780293 | 22810 | delayedPhraseChanged(); |
ebd8d4e8 IC |
22811 | } |
22812 | ||
22813 | function bip32Changed() { | |
22814 | derivationPath = DOM.bip32path.val(); | |
22815 | derivationChanged(); | |
22816 | } | |
22817 | ||
22818 | function bip44Changed() { | |
22819 | setBip44DerivationPath(); | |
22820 | derivationPath = DOM.bip44path.val(); | |
22821 | derivationChanged(); | |
22822 | } | |
22823 | ||
22824 | function toggleIndexes() { | |
22825 | $("td.index span").toggleClass("invisible"); | |
22826 | } | |
22827 | ||
22828 | function toggleAddresses() { | |
22829 | $("td.address span").toggleClass("invisible"); | |
22830 | } | |
22831 | ||
22832 | function togglePrivateKeys() { | |
22833 | $("td.privkey span").toggleClass("invisible"); | |
22834 | } | |
22835 | ||
22836 | // Private methods | |
22837 | ||
22838 | function generateRandomPhrase() { | |
22839 | if (!hasStrongRandom()) { | |
22840 | var errorText = "This browser does not support strong randomness"; | |
22841 | showValidationError(errorText); | |
22842 | return; | |
22843 | } | |
22844 | var numWords = parseInt(DOM.strength.val()); | |
22845 | // Check strength is an integer | |
22846 | if (isNaN(numWords)) { | |
22847 | DOM.strength.val("12"); | |
22848 | numWords = 12; | |
22849 | } | |
22850 | // Check strength is a multiple of 32, if not round it down | |
22851 | if (numWords % 3 != 0) { | |
22852 | numWords = Math.floor(numWords / 3) * 3; | |
22853 | DOM.strength.val(numWords); | |
22854 | } | |
22855 | // Check strength is at least 32 | |
22856 | if (numWords == 0) { | |
22857 | numWords = 3; | |
22858 | DOM.strength.val(numWords); | |
22859 | } | |
22860 | var strength = numWords / 3 * 32; | |
22861 | var words = mnemonic.generate(strength); | |
22862 | DOM.phrase.val(words); | |
22863 | return words; | |
22864 | } | |
22865 | ||
721b7284 IC |
22866 | function calcBip32Seed(phrase, passphrase, path) { |
22867 | var seed = mnemonic.toSeed(phrase, passphrase); | |
bade1504 | 22868 | bip32RootKey = Bitcoin.HDNode.fromSeedHex(seed, network); |
ebd8d4e8 IC |
22869 | bip32ExtendedKey = bip32RootKey; |
22870 | // Derive the key from the path | |
22871 | var pathBits = path.split("/"); | |
22872 | for (var i=0; i<pathBits.length; i++) { | |
22873 | var bit = pathBits[i]; | |
22874 | var index = parseInt(bit); | |
22875 | if (isNaN(index)) { | |
22876 | continue; | |
22877 | } | |
22878 | var hardened = bit[bit.length-1] == "'"; | |
22879 | if (hardened) { | |
22880 | bip32ExtendedKey = bip32ExtendedKey.deriveHardened(index); | |
22881 | } | |
22882 | else { | |
22883 | bip32ExtendedKey = bip32ExtendedKey.derive(index); | |
22884 | } | |
22885 | } | |
22886 | } | |
22887 | ||
22888 | function showValidationError(errorText) { | |
22889 | DOM.feedback | |
22890 | .text(errorText) | |
22891 | .show(); | |
22892 | } | |
22893 | ||
22894 | function hideValidationError() { | |
22895 | DOM.feedback | |
22896 | .text("") | |
22897 | .hide(); | |
22898 | } | |
22899 | ||
22900 | function findPhraseErrors(phrase) { | |
22901 | // TODO make this right | |
22902 | // Preprocess the words | |
22903 | var parts = phrase.split(" "); | |
22904 | var proper = []; | |
22905 | for (var i=0; i<parts.length; i++) { | |
22906 | var part = parts[i]; | |
22907 | if (part.length > 0) { | |
22908 | // TODO check that lowercasing is always valid to do | |
22909 | proper.push(part.toLowerCase()); | |
22910 | } | |
22911 | } | |
22912 | // TODO some levenstein on the words | |
22913 | var properPhrase = proper.join(' '); | |
22914 | // Check the words are valid | |
22915 | var isValid = mnemonic.check(properPhrase); | |
22916 | if (!isValid) { | |
22917 | return "Invalid mnemonic"; | |
22918 | } | |
22919 | return false; | |
22920 | } | |
22921 | ||
22922 | function findDerivationPathErrors(path) { | |
22923 | // TODO | |
22924 | return false; | |
22925 | } | |
22926 | ||
22927 | function displayBip32Info() { | |
22928 | // Display the key | |
22929 | var rootKey = bip32RootKey.toBase58(); | |
22930 | DOM.rootKey.val(rootKey); | |
22931 | var extendedPrivKey = bip32ExtendedKey.toBase58(); | |
22932 | DOM.extendedPrivKey.val(extendedPrivKey); | |
22933 | var extendedPubKey = bip32ExtendedKey.toBase58(false); | |
22934 | DOM.extendedPubKey.val(extendedPubKey); | |
22935 | // Display the addresses and privkeys | |
22936 | clearAddressesList(); | |
22937 | displayAddresses(0, 20); | |
22938 | } | |
22939 | ||
22940 | function displayAddresses(start, total) { | |
22941 | for (var i=0; i<total; i++) { | |
22942 | var index = i+ start; | |
22943 | var key = bip32ExtendedKey.derive(index); | |
22944 | var address = key.getAddress().toString(); | |
22945 | var privkey = key.privKey.toWIF(); | |
22946 | addAddressToList(index, address, privkey); | |
22947 | } | |
22948 | } | |
22949 | ||
22950 | function showMore() { | |
22951 | var start = DOM.addresses.children().length; | |
22952 | var rowsToAdd = parseInt(DOM.rowsToAdd.val()); | |
22953 | if (isNaN(rowsToAdd)) { | |
22954 | rowsToAdd = 20; | |
22955 | DOM.rowsToAdd.val("20"); | |
22956 | } | |
22957 | if (rowsToAdd > 200) { | |
22958 | var msg = "Generating " + rowsToAdd + " rows could take a while. "; | |
22959 | msg += "Do you want to continue?"; | |
22960 | if (!confirm(msg)) { | |
22961 | return; | |
22962 | } | |
22963 | } | |
22964 | showPending(); | |
22965 | setTimeout(function() { | |
22966 | displayAddresses(start, rowsToAdd); | |
22967 | hidePending(); | |
22968 | }, 50); | |
22969 | } | |
22970 | ||
22971 | function clearDisplay() { | |
22972 | clearAddressesList(); | |
22973 | clearKey(); | |
22974 | hideValidationError(); | |
22975 | } | |
22976 | ||
22977 | function clearAddressesList() { | |
22978 | DOM.addresses.empty(); | |
22979 | } | |
22980 | ||
22981 | function clearKey() { | |
22982 | DOM.rootKey.val(""); | |
22983 | DOM.extendedPrivKey.val(""); | |
22984 | DOM.extendedPubKey.val(""); | |
22985 | } | |
22986 | ||
22987 | function addAddressToList(index, address, privkey) { | |
22988 | var row = $(addressRowTemplate.html()); | |
22989 | row.find(".index span").text(index); | |
22990 | row.find(".address span").text(address); | |
22991 | row.find(".privkey span").text(privkey); | |
22992 | DOM.addresses.append(row); | |
22993 | } | |
22994 | ||
22995 | function hasStrongRandom() { | |
22996 | return 'crypto' in window && window['crypto'] !== null; | |
22997 | } | |
22998 | ||
22999 | function disableForms() { | |
23000 | $("form").on("submit", function(e) { | |
23001 | e.preventDefault(); | |
23002 | }); | |
23003 | } | |
23004 | ||
23005 | function setBip44DerivationPath() { | |
23006 | var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44); | |
23007 | var coin = parseIntNoNaN(DOM.bip44coin.val(), 0); | |
23008 | var account = parseIntNoNaN(DOM.bip44account.val(), 0); | |
23009 | var change = parseIntNoNaN(DOM.bip44change.val(), 0); | |
23010 | var path = "m/"; | |
23011 | path += purpose + "'/"; | |
23012 | path += coin + "'/"; | |
23013 | path += account + "'/"; | |
23014 | path += change; | |
23015 | DOM.bip44path.val(path); | |
23016 | } | |
23017 | ||
23018 | function parseIntNoNaN(val, defaultVal) { | |
23019 | var v = parseInt(val); | |
23020 | if (isNaN(v)) { | |
23021 | return defaultVal; | |
23022 | } | |
23023 | return v; | |
23024 | } | |
23025 | ||
23026 | function showPending() { | |
23027 | DOM.feedback | |
23028 | .text("Calculating...") | |
23029 | .show(); | |
23030 | } | |
23031 | ||
23032 | function hidePending() { | |
23033 | DOM.feedback | |
23034 | .text("") | |
23035 | .hide(); | |
23036 | } | |
23037 | ||
23038 | init(); | |
23039 | ||
23040 | })(); | |
23041 | </script> | |
23042 | </body> | |
23043 | </html> |