Showing preview only (4,088K chars total). Download the full file or copy to clipboard to get everything.
Repository: fex-team/webuploader
Branch: master
Commit: ac93940c4c98
Files: 276
Total size: 3.9 MB
Directory structure:
gitextract_4gxwg5qi/
├── .gitignore
├── .jshintrc
├── .travis.yml
├── Gruntfile.js
├── LICENSE
├── README.md
├── _draft/
│ ├── demo.html
│ ├── demo.js
│ ├── demo2.html
│ ├── demo2.js
│ ├── flash_cpp/
│ │ ├── Test.swc
│ │ ├── as3api.cpp
│ │ ├── exports.txt
│ │ ├── hashlib/
│ │ │ ├── .hashlibpp.h.swp
│ │ │ ├── .svn/
│ │ │ │ ├── all-wcprops
│ │ │ │ ├── entries
│ │ │ │ └── text-base/
│ │ │ │ ├── Makefile.svn-base
│ │ │ │ ├── hashlibpp.h.svn-base
│ │ │ │ ├── hl_exception.h.svn-base
│ │ │ │ ├── hl_hashwrapper.h.svn-base
│ │ │ │ ├── hl_md5.cpp.svn-base
│ │ │ │ ├── hl_md5.h.svn-base
│ │ │ │ ├── hl_md5wrapper.cpp.svn-base
│ │ │ │ ├── hl_md5wrapper.h.svn-base
│ │ │ │ ├── hl_sha1.cpp.svn-base
│ │ │ │ ├── hl_sha1.h.svn-base
│ │ │ │ ├── hl_sha1wrapper.cpp.svn-base
│ │ │ │ ├── hl_sha1wrapper.h.svn-base
│ │ │ │ ├── hl_sha256.cpp.svn-base
│ │ │ │ ├── hl_sha256.h.svn-base
│ │ │ │ ├── hl_sha256wrapper.cpp.svn-base
│ │ │ │ ├── hl_sha256wrapper.h.svn-base
│ │ │ │ ├── hl_sha2ext.cpp.svn-base
│ │ │ │ ├── hl_sha2ext.h.svn-base
│ │ │ │ ├── hl_sha2mac.h.svn-base
│ │ │ │ ├── hl_sha384wrapper.cpp.svn-base
│ │ │ │ ├── hl_sha384wrapper.h.svn-base
│ │ │ │ ├── hl_sha512wrapper.cpp.svn-base
│ │ │ │ ├── hl_sha512wrapper.h.svn-base
│ │ │ │ ├── hl_types.h.svn-base
│ │ │ │ ├── hl_wrapperfactory.cpp.svn-base
│ │ │ │ └── hl_wrapperfactory.h.svn-base
│ │ │ ├── Makefile
│ │ │ ├── hashlibpp.h
│ │ │ ├── hl_exception.h
│ │ │ ├── hl_hashwrapper.h
│ │ │ ├── hl_md5.cpp
│ │ │ ├── hl_md5.h
│ │ │ ├── hl_md5wrapper.cpp
│ │ │ ├── hl_md5wrapper.h
│ │ │ ├── hl_sha1.cpp
│ │ │ ├── hl_sha1.h
│ │ │ ├── hl_sha1wrapper.cpp
│ │ │ ├── hl_sha1wrapper.h
│ │ │ ├── hl_sha256.cpp
│ │ │ ├── hl_sha256.h
│ │ │ ├── hl_sha256wrapper.cpp
│ │ │ ├── hl_sha256wrapper.h
│ │ │ ├── hl_sha2ext.cpp
│ │ │ ├── hl_sha2ext.h
│ │ │ ├── hl_sha2mac.h
│ │ │ ├── hl_sha384wrapper.cpp
│ │ │ ├── hl_sha384wrapper.h
│ │ │ ├── hl_sha512wrapper.cpp
│ │ │ ├── hl_sha512wrapper.h
│ │ │ ├── hl_types.h
│ │ │ ├── hl_wrapperfactory.cpp
│ │ │ └── hl_wrapperfactory.h
│ │ ├── main.cpp
│ │ └── makefile
│ ├── hashFile.js
│ ├── md5.js
│ ├── md5File.js
│ └── music/
│ ├── index.html
│ ├── jquery.js
│ ├── md5.js
│ ├── server/
│ │ └── fileupload.php
│ ├── style.css
│ ├── upload.js
│ └── webuploader.js
├── bower.json
├── build/
│ ├── docTpl/
│ │ ├── class.ejs
│ │ ├── content.ejs
│ │ ├── css/
│ │ │ └── doc.css
│ │ ├── events.ejs
│ │ ├── items.ejs
│ │ ├── layout.ejs
│ │ ├── module.ejs
│ │ ├── options.ejs
│ │ ├── plugins.ejs
│ │ └── sidebar.ejs
│ ├── fis/
│ │ ├── intro.js
│ │ └── outro.js
│ ├── intro.js
│ ├── outro.js
│ └── tasks/
│ ├── build.js
│ ├── concat.js
│ └── doc.js
├── css/
│ └── webuploader.css
├── dist/
│ ├── README.md
│ ├── Uploader.swf
│ ├── webuploader.css
│ ├── webuploader.custom.js
│ ├── webuploader.fis.js
│ ├── webuploader.flashonly.js
│ ├── webuploader.html5nodepend.js
│ ├── webuploader.html5only.js
│ ├── webuploader.js
│ ├── webuploader.noimage.js
│ ├── webuploader.nolog.js
│ └── webuploader.withoutimage.js
├── examples/
│ ├── cropper/
│ │ ├── cropper.css
│ │ ├── cropper.js
│ │ ├── index.html
│ │ ├── jquery.js
│ │ ├── style.css
│ │ └── uploader.js
│ ├── image-upload/
│ │ ├── expressInstall.swf
│ │ ├── icons.psd
│ │ ├── index.html
│ │ ├── jquery.js
│ │ ├── progress.psd
│ │ ├── style.css
│ │ └── upload.js
│ ├── md5-demo/
│ │ ├── index.html
│ │ └── script.js
│ └── requirejs/
│ ├── app.js
│ ├── index.html
│ └── require.js
├── flash/
│ ├── .actionScriptProperties
│ ├── .project
│ ├── .settings/
│ │ └── org.eclipse.core.resources.prefs
│ ├── Uploader.iml
│ ├── lib/
│ │ ├── Test.swc
│ │ ├── as3corelib.swc
│ │ ├── lib.swc
│ │ └── stringecho.swc
│ ├── lib.fla
│ └── src/
│ ├── ComponentFactory.as
│ ├── Uploader.as
│ └── com/
│ ├── Blob.as
│ ├── File.as
│ ├── FilePicker.as
│ ├── FileReader.as
│ ├── FileReaderSync.as
│ ├── Image.as
│ ├── Md5.as
│ ├── XMLHttpRequest.as
│ ├── errors/
│ │ ├── DOMError.as
│ │ ├── ImageError.as
│ │ └── RuntimeError.as
│ ├── events/
│ │ ├── FilePickerEvent.as
│ │ ├── ImageEvent.as
│ │ ├── ODataEvent.as
│ │ ├── OErrorEvent.as
│ │ ├── OProgressEvent.as
│ │ └── URLStreamProgressEvent.as
│ ├── image/
│ │ ├── BMP.as
│ │ ├── ExifParser.as
│ │ ├── GIF.as
│ │ ├── ImageEditor.as
│ │ ├── JPEG.as
│ │ ├── JPEGEncoder.as
│ │ ├── PNG.as
│ │ ├── ascb/
│ │ │ └── filters/
│ │ │ ├── ColorMatrixArrays.as
│ │ │ └── ConvolutionMatrixArrays.as
│ │ ├── events/
│ │ │ └── ExifParserEvent.as
│ │ └── formatlos/
│ │ ├── BitmapDataUnlimited.as
│ │ ├── Gif.as
│ │ └── events/
│ │ └── BitmapDataUnlimitedEvent.as
│ └── utils/
│ ├── BMPDecoder.as
│ ├── Base64.as
│ ├── BinaryReader.as
│ ├── Buffer.as
│ ├── OEventDispatcher.as
│ ├── URLStreamProgress.as
│ ├── Utils.as
│ └── Zhenpin.as
├── jekyll/
│ ├── _config.yml
│ ├── _includes/
│ │ ├── comments.html
│ │ ├── footer.html
│ │ └── header.html
│ ├── _layouts/
│ │ ├── default.html
│ │ └── post.html
│ ├── _plugins/
│ │ └── fancytoc.rb
│ ├── css/
│ │ ├── bootstrap-theme.css
│ │ ├── bootstrap.css
│ │ ├── demo.css
│ │ ├── font-awesome.css
│ │ ├── style.css
│ │ ├── syntax.css
│ │ └── webuploader.css
│ ├── demo.md
│ ├── doc/
│ │ ├── css/
│ │ │ └── doc.css
│ │ └── index.html
│ ├── document.md
│ ├── download.md
│ ├── fonts/
│ │ └── FontAwesome.otf
│ ├── getting-started.md
│ ├── images/
│ │ └── logo.psd
│ ├── index.md
│ └── js/
│ ├── Uploader.swf
│ ├── bootstrap.js
│ ├── demo.js
│ ├── getting-started.js
│ ├── global.js
│ └── webuploader.js
├── package.json
├── server/
│ ├── crossdomain.xml
│ ├── fileupload.php
│ ├── fileupload2.php
│ └── preview.php
├── src/
│ ├── base.js
│ ├── dollar-builtin.js
│ ├── dollar-third.js
│ ├── dollar.js
│ ├── file.js
│ ├── lib/
│ │ ├── blob.js
│ │ ├── dnd.js
│ │ ├── file.js
│ │ ├── filepaste.js
│ │ ├── filepicker.js
│ │ ├── image.js
│ │ ├── md5.js
│ │ └── transport.js
│ ├── mediator.js
│ ├── preset/
│ │ ├── all.js
│ │ ├── flashonly.js
│ │ ├── html5only.js
│ │ └── withoutimage.js
│ ├── promise-builtin.js
│ ├── promise-third.js
│ ├── promise.js
│ ├── queue.js
│ ├── runtime/
│ │ ├── client.js
│ │ ├── compbase.js
│ │ ├── flash/
│ │ │ ├── blob.js
│ │ │ ├── filepicker.js
│ │ │ ├── image.js
│ │ │ ├── md5.js
│ │ │ ├── runtime.js
│ │ │ └── transport.js
│ │ ├── html5/
│ │ │ ├── androidpatch.js
│ │ │ ├── blob.js
│ │ │ ├── dnd.js
│ │ │ ├── filepaste.js
│ │ │ ├── filepicker.js
│ │ │ ├── image.js
│ │ │ ├── imagemeta/
│ │ │ │ └── exif.js
│ │ │ ├── imagemeta.js
│ │ │ ├── jpegencoder.js
│ │ │ ├── md5.js
│ │ │ ├── runtime.js
│ │ │ ├── transport.js
│ │ │ └── util.js
│ │ └── runtime.js
│ ├── uploader.js
│ ├── webuploader.js
│ └── widgets/
│ ├── filednd.js
│ ├── filepaste.js
│ ├── filepicker.js
│ ├── image.js
│ ├── log.js
│ ├── md5.js
│ ├── queue.js
│ ├── runtime.js
│ ├── upload.js
│ ├── validator.js
│ └── widget.js
└── test/
├── Qunit/
│ ├── qunit-1.14.0.css
│ └── qunit-1.14.0.js
├── index.html
├── require.js
├── testDesign/
│ └── webuploader.xmind
└── units/
├── base.js
└── filepicker.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.DS_Store
.idea
/pages
/node_modules
/doc
server/*
!server/preview.php
!server/fileupload.php
!server/fileupload2.php
!server/crossdomain.xml
.tags
.tags_sorted_by_file
/flash/bin-debug
/flash/html-template
/.grunt
/jekyll/_site/
/dist/*.zip
================================================
FILE: .jshintrc
================================================
{
"maxerr" : 50,
"bitwise" : false,
"camelcase" : true,
"curly" : true,
"eqeqeq" : true,
"forin" : false,
"immed" : false,
"indent" : 4,
"latedef" : false,
"newcap" : false,
"noarg" : false,
"noempty" : true,
"nonew" : false,
"plusplus" : false,
"quotmark" : "single",
"undef" : true,
"unused" : true,
"strict" : false,
"trailing" : false,
"maxparams" : false,
"maxdepth" : false,
"maxstatements" : false,
"maxcomplexity" : false,
"maxlen" : 80,
"asi" : false,
"boss" : false,
"debug" : false,
"eqnull" : true,
"es5" : false,
"esnext" : false,
"evil" : false,
"expr" : true,
"funcscope" : false,
"globalstrict" : false,
"iterator" : false,
"lastsemic" : false,
"laxbreak" : false,
"laxcomma" : false,
"loopfunc" : false,
"multistr" : false,
"proto" : false,
"scripturl" : false,
"smarttabs" : false,
"shadow" : false,
"sub" : false,
"supernew" : false,
"validthis" : false,
"browser" : true,
"couch" : false,
"devel" : true,
"dojo" : false,
"jquery" : false,
"mootools" : false,
"node" : false,
"nonstandard" : false,
"prototypejs" : false,
"rhino" : false,
"worker" : false,
"wsh" : false,
"yui" : false,
"nomen" : false,
"onevar" : true,
"passfail" : false,
"white" : true,
"predef" : [ "require", "define", "module", "URL", "XDomainRequest", "ActiveXObject" ],
"withstmt" : false,
"zepto" : true,
"assignvarfirst" : true,
"varnewline": true,
"strictchain": true,
"strictindent": true,
"operatorend": true,
"strictlinebreak": false,
"assignthisto" : false,
"assignexceptionto" : false,
"strictcomment" : true,
"fileoverview" : true,
"novoid" : true
}
================================================
FILE: .travis.yml
================================================
language: node_js
node_js:
- 0.10
before_script:
- npm install -g grunt-cli
script:
- grunt test
================================================
FILE: Gruntfile.js
================================================
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
build: {
options: {
banner: '/*! WebUploader <%= pkg.version %> */\n'
},
all: {
name: 'webuploader',
dest: "dist/webuploader.js",
// 在没有jquery类似的库的前提下可以设置builtin,去除强行依赖。
builtin: {
dollar: false,
promise: false
}
},
nolog: {
preset: 'all',
dest: "dist/webuploader.nolog.js",
// 在没有jquery类似的库的前提下可以设置builtin,去除强行依赖。
builtin: {
dollar: false,
promise: false
}
},
flashonly: {
preset: 'flashonly',
dest: "dist/webuploader.flashonly.js",
},
html5only: {
preset: 'html5only',
dest: "dist/webuploader.html5only.js",
},
html5nodepend: {
preset: 'html5only',
dest: "dist/webuploader.html5nodepend.js",
builtin: {
dollar: true,
promise: true
},
},
withoutimage: {
preset: 'withoutimage',
dest: "dist/webuploader.noimage.js",
},
// 自己配置的实例
// glob语法。
// 移动端方案,请搭配 zepto 使用。
custom: {
preset: "custom",
cwd: "src",
builtin: {
promise: true
},
src: [
'widgets/filepicker.js',
'widgets/image.js',
'widgets/queue.js',
'widgets/runtime.js',
'widgets/upload.js',
'widgets/log.js',
'runtime/html5/blob.js',
'runtime/html5/filepicker.js',
'runtime/html5/imagemeta/exif.js',
'runtime/html5/image.js',
'runtime/html5/androidpatch.js',
'runtime/html5/transport.js'
],
dest: "dist/webuploader.custom.js"
},
fis: {
name: 'webuploader',
dest: "dist/webuploader.fis.js",
fis: true,
// 在没有jquery类似的库的前提下可以设置builtin,去除强行依赖。
builtin: {
dollar: false,
promise: false
}
}
},
uglify: {
options: {
mangle: true,
banner: '/* WebUploader <%= pkg.version %> */'
},
static_mapping: {
files: [
{
src: 'dist/webuploader.js',
dest: 'dist/webuploader.min.js'
},
{
src: 'dist/webuploader.nolog.js',
dest: 'dist/webuploader.nolog.min.js'
},
{
src: 'dist/webuploader.flashonly.js',
dest: 'dist/webuploader.flashonly.min.js'
},
{
src: 'dist/webuploader.html5only.js',
dest: 'dist/webuploader.html5only.min.js'
},
{
src: 'dist/webuploader.html5nodepend.js',
dest: 'dist/webuploader.html5nodepend.min.js'
},
{
src: 'dist/webuploader.noimage.js',
dest: 'dist/webuploader.noimage.min.js'
},
{
src: 'dist/webuploader.custom.js',
dest: 'dist/webuploader.custom.min.js'
}
]
}
},
copy: {
jekyll: {
src: 'dist/webuploader.js',
dest: 'jekyll/js/webuploader.js',
},
css: {
src: 'css/webuploader.css',
dest: 'dist/webuploader.css'
},
css2: {
src: 'css/webuploader.css',
dest: 'jekyll/css/webuploader.css'
}
},
watch: {
options: {
debounceDelay: 250
},
all: {
files: ['src/**/*.js', 'Gruntfile.js'],
tasks: ['default'],
},
dist: {
files: ['src/**/*.js', 'Gruntfile.js'],
tasks: ['dist'],
},
doc: {
files: ['src/**/*.js', 'Gruntfile.js', 'build/docTpl/**/*'],
tasks: ['doc'],
},
dev: {
files: 'src/**/*.js',
tasks: 'build:all'
},
flashonly: {
files: 'src/**/*.js',
tasks: 'build:flashonly'
}
},
jsbint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'src/**/*.js',
'!src/runtime/html5/jpegencoder.js'
]
},
size: {
dist: {
cwd: 'dist/',
src: '*.js'
},
src: {
src: 'src/**/*.js'
}
},
doc: {
options: {
cwd: './src/',
files: [
'uploader.js',
'base.js',
'mediator.js',
'**/*.js'
],
tplDir: './build/docTpl',
theme: 'gmu',
outputDir: './jekyll/doc',
title: 'WebUploader API文档'
}
},
jekyll: {
options: { // Universal options
src: 'jekyll'
},
dist: { // Target
options: { // Target options
dest: 'pages',
config: 'jekyll/_config.yml'
}
}
},
'gh-pages': {
options: {
message: '程序自动提交,源码请查看tree/master/jekyll目录',
base: 'pages',
repo: 'https://github.com/fex-team/webuploader.git'
},
src: ['**/*']
},
qunit: {
all: {
options: {
urls: [
'http://0.0.0.0:8000/test/index.html'
]
}
}
},
connect: {
server: {
options: {
port: 8000,
base: '.'
}
}
/*,
keepalive: {
options: {
port: 8000,
base: '.',
keepalive: true
}
}*/
},
});
require('load-grunt-tasks')(grunt);
grunt.loadTasks('build/tasks'); // 加载build目录下的所有task
// Default task(s).
grunt.registerTask('default', ['jsbint:all', 'dist']);
grunt.registerTask('dist', ['build', 'uglify', 'copy']);
grunt.registerTask('deploy', ['doc', 'jekyll', 'gh-pages']);
grunt.registerTask('test', ['connect', 'qunit']);
};
================================================
FILE: LICENSE
================================================
Copyright (c) 2014, FEX@Baidu Inc.
All rights reserved.
Redistribution and use of this software in source and binary forms, with or
without modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
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.
Neither the name of Baidu Inc. nor the names of its contributors may be used
to endorse or promote products derived from this software without specific
prior written permission of Baidu Inc.
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 OWNER 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.
================================================
FILE: README.md
================================================
不再对使用问题进行答复,如果有希望的功能改进或者bugfix可以提交PR
==================================================
# WebUploader 文件上传 [](http://travis-ci.org/fex-team/webuploader) [](http://gruntjs.com/)
WebUploader是一个简单的以HTML5为主,FLASH为辅的现代文件上传组件。在现代的浏览器里面能充分发挥HTML5的优势,同时又不摒弃主流IE浏览器,延用原来的FLASH运行时,兼容IE6+,Andorid 4+,IOS 6+。两套运行时,同样的调用方式,可供用户任意选用。
支持大文件分片并发上传,极大的提高了文件上传效率。
- 官网: http://fex.baidu.com/webuploader/
- ISSUES:https://github.com/fex-team/webuploader/issues
## 支持
**代码肯定存在很多不足和需要优化的地方,欢迎大家提交 [pr](https://help.github.com/articles/using-pull-requests)。**感谢**以下代码贡献者, 排名不分先后。**
[@zensh](https://github.com/zensh),[@ushelp](https://github.com/ushelp),[@duanlixin](https://github.com/duanlixin)。
## 特性
### 分片、并发
分片与并发结合,将一个大文件分割成多块,并发上传,极大地提高大文件的上传速度。
当网络问题导致传输错误时,只需要重传出错分片,而不是整个文件。另外分片传输能够更加实时的跟踪上传进度。
### 预览、压缩
支持常用图片格式jpg,jpeg,gif,bmp,png预览与压缩,节省网络数据传输。
解析jpeg中的meta信息,对于各种orientation做了正确的处理,同时压缩后上传保留图片的所有原始meta数据。
### 多途径添加文件
支持文件多选,类型过滤,拖拽(文件&文件夹),图片粘贴功能。
粘贴功能主要体现在当有图片数据在剪切板中时(截屏工具如QQ(Ctrl + ALT + A), 网页中右击图片点击复制),Ctrl + V便可添加此图片文件。
### HTML5 & FLASH
兼容主流浏览器,接口一致,实现了两套运行时支持,用户无需关心内部用了什么内核。
同时Flash部分没有做任何UI相关的工作,方便不关心flash的用户扩展和自定义业务需求。
### MD5秒传
当文件体积大、量比较多时,支持上传前做文件md5值验证,一致则可直接跳过。
如果服务端与前端统一修改算法,取段md5,可大大提升验证性能,耗时在20ms左右。
### 易扩展、可拆分
采用可拆分机制, 将各个功能独立成了小组件,可自由搭配。
采用AMD规范组织代码,清晰明了,方便高级玩家扩展。
================================================
FILE: _draft/demo.html
================================================
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>WebUploader演示 - 秒传</title>
<link rel="stylesheet" type="text/css" href="../css/webuploader.css" />
<link rel="stylesheet" type="text/css" href="./style.css" />
</head>
<body>
<div id="wrapper">
<div id="container">
<!--头部,相册选择和格式选择-->
<div id="uploader">
<div class="queueList">
<div id="dndArea" class="placeholder">
<div id="filePicker">点击选择文件</div>
<p>或将照片拖到这里,单次最多可选300张</p>
</div>
</div>
<div class="statusBar" style="display:none;">
<div class="progress">
<span class="text">0%</span>
<span class="percentage"></span>
</div><div class="info"></div>
<div class="btns">
<div id="filePicker2">继续添加</div><div class="uploadBtn">开始上传</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="./jquery.js"></script>
<script type="text/javascript" src="../dist/webuploader.js"></script>
<script type="text/javascript" src="./demo.js"></script>
</body>
</html>
================================================
FILE: _draft/demo.js
================================================
(function( $ ){
// 当domReady的时候开始初始化
$(function() {
var $wrap = $('#uploader'),
// 图片容器
$queue = $( '<ul class="filelist"></ul>' )
.appendTo( $wrap.find( '.queueList' ) ),
// 状态栏,包括进度和控制按钮
$statusBar = $wrap.find( '.statusBar' ),
// 文件总体选择信息。
$info = $statusBar.find( '.info' ),
// 上传按钮
$upload = $wrap.find( '.uploadBtn' ),
// 没选择文件之前的内容。
$placeHolder = $wrap.find( '.placeholder' ),
$progress = $statusBar.find( '.progress' ).hide(),
// 添加的文件数量
fileCount = 0,
// 添加的文件总大小
fileSize = 0,
// 优化retina, 在retina下这个值是2
ratio = window.devicePixelRatio || 1,
// 缩略图大小
thumbnailWidth = 110 * ratio,
thumbnailHeight = 110 * ratio,
// 可能有pedding, ready, uploading, confirm, done.
state = 'pedding',
// 所有文件的进度信息,key为file id
percentages = {},
// WebUploader实例
uploader;
// 实例化
uploader = WebUploader.create({
pick: '#filePicker',
dnd: '#dndArea',
paste: '#uploader',
server: '../server/fileupload.php',
accept: '',
fileNumLimit: 300,
fileSizeLimit: 0,
fileSingleSizeLimit: 512 * 1024 * 1024 // 512 M
});
// 添加“添加文件”的按钮,
uploader.addButton('#filePicker2');
// 当有文件添加进来时执行,负责view的创建
function addFile( file ) {
var $li = $( '<li id="' + file.id + '">' +
'<p class="title">' + file.name + '</p>' +
'<p class="imgWrap"></p>'+
'<p class="progress"><span></span></p>' +
'</li>' ),
$btns = $('<div class="file-panel">' +
'<span class="cancel">删除</span>' +
'<span class="rotateRight">向右旋转</span>' +
'<span class="rotateLeft">向左旋转</span></div>').appendTo( $li ),
$prgress = $li.find('p.progress span'),
$wrap = $li.find( 'p.imgWrap' ),
$info = $('<p class="error"></p>'),
showError = function( code ) {
switch( code ) {
case 'exceed_size':
text = '文件大小超出';
break;
default:
text = '上传失败,请重试';
break;
}
$info.text( text ).appendTo( $li );
};
if ( file.getStatus() === 'invalid' ) {
showError( file.statusText );
} else {
// @todo lazyload
$wrap.text( '预览中' );
uploader.makeThumb( file, function( error, src ) {
if ( error ) {
$wrap.text( '不能预览' );
return;
}
var img = $('<img src="'+src+'">');
$wrap.empty().append( img );
}, thumbnailWidth, thumbnailHeight );
percentages[ file.id ] = [ file.size, 0 ];
file.ratation = 0;
}
file.on('statuschange', function( cur, prev ) {
if ( prev === 'progress' ) {
$prgress.hide().width(0);
} else if ( prev === 'queued' ) {
$li.off( 'mouseenter mouseleave' );
$btns.remove();
}
// 成功
if ( cur === 'error' || cur === 'invalid' ) {
showError( file.statusText );
percentages[ file.id ][ 1 ] = 1;
} else if ( cur === 'queued' ) {
percentages[ file.id ][ 1 ] = 0;
} else if ( cur === 'progress' ) {
$info.remove();
$prgress.css('display', 'block');
}
$li.removeClass( 'state-' + prev ).addClass( 'state-' + cur );
});
$li.on( 'mouseenter', function() {
$btns.stop().animate({height: 30});
});
$li.on( 'mouseleave', function() {
$btns.stop().animate({height: 0});
});
$btns.on( 'click', 'span', function() {
var index = $(this).index(),
deg;
switch ( index ) {
case 0:
uploader.removeFile( file );
return;
case 1:
file.ratation += 90;
break;
case 2:
file.ratation -= 90;
break;
}
// -webkit-transform: rotate(90deg);
index && (deg = 'rotate(' + file.ratation + 'deg)', $wrap.css({
'-webkit-transform': deg,
'-mos-transform': deg,
'-o-transform': deg,
'transform': deg
}));
});
$li.appendTo( $queue );
}
// 负责view的销毁
function removeFile( file ) {
var $li = $('#'+file.id);
delete percentages[ file.id ];
updateTotalProgress();
$li.off().find('.file-panel').off().end().remove();
}
function updateTotalProgress() {
var loaded = 0,
total = 0,
spans = $progress.children(),
percent;
$.each( percentages, function( k, v ) {
total += v[ 0 ];
loaded += v[ 0 ] * v[ 1 ];
} );
percent = total ? loaded / total : 0;
spans.eq( 0 ).text( Math.round( percent * 100 ) + '%' );
spans.eq( 1 ).css( 'width', Math.round( percent * 100 ) + '%' );
updateStatus();
}
function updateStatus() {
var text = '', stats;
if ( state === 'ready' ) {
text = '选中' + fileCount + '张图片,共' +
uploader.formatSize( fileSize ) + '。';
} else if ( state === 'confirm' ) {
stats = uploader.getStats();
if ( stats.uploadFailNum ) {
text = '已成功上传' + stats.successNum+ '张照片至XX相册,'+
stats.uploadFailNum + '张照片上传失败,<a class="retry" href="#">重新上传</a>失败图片或<a class="ignore" href="#">忽略</a>'
}
} else {
stats = uploader.getStats();
text = '共' + fileCount + '张(' +
uploader.formatSize( fileSize ) +
'),已上传' + stats.successNum + '张';
if ( stats.uploadFailNum ) {
text += ',失败' + stats.uploadFailNum + '张';
}
}
$info.html( text );
}
function setState( val ) {
var file, stats;
if ( val === state ) {
return;
}
$upload.removeClass( 'state-' + state );
$upload.addClass( 'state-' + val );
state = val;
switch ( state ) {
case 'pedding':
$placeHolder.show();
$queue.hide();
$statusBar.hide();
break;
case 'ready':
$placeHolder.hide();
$( '#filePicker2' ).show();
$queue.show();
$statusBar.show();
break;
case 'uploading':
$( '#filePicker2' ).hide();
$progress.show();
$upload.text( '暂停上传' );
break;
case 'paused':
$progress.show();
$upload.text( '继续上传' );
break;
case 'confirm':
$progress.hide();
$upload.text( '开始上传' ).addClass( 'disabled' );
stats = uploader.getStats();
if ( stats.successNum && !stats.uploadFailNum ) {
setState( 'finish' );
return;
}
break;
case 'finish':
stats = uploader.getStats();
if ( stats.successNum ) {
alert( '上传成功' );
} else {
// 没有成功的图片,重设
state = 'done';
location.reload();
}
break;
}
updateStatus();
}
uploader.onUploadBeforeSend = function( file, data ) {
data.md5 = file.md5 || '';
};
uploader.onUploadProgress = function( file, percentage ) {
var $li = $('#'+file.id),
$percent = $li.find('.progress span');
$percent.css( 'width', percentage * 100 + '%' );
percentages[ file.id ][ 1 ] = percentage;
updateTotalProgress();
};
uploader.onFileQueued = function( file ) {
var start = Date.now();
fileCount++;
fileSize += file.size;
if ( fileCount === 1 ) {
$placeHolder.hide();
$statusBar.show();
}
Md5File( file, function( value ) {
var $li = $('#'+file.id);
file.md5 = value;
$li.append( '<p class="log">md5:' + ((Date.now() - start)/1000).toFixed(2) + '秒</p>')
});
addFile( file );
setState( 'ready' );
updateTotalProgress();
};
uploader.onFileDequeued = function( file ) {
fileCount--;
fileSize -= file.size;
if ( !fileCount ) {
setState( 'pedding' );
}
removeFile( file );
updateTotalProgress();
};
uploader.on( 'all', function( type ) {
var stats;
switch( type ) {
case 'uploadFinished':
setState( 'confirm' );
break;
case 'startUpload':
setState( 'uploading' );
break;
case 'stopUpload':
setState( 'paused' );
break;
}
});
uploader.onError = function( code ) {
alert( 'Eroor: ' + code );
};
uploader.onUploadChunkcontinue = function( file, ret ) {
if ( ret.exist ) {
var $li = $( '#'+file.id );
$li.append( '<p class="log">跳过' + uploader.formatSize( file.size - file.loaded ) + '</p>' );
return false;
}
};
$upload.on('click', function() {
if ( $(this).hasClass( 'disabled' ) ) {
return false;
}
if ( state === 'ready' ) {
uploader.upload();
} else if ( state === 'paused' ) {
uploader.upload();
} else if ( state === 'uploading' ) {
uploader.stop();
}
});
$info.on( 'click', '.retry', function() {
uploader.retry();
} );
$info.on( 'click', '.ignore', function() {
alert( 'todo' );
} );
$upload.addClass( 'state-' + state );
updateTotalProgress();
var Md5File = (function(){
return function( file, cb ) {
var worker = new Worker( 'md5File.js' );
worker.onmessage = function( e ) {
cb( e.data, file );
worker.terminate();
};
worker.postMessage( file.source );
}
})();
});
})( jQuery );
================================================
FILE: _draft/demo2.html
================================================
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>WebUploader演示 - 秒传</title>
<link rel="stylesheet" type="text/css" href="../css/webuploader.css" />
<link rel="stylesheet" type="text/css" href="./style.css" />
</head>
<body>
<div id="wrapper">
<div id="container">
<!--头部,相册选择和格式选择-->
<div id="uploader">
<div class="queueList">
<div id="dndArea" class="placeholder">
<div id="filePicker">点击选择文件</div>
<p>或将照片拖到这里,单次最多可选300张</p>
</div>
</div>
<div class="statusBar" style="display:none;">
<div class="progress">
<span class="text">0%</span>
<span class="percentage"></span>
</div><div class="info"></div>
<div class="btns">
<div id="filePicker2">继续添加</div><div class="uploadBtn">开始上传</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="./jquery.js"></script>
<script type="text/javascript" src="../dist/webuploader.js"></script>
<script type="text/javascript" src="./demo2.js"></script>
</body>
</html>
================================================
FILE: _draft/demo2.js
================================================
(function( $ ){
// 当domReady的时候开始初始化
$(function() {
var $wrap = $('#uploader'),
// 图片容器
$queue = $( '<ul class="filelist"></ul>' )
.appendTo( $wrap.find( '.queueList' ) ),
// 状态栏,包括进度和控制按钮
$statusBar = $wrap.find( '.statusBar' ),
// 文件总体选择信息。
$info = $statusBar.find( '.info' ),
// 上传按钮
$upload = $wrap.find( '.uploadBtn' ),
// 没选择文件之前的内容。
$placeHolder = $wrap.find( '.placeholder' ),
$progress = $statusBar.find( '.progress' ).hide(),
// 添加的文件数量
fileCount = 0,
// 添加的文件总大小
fileSize = 0,
// 优化retina, 在retina下这个值是2
ratio = window.devicePixelRatio || 1,
// 缩略图大小
thumbnailWidth = 110 * ratio,
thumbnailHeight = 110 * ratio,
// 可能有pedding, ready, uploading, confirm, done.
state = 'pedding',
// 所有文件的进度信息,key为file id
percentages = {},
// WebUploader实例
uploader;
// 实例化
uploader = WebUploader.create({
pick: '#filePicker',
dnd: '#dndArea',
paste: '#uploader',
server: '../server/fileupload2.php',
accept: '',
fileNumLimit: 300,
fileSizeLimit: 0,
fileSingleSizeLimit: 512 * 1024 * 1024 // 512 M
});
// 添加“添加文件”的按钮,
uploader.addButton('#filePicker2');
// 当有文件添加进来时执行,负责view的创建
function addFile( file ) {
var $li = $( '<li id="' + file.id + '">' +
'<p class="title">' + file.name + '</p>' +
'<p class="imgWrap"></p>'+
'<p class="progress"><span></span></p>' +
'</li>' ),
$btns = $('<div class="file-panel">' +
'<span class="cancel">删除</span>' +
'<span class="rotateRight">向右旋转</span>' +
'<span class="rotateLeft">向左旋转</span></div>').appendTo( $li ),
$prgress = $li.find('p.progress span'),
$wrap = $li.find( 'p.imgWrap' ),
$info = $('<p class="error"></p>'),
showError = function( code ) {
switch( code ) {
case 'exceed_size':
text = '文件大小超出';
break;
default:
text = '上传失败,请重试';
break;
}
$info.text( text ).appendTo( $li );
};
if ( file.getStatus() === 'invalid' ) {
showError( file.statusText );
} else {
// @todo lazyload
$wrap.text( '预览中' );
uploader.makeThumb( file, function( error, src ) {
if ( error ) {
$wrap.text( '不能预览' );
return;
}
var img = $('<img src="'+src+'">');
$wrap.empty().append( img );
}, thumbnailWidth, thumbnailHeight );
percentages[ file.id ] = [ file.size, 0 ];
file.ratation = 0;
}
file.on('statuschange', function( cur, prev ) {
if ( prev === 'progress' ) {
$prgress.hide().width(0);
} else if ( prev === 'queued' ) {
$li.off( 'mouseenter mouseleave' );
$btns.remove();
}
// 成功
if ( cur === 'error' || cur === 'invalid' ) {
showError( file.statusText );
percentages[ file.id ][ 1 ] = 1;
} else if ( cur === 'queued' ) {
percentages[ file.id ][ 1 ] = 0;
} else if ( cur === 'progress' ) {
$info.remove();
$prgress.css('display', 'block');
}
$li.removeClass( 'state-' + prev ).addClass( 'state-' + cur );
});
$li.on( 'mouseenter', function() {
$btns.stop().animate({height: 30});
});
$li.on( 'mouseleave', function() {
$btns.stop().animate({height: 0});
});
$btns.on( 'click', 'span', function() {
var index = $(this).index(),
deg;
switch ( index ) {
case 0:
uploader.removeFile( file );
return;
case 1:
file.ratation += 90;
break;
case 2:
file.ratation -= 90;
break;
}
// -webkit-transform: rotate(90deg);
index && (deg = 'rotate(' + file.ratation + 'deg)', $wrap.css({
'-webkit-transform': deg,
'-mos-transform': deg,
'-o-transform': deg,
'transform': deg
}));
});
$li.appendTo( $queue );
}
// 负责view的销毁
function removeFile( file ) {
var $li = $('#'+file.id);
delete percentages[ file.id ];
updateTotalProgress();
$li.off().find('.file-panel').off().end().remove();
}
function updateTotalProgress() {
var loaded = 0,
total = 0,
spans = $progress.children(),
percent;
$.each( percentages, function( k, v ) {
total += v[ 0 ];
loaded += v[ 0 ] * v[ 1 ];
} );
percent = total ? loaded / total : 0;
spans.eq( 0 ).text( Math.round( percent * 100 ) + '%' );
spans.eq( 1 ).css( 'width', Math.round( percent * 100 ) + '%' );
updateStatus();
}
function updateStatus() {
var text = '', stats;
if ( state === 'ready' ) {
text = '选中' + fileCount + '张图片,共' +
uploader.formatSize( fileSize ) + '。';
} else if ( state === 'confirm' ) {
stats = uploader.getStats();
if ( stats.uploadFailNum ) {
text = '已成功上传' + stats.successNum+ '张照片至XX相册,'+
stats.uploadFailNum + '张照片上传失败,<a class="retry" href="#">重新上传</a>失败图片或<a class="ignore" href="#">忽略</a>'
}
} else {
stats = uploader.getStats();
text = '共' + fileCount + '张(' +
uploader.formatSize( fileSize ) +
'),已上传' + stats.successNum + '张';
if ( stats.uploadFailNum ) {
text += ',失败' + stats.uploadFailNum + '张';
}
}
$info.html( text );
}
function setState( val ) {
var file, stats;
if ( val === state ) {
return;
}
$upload.removeClass( 'state-' + state );
$upload.addClass( 'state-' + val );
state = val;
switch ( state ) {
case 'pedding':
$placeHolder.show();
$queue.hide();
$statusBar.hide();
break;
case 'ready':
$placeHolder.hide();
$( '#filePicker2' ).show();
$queue.show();
$statusBar.show();
break;
case 'uploading':
$( '#filePicker2' ).hide();
$progress.show();
$upload.text( '暂停上传' );
break;
case 'paused':
$progress.show();
$upload.text( '继续上传' );
break;
case 'confirm':
$progress.hide();
$upload.text( '开始上传' ).addClass( 'disabled' );
stats = uploader.getStats();
if ( stats.successNum && !stats.uploadFailNum ) {
setState( 'finish' );
return;
}
break;
case 'finish':
stats = uploader.getStats();
if ( stats.successNum ) {
alert( '上传成功' );
} else {
// 没有成功的图片,重设
state = 'done';
location.reload();
}
break;
}
updateStatus();
}
uploader.onUploadBeforeSend = function( file, data ) {
data.md5 = file.md5 || '';
};
uploader.onUploadProgress = function( file, percentage ) {
var $li = $('#'+file.id),
$percent = $li.find('.progress span');
$percent.css( 'width', percentage * 100 + '%' );
percentages[ file.id ][ 1 ] = percentage;
updateTotalProgress();
};
uploader.onFileQueued = function( file ) {
var start = Date.now();
fileCount++;
fileSize += file.size;
if ( fileCount === 1 ) {
$placeHolder.hide();
$statusBar.show();
}
Md5File( file, function( value ) {
var $li = $('#'+file.id);
file.md5 = value;
console.log( value );
$li.append( '<p class="log">md5:' + ((Date.now() - start)/1000).toFixed(2) + '秒</p>')
});
addFile( file );
setState( 'ready' );
updateTotalProgress();
};
uploader.onFileDequeued = function( file ) {
fileCount--;
fileSize -= file.size;
if ( !fileCount ) {
setState( 'pedding' );
}
removeFile( file );
updateTotalProgress();
};
uploader.on( 'all', function( type ) {
var stats;
switch( type ) {
case 'uploadFinished':
setState( 'confirm' );
break;
case 'startUpload':
setState( 'uploading' );
break;
case 'stopUpload':
setState( 'paused' );
break;
}
});
uploader.onError = function( code ) {
alert( 'Eroor: ' + code );
};
uploader.onUploadChunkcontinue = function( file, ret ) {
if ( ret.exist ) {
var $li = $( '#'+file.id );
$li.append( '<p class="log">跳过' + uploader.formatSize( file.size - file.loaded ) + '</p>' );
return false;
}
};
$upload.on('click', function() {
if ( $(this).hasClass( 'disabled' ) ) {
return false;
}
if ( state === 'ready' ) {
uploader.upload();
} else if ( state === 'paused' ) {
uploader.upload();
} else if ( state === 'uploading' ) {
uploader.stop();
}
});
$info.on( 'click', '.retry', function() {
uploader.retry();
} );
$info.on( 'click', '.ignore', function() {
alert( 'todo' );
} );
$upload.addClass( 'state-' + state );
updateTotalProgress();
var Md5File = (function(){
return function( file, cb ) {
var worker = new Worker( 'hashFile.js' );
worker.onmessage = function( e ) {
cb( e.data, file );
worker.terminate();
};
worker.postMessage( file.source );
}
})();
});
})( jQuery );
================================================
FILE: _draft/flash_cpp/as3api.cpp
================================================
#include <stdlib.h>
#include <string>
#include "AS3/AS3.h"
#include "hashlib/hl_hashwrapper.h"
#include "hashlib/hl_md5wrapper.h"
void md5String() __attribute__((used,
annotate("as3sig:public function md5String(input:String):String"),
annotate("as3package:com.webuploader")));
/**
* MD5 ("") = d41d8cd98f00b204e9800998ecf8427e
* MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661
* MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72
* MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0
* MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b
* MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =
* d174ab98d277d9f5a5611c2c9f419d9f
* MD5 ("123456789012345678901234567890123456789012345678901234567890123456
* 78901234567890") = 57edf4a22be3c955ac49da2e2107b67a
*/
void md5String(){
const char *src = NULL;
AS3_MallocString(src, input);
std::string srcString(src);
const char *result;
hashwrapper *wrapper;
wrapper = new md5wrapper();
std::string md5 = wrapper->getHashFromString(srcString);
result = md5.c_str();
delete wrapper;
// We can't just call AS3_Return(s) because s is not a scalar.
// Instead we need to marshall the C string into AS3 and use
// AS3_ReturnAS3Var().
AS3_DeclareVar(myString, String);
AS3_CopyCStringToVar(myString, result, 32);
AS3_ReturnAS3Var(myString);
}
================================================
FILE: _draft/flash_cpp/exports.txt
================================================
# built in symbols that must always be preserved
_start1
malloc
free
memcpy
memmove
flascc_uiTickProc
_sync_synchronize
# symbols for C++ exception handling
_Unwind_SjLj_Register
_Unwind_SjLj_Resume
_Unwind_SjLj_Unregister
_Unwind_SjLj_RaiseException
# symbols from libm.a
__muldi3
# symbols for the GLUT based examples
_avm2_glut_keyhandler
glutMainLoopBody
================================================
FILE: _draft/flash_cpp/hashlib/.svn/all-wcprops
================================================
K 25
svn:wc:ra_dav:version-url
V 43
/svnroot/hashlib2plus/!svn/ver/77/trunk/src
END
hl_sha384wrapper.cpp
K 25
svn:wc:ra_dav:version-url
V 64
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_sha384wrapper.cpp
END
hl_sha256.h
K 25
svn:wc:ra_dav:version-url
V 55
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_sha256.h
END
hl_wrapperfactory.h
K 25
svn:wc:ra_dav:version-url
V 63
/svnroot/hashlib2plus/!svn/ver/78/trunk/src/hl_wrapperfactory.h
END
hl_sha2ext.cpp
K 25
svn:wc:ra_dav:version-url
V 58
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_sha2ext.cpp
END
hl_sha256wrapper.h
K 25
svn:wc:ra_dav:version-url
V 62
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_sha256wrapper.h
END
hl_sha384wrapper.h
K 25
svn:wc:ra_dav:version-url
V 62
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_sha384wrapper.h
END
hl_sha2mac.h
K 25
svn:wc:ra_dav:version-url
V 56
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_sha2mac.h
END
hl_sha2ext.h
K 25
svn:wc:ra_dav:version-url
V 56
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_sha2ext.h
END
hl_md5.cpp
K 25
svn:wc:ra_dav:version-url
V 54
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_md5.cpp
END
hl_md5wrapper.cpp
K 25
svn:wc:ra_dav:version-url
V 61
/svnroot/hashlib2plus/!svn/ver/71/trunk/src/hl_md5wrapper.cpp
END
hl_hashwrapper.h
K 25
svn:wc:ra_dav:version-url
V 60
/svnroot/hashlib2plus/!svn/ver/78/trunk/src/hl_hashwrapper.h
END
hl_md5.h
K 25
svn:wc:ra_dav:version-url
V 52
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_md5.h
END
hl_md5wrapper.h
K 25
svn:wc:ra_dav:version-url
V 59
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_md5wrapper.h
END
hashlibpp.h
K 25
svn:wc:ra_dav:version-url
V 55
/svnroot/hashlib2plus/!svn/ver/78/trunk/src/hashlibpp.h
END
hl_sha1.cpp
K 25
svn:wc:ra_dav:version-url
V 55
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_sha1.cpp
END
hl_sha1wrapper.cpp
K 25
svn:wc:ra_dav:version-url
V 62
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_sha1wrapper.cpp
END
hl_sha1.h
K 25
svn:wc:ra_dav:version-url
V 53
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_sha1.h
END
hl_sha1wrapper.h
K 25
svn:wc:ra_dav:version-url
V 60
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_sha1wrapper.h
END
hl_exception.h
K 25
svn:wc:ra_dav:version-url
V 58
/svnroot/hashlib2plus/!svn/ver/78/trunk/src/hl_exception.h
END
hl_sha512wrapper.cpp
K 25
svn:wc:ra_dav:version-url
V 64
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_sha512wrapper.cpp
END
hl_sha256.cpp
K 25
svn:wc:ra_dav:version-url
V 57
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_sha256.cpp
END
hl_wrapperfactory.cpp
K 25
svn:wc:ra_dav:version-url
V 65
/svnroot/hashlib2plus/!svn/ver/78/trunk/src/hl_wrapperfactory.cpp
END
hl_sha256wrapper.cpp
K 25
svn:wc:ra_dav:version-url
V 64
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_sha256wrapper.cpp
END
Makefile
K 25
svn:wc:ra_dav:version-url
V 52
/svnroot/hashlib2plus/!svn/ver/78/trunk/src/Makefile
END
hl_sha512wrapper.h
K 25
svn:wc:ra_dav:version-url
V 62
/svnroot/hashlib2plus/!svn/ver/70/trunk/src/hl_sha512wrapper.h
END
hl_types.h
K 25
svn:wc:ra_dav:version-url
V 54
/svnroot/hashlib2plus/!svn/ver/71/trunk/src/hl_types.h
END
================================================
FILE: _draft/flash_cpp/hashlib/.svn/entries
================================================
10
dir
77
https://hashlib2plus.svn.sourceforge.net/svnroot/hashlib2plus/trunk/src
https://hashlib2plus.svn.sourceforge.net/svnroot/hashlib2plus
2010-06-21T16:29:04.476273Z
77
bennygr
9fabf1d2-8a3a-0410-866c-cb411183c2a1
hl_sha384wrapper.cpp
file
2011-10-13T17:29:23.000000Z
17f226c2a3e6270168d48504cd33e4c5
2010-01-24T14:59:38.128638Z
70
bennygr
3872
hl_wrapperfactory.h
file
78
2011-10-13T17:38:25.000000Z
6c168d2d628100549c5f86aea00b5eb2
2011-10-13T17:45:28.472824Z
78
bennygr
3081
hl_sha256.h
file
2011-10-13T15:33:07.000000Z
ac167db3cab5eb2e27a8d41bd76f379e
2010-01-24T14:59:38.128638Z
70
bennygr
6439
hl_sha256wrapper.h
file
2011-10-13T15:33:07.000000Z
cff339a15b7b14a3ef48314245d91c2b
2010-01-24T14:59:38.128638Z
70
bennygr
4306
hl_sha2ext.cpp
file
2011-10-13T17:29:23.000000Z
4cec161a0d4f59437da86e5f1f765bc4
2010-01-24T14:59:38.128638Z
70
bennygr
17404
hl_sha384wrapper.h
file
2011-10-13T15:33:07.000000Z
f005457935d9c2a049baa9fadd021c6d
2010-01-24T14:59:38.128638Z
70
bennygr
4328
hl_sha2ext.h
file
2011-10-13T15:33:07.000000Z
a4e096bb8f97a7e5a0660b869f9610da
2010-01-24T14:59:38.128638Z
70
bennygr
8066
hl_sha2mac.h
file
2011-10-13T15:33:07.000000Z
28d51c6e7a66d1f27061b371e3faaae4
2010-01-24T14:59:38.128638Z
70
bennygr
7978
hl_md5.cpp
file
2011-10-13T17:29:23.000000Z
51cc23699f77568796b7b999fc97bcb7
2010-01-24T14:59:38.128638Z
70
bennygr
13296
hl_md5wrapper.cpp
file
2011-10-13T17:29:23.000000Z
15590646af0fbe840a7a97fccc341481
2010-02-21T19:02:17.752873Z
71
bennygr
4135
hl_hashwrapper.h
file
78
2011-10-13T17:39:24.000000Z
1ea63f2f3d508eda466826372d671d8c
2011-10-13T17:45:28.472824Z
78
bennygr
8770
hl_md5.h
file
2011-10-13T15:33:07.000000Z
28696d2f48d25b659f02c2ce961732ba
2010-01-24T14:59:38.128638Z
70
bennygr
6703
hl_md5wrapper.h
file
2011-10-13T15:33:07.000000Z
1a195c7d60cc839cf3231467a2abbcd2
2010-01-24T14:59:38.128638Z
70
bennygr
4197
hl_sha1.cpp
file
2011-10-13T17:29:23.000000Z
d71e2ae594ad8ac3282d982729ae9c6a
2010-01-24T14:59:38.128638Z
70
bennygr
11049
hashlibpp.h
file
78
2011-10-13T17:01:47.000000Z
286599faa35183c3ebe43a8d6cb9a6e8
2011-10-13T17:45:28.472824Z
78
bennygr
2353
hl_sha1wrapper.cpp
file
2011-10-13T17:29:23.000000Z
edb423e4747fa15007de22433493813d
2010-01-24T14:59:38.128638Z
70
bennygr
4008
hl_sha1.h
file
2011-10-13T15:33:07.000000Z
6b43fa03d52be7252b40d2a394a8ef92
2010-01-24T14:59:38.128638Z
70
bennygr
7520
hl_sha1wrapper.h
file
2011-10-13T15:33:07.000000Z
30060841e872c93ba4060d1ba3747501
2010-01-24T14:59:38.128638Z
70
bennygr
4169
hl_exception.h
file
78
2011-10-13T16:21:12.000000Z
d47e62e2482d07775926927f69b22c71
2011-10-13T17:45:28.472824Z
78
bennygr
3370
hl_sha512wrapper.cpp
file
2011-10-13T17:29:23.000000Z
29019e1424ec4752f4451616dcd6c90b
2010-01-24T14:59:38.128638Z
70
bennygr
3905
hl_sha256.cpp
file
2011-10-13T17:29:23.000000Z
f1cb5fa1517094d1c02f8fa85a424241
2010-01-24T14:59:38.128638Z
70
bennygr
14722
hl_wrapperfactory.cpp
file
78
2011-10-13T17:29:23.000000Z
cb43b8485fa9189e7ca21e52262d25a8
2011-10-13T17:45:28.472824Z
78
bennygr
3251
hl_sha256wrapper.cpp
file
2011-10-13T17:29:23.000000Z
19acf3f7d3c25d24b0633cb4a45bc8a9
2010-01-24T14:59:38.128638Z
70
bennygr
3948
Makefile
file
78
2011-10-13T15:46:46.000000Z
a6f58648331aa4856bfe65b6d5d66b60
2011-10-13T17:45:28.472824Z
78
bennygr
5644
hl_sha512wrapper.h
file
2011-10-13T15:33:07.000000Z
629350ff78bd95a50fdd8eb563126da0
2010-01-24T14:59:38.128638Z
70
bennygr
4327
hl_types.h
file
2011-10-13T15:33:07.000000Z
5d03e90911fa02c00fcbcda47c885794
2010-02-21T19:02:17.752873Z
71
bennygr
2584
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/Makefile.svn-base
================================================
#
# hashlib++ - a simple hash library for C++
#
# Copyright (c) 2007-2010 Benjamin Grdelbach
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1) Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2) 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.
#
# 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 OWNER 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.
#
#-----------------------------------------------------------------------
#
# This is the hashlib++ makefile. It builds and installs hashlib++ as a
# static library. See the documentation for more information.
#
# Type 'make' to build the lib.
# Type 'make install' to build and install the lib.
# Type 'make clean' to clean the object files
#
# Note for FreeBSD users:
# use gmake from "/usr/ports/devel/gmake"
#
# Benjamin Grdelbach
# Mi 10 Okt 2007
#
#-----------------------------------------------------------------------
# Edit the following lines to meet your needs
# Path to install the headerfiles
INCLUDE_PATH = /usr/include/hashlib++
# Path to install the library
LIB_PATH = /usr/local/lib/
# Compiler to use
COMPILER = g++
# Global options for the compiler
COPTIONS = -ansi -Wall -Wextra
#-----------------------------------------------------------------------
# DON'T CHANGE ANYTHING BELOW
#-----------------------------------------------------------------------
ifdef DEBUG
COPTIONS += -g
else
COPTIONS += -O3 -fomit-frame-pointer
endif
GCC = $(COMPILER) $(COPTIONS)
#-----------------------------------------------------------------------
#Main-Target
all: MD5 SHA1 SHA256 SHA2EXT CORE LIB
#-----------------------------------------------------------------------
#all header-files
HEADER = hl_hashwrapper.h \
hl_wrapperfactory.h \
hl_exception.h \
hl_md5.h hl_md5wrapper.h \
hl_sha1.h hl_sha1wrapper.h \
hl_sha2mac.h \
hl_sha256.h hl_sha256wrapper.h \
hl_sha2ext.h hl_sha384wrapper.h hl_sha512wrapper.h \
hl_types.h \
hashlibpp.h
#-----------------------------------------------------------------------
CORE = hl_wrapperfactory.o
CORE: hl_wrapperfactory.o
hl_wrapperfactory.o: hl_wrapperfactory.cpp hl_wrapperfactory.h
$(GCC) -c hl_wrapperfactory.cpp
#-----------------------------------------------------------------------
# MD5 Targets
MD5 = hl_md5.o \
hl_md5wrapper.o
MD5: hl_md5.o hl_md5wrapper.o
hl_md5.o: hl_md5.cpp hl_md5.h
$(GCC) -c hl_md5.cpp
hl_md5wrapper.o: hl_md5wrapper.cpp hl_md5wrapper.h
$(GCC) -c hl_md5wrapper.cpp
#-----------------------------------------------------------------------
# SHA1 Targets
SHA1 = hl_sha1.o \
hl_sha1wrapper.o
SHA1: hl_sha1.o hl_sha1wrapper.o
hl_sha1.o: hl_sha1.cpp hl_sha1.h
$(GCC) -c hl_sha1.cpp
hl_sha1wrapper.o: hl_sha1wrapper.cpp hl_sha1wrapper.h
$(GCC) -c hl_sha1wrapper.cpp
#-----------------------------------------------------------------------
# SHA256 Targets
SHA256 = hl_sha256.o \
hl_sha256wrapper.o
SHA256: hl_sha256.o hl_sha256wrapper.o
hl_sha256.o: hl_sha256.cpp hl_sha256.h hl_sha2mac.h
$(GCC) -c hl_sha256.cpp
hl_sha256wrapper.o: hl_sha256wrapper.cpp hl_sha256wrapper.h
$(GCC) -c hl_sha256wrapper.cpp
#-----------------------------------------------------------------------
# SHA2-ext Targets
SHA2EXT = hl_sha2ext.o \
hl_sha384wrapper.o \
hl_sha512wrapper.o
SHA2EXT: hl_sha2ext.o hl_sha384wrapper.o hl_sha512wrapper.o
hl_sha2ext.o: hl_sha2ext.cpp hl_sha2ext.h hl_sha2mac.h
$(GCC) -c hl_sha2ext.cpp
hl_sha384wrapper.o: hl_sha384wrapper.cpp hl_sha384wrapper.h
$(GCC) -c hl_sha384wrapper.cpp
hl_sha512wrapper.o: hl_sha512wrapper.cpp hl_sha512wrapper.h
$(GCC) -c hl_sha512wrapper.cpp
#-----------------------------------------------------------------------
# Creating a static lib using ar
LIB: MD5 SHA1 SHA256
ar rs libhl++.a $(MD5) $(SHA1) $(SHA256) $(SHA2EXT) $(CORE)
#-----------------------------------------------------------------------
#Installing the lib
install: all
mkdir -p $(INCLUDE_PATH); \
mkdir -p $(LIB_PATH); \
cp libhl++.a $(LIB_PATH) && \
cp $(HEADER) $(INCLUDE_PATH)
-@ echo ""
-@ echo ""
-@ echo "------------------------------"
-@ echo ""
-@ echo "hashlib++ has been installed to:"
-@ echo "include files: $(INCLUDE_PATH)"
-@ echo "library files: $(LIB_PATH)"
-@ echo ""
-@ echo "------------------------------"
#-----------------------------------------------------------------------
# Cleaning object-files
clean:
rm *.o
-@ echo "cleaned up "
-@ echo ""
#-----------------------------------------------------------------------
#EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hashlibpp.h.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/**
* @file hashlibpp.h
* @brief This file is just an include wrapper
* @date Sa 2 Feb
*/
//----------------------------------------------------------------------
#ifndef HASHLIBPP_H
#define HASHLIBPP_H
//----------------------------------------------------------------------
//current version of hashilb++
#define _HASHLIBPP_VERSION_ "0.3.4"
//----------------------------------------------------------------------
#include "hl_exception.h"
#include "hl_wrapperfactory.h"
#include "hl_hashwrapper.h"
#include "hl_md5wrapper.h"
#include "hl_sha1wrapper.h"
#include "hl_sha256wrapper.h"
#include "hl_sha384wrapper.h"
#include "hl_sha512wrapper.h"
//----------------------------------------------------------------------
#endif
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_exception.h.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/**
* @file hl_exception.h
* @brief This file contains the hashlib++ exception class
* @date Sa 24 Nov 2007
*/
//----------------------------------------------------------------------
//include protection
#ifndef HL_EXCEPTION_H
#define HL_EXCEPTION_H
//----------------------------------------------------------------------
//STL
#include <string>
//----------------------------------------------------------------------
/**
* definition of hashlib++ errornumbers
*/
typedef enum hlerrors
{
HL_NO_ERROR = 0,
HL_FILE_READ_ERROR,
HL_VERIFY_TEST_FAILED,
HL_UNKNOWN_SEE_MSG,
HL_UNKNOWN_HASH_TYPE
} hlerror;
//----------------------------------------------------------------------
/**
* @brief This class represents a exception within the hashlib++
* project
*/
class hlException
{
private:
/**
* Error Number
*/
hlerror iError;
/**
* Error message as string
*/
std::string strMessge;
public:
/**
* @brief constructor
* @param er Error number
* @param m Error message
*/
hlException(hlerror er, std::string m)
{
this->iError = er;
this->strMessge = m;
}
/**
* @brief constructor
* @param m Error Message
*/
hlException(std::string m)
{
this->iError = HL_UNKNOWN_SEE_MSG;
this->strMessge = m;
}
/**
* @brief returns the error message
* @return the error message
*/
std::string error_message(void)
{
return strMessge;
}
/**
* @brief returns the error number
* @return the error number
*/
hlerror error_number(void)
{
return iError;
}
};
//----------------------------------------------------------------------
//end of include protection
#endif
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_hashwrapper.h.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2011 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
//doxygen mainpage
/**
* @mainpage hashlib++ source documentation
*
* <div align="center"><b>Version 0.3.4</b></div>
*
*
* @section intro Introduction
* hashlib++ a simple hash library for C++ \n
* Copyright (c) 2007-2011 Benjamin Grüdelbach
*
*
*
* hashlib++ is a simple and very easy to use library to create a
* cryptographic checksum called "hash". hashlib++ is written in
* plain C++ and should work with every compiler and platform.
* hashlib++ is released under the BSD-license and
* therefore free software.
*
* @section about About this document
*
* This is the documentation about the hashlib++ sourcecode.
* Since it contains some internal information it its helpfull
* but not necessary to read for the average user.
* If you are new to hashlib++ you should start with reading
* the README.TXT file which contains all relevant information
* to start using this library.
*
*/
//----------------------------------------------------------------------
/**
* @file hl_hashwrapper.h
* @brief This file contains the hashwrapper base class
* @date Mo 17 Sep 2007
*/
//----------------------------------------------------------------------
//include protection
#ifndef HASHWRAPPER_H
#define HASHWRAPPER_H
//----------------------------------------------------------------------
//STL includes
#include <string>
//----------------------------------------------------------------------
//C includes
//#include <stdio.h>
#include <fstream>
//----------------------------------------------------------------------
//hashlib++ includes
#include "hl_exception.h"
//----------------------------------------------------------------------
/**
* @brief This class represents the baseclass for all subwrappers
*
* hashwrapper is the abstract base class of all subwrappers like md5wrapper
* or sha1wrapper. This class implements two simple and easy to use
* memberfunctions to create a hash based on a string or a file.
* ( getHashFromString() and getHashFromFile() )
*
* getHashFromString() calls resetContext(), updateContext() and hashIt()
* in this order. These three memberfunctions are pure virtual and have to
* be implemented by the subclasses.
*
* getHashFromFile() calls resetContext() before reading the specified file
* in 1024 byte blocks which are forwarded to the hash context by calling
* updateContext(). Finaly hashIt() is called to return the hash.
*/
class hashwrapper
{
private:
const std::string teststring;
protected:
/**
* @brief This method finalizes the hash process
* and returns the hash as std::string
*
* This memberfunction is pure virtual and
* has to be implemented by the subclass
*
* @return the created hash as std::string
*/
virtual std::string hashIt(void) = 0;
/**
* @brief This internal member-function
* convertes the hash-data to a
* std::string (HEX)
*
* This memberfunction is pure virtual and
* has to be implemented by the subclass
*
* @param data The hash-data to covert into HEX
* @return The converted data as std::string
*/
virtual std::string convToString(unsigned char *data) = 0;
/**
* @brief This method adds the given data to the
* current hash context
*
* This memberfunction is pure virtual and
* has to be implemented by the subclass
*
* @param data The data to add to the current context
* @param len The length of the data to add
*/
virtual void updateContext(unsigned char *data, unsigned int len) = 0;
/**
* @brief This method resets the current hash context.
* In other words: It starts a new hash process.
*
* This memberfunction is pure virtual and
* has to be implemented by the subclass
*/
virtual void resetContext(void) = 0;
/**
* @brief This method should return the hash of the
* test-string "The quick brown fox jumps over the lazy
* dog"
*/
virtual std::string getTestHash(void) = 0;
public:
/**
* @brief Default Konstruktor
*/
hashwrapper( void )
: teststring("The quick brown fox jumps over the lazy dog")
{
}
/**
* @brief Default destructor
*/
virtual ~hashwrapper ( void ) { };
/**
* @brief Method for testing the concrete implementation
*/
virtual void test( void )
{
std::string hash = this->getHashFromString(teststring);
std::string verify = this->getTestHash();
if(hash != verify)
{
throw hlException(HL_VERIFY_TEST_FAILED,
"hashlib test-error: \"" +
hash +
"\" is not \"" +
verify +
"\" as supposed to be.");
}
}
/**
* @brief This method creates a hash based on the
* given string
*
* This memberfunctions calls resetContext(),
* updateContext() and hashIt() in this order.
* These three memberfunctions are pure virtual and have to
* be implemented by the subclasses.
*
* @param text The text to create a hash from. This
* parameter is forwarded to updateContext()
* @return the created hash as std::string
*/
virtual std::string getHashFromString(std::string text)
{
/*
* reset the context so that we can start
* with a new hash process
*/
resetContext();
/*
* we update the context with the given text
*/
updateContext((unsigned char*) text.c_str(),text.length());
/*
* now we can close the hash process
* and return the created hash
*/
return this->hashIt();
}
/**
* @brief This method creates a hash from a given file
*
* First of all resetContext() is called before reading the
* specified file in 1024 byte blocks which are forwarded
* to the hash context by calling updateContext().
* Finaly hashIt() is called to return the hash.
* These three memberfunctions are pure virtual and have to
* be implemented by the subclasses.
*
* @param filename The file to created a hash from
*
* @return The created hash of the file or "-1" in case
* the file could not be opened
* @throw Throws a hlException if the specified file could not
* be opened.
*/
virtual std::string getHashFromFile(std::string filename)
{
FILE *file;
int len;
unsigned char buffer[1024];
/*
* reset the current hash context
*/
resetContext();
/*
* open the specified file
*/
if((file = fopen(filename.c_str(), "rb")) == NULL)
{
throw hlException(HL_FILE_READ_ERROR,
"Cannot read file \"" +
filename +
"\".");
}
/*
* read the file in 1024b blocks and
* update the context for every block
*/
while( (len = fread(buffer,1,1024,file)) )
{
updateContext(buffer, len);
}
//close the file and create the hash
fclose(file);
return(hashIt());
}
};
//----------------------------------------------------------------------
//end of include protection
#endif
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_md5.cpp.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/*
* The hashlib++ MD5 implementation is derivative from the sourcecode
* published in RFC 1321
*
* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
* rights reserved.
*
* License to copy and use this software is granted provided that it
* is identified as the "RSA Data Security, Inc. MD5 Message-Digest
* Algorithm" in all material mentioning or referencing this software
* or this function.
*
* License is also granted to make and use derivative works provided
* that such works are identified as "derived from the RSA Data
* Security, Inc. MD5 Message-Digest Algorithm" in all material
* mentioning or referencing the derived work.
*
* RSA Data Security, Inc. makes no representations concerning either
* the merchantability of this software or the suitability of this
* software for any particular purpose. It is provided "as is"
* without express or implied warranty of any kind.
*
* These notices must be retained in any copies of any part of this
* documentation and/or software.
*/
//----------------------------------------------------------------------
/**
* @file hl_md5.cpp
* @brief This file contains the implementation of the MD5 class
* @date Mo 17 Sep 2007
*/
//----------------------------------------------------------------------
//hashlib++ includes
#include "hl_md5.h"
//----------------------------------------------------------------------
// defines
// Constants for MD5Transform routine.
#define S11 7
#define S12 12
#define S13 17
#define S14 22
#define S21 5
#define S22 9
#define S23 14
#define S24 20
#define S31 4
#define S32 11
#define S33 16
#define S34 23
#define S41 6
#define S42 10
#define S43 15
#define S44 21
static unsigned char PADDING[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/* F, G, H and I are basic MD5 functions. */
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
#define I(x, y, z) ((y) ^ ((x) | (~z)))
/*
* ROTATE_LEFT rotates x left n bits.
* cast to unsigned int to guarantee support for 64Bit System
*/
#define ROTATE_LEFT(x, n) (((x) << (n)) | (( (unsigned int) x) >> (32-(n))))
/*
FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
Rotation is separate from addition to prevent recomputation.
*/
#define FF(a, b, c, d, x, s, ac) { \
(a) += F ((b), (c), (d)) + (x) + (unsigned long int)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define GG(a, b, c, d, x, s, ac) { \
(a) += G ((b), (c), (d)) + (x) + (unsigned long int)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define HH(a, b, c, d, x, s, ac) { \
(a) += H ((b), (c), (d)) + (x) + (unsigned long int)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define II(a, b, c, d, x, s, ac) { \
(a) += I ((b), (c), (d)) + (x) + (unsigned long int)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
//----------------------------------------------------------------------
//private member-functions
/**
* @brief Basic transformation. Transforms state based on block.
* @param state state to transform
* @param block block to transform
*/
void MD5::MD5Transform (unsigned long int state[4], unsigned char block[64])
{
unsigned long int a = state[0], b = state[1], c = state[2], d = state[3], x[16];
Decode (x, block, 64);
/* Round 1 */
FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
/* Round 2 */
GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
/* Round 3 */
HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
/* Round 4 */
II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
/*
* Zeroize sensitive information.
*/
MD5_memset ((POINTER)x, 0, sizeof (x));
}
/**
* @brief Encodes input data
* @param output Encoded data as OUT parameter
* @param input Input data
* @param len The length of the input assuming it is a
* multiple of 4
*/
void MD5::Encode (unsigned char *output, unsigned long int *input, unsigned int len)
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (unsigned char)(input[i] & 0xff);
output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
}
}
/**
* @brief Decodes input data into output
* @param output Decoded data as OUT parameter
* @param input Input data
* @param len The length of the input assuming it is a
* multiple of 4
*/
void MD5::Decode (unsigned long int *output, unsigned char *input, unsigned int len)
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((unsigned long int)input[j]) |
(((unsigned long int)input[j+1]) << 8) |
(((unsigned long int)input[j+2]) << 16) |
(((unsigned long int)input[j+3]) << 24);
}
/**
* @brief internal memory management
* @param output OUT parameter where POINTER is a unsigned
* char*
* @param input Data to copy where POINTER is a unsigned char*
* @param len The length of the data
*/
void MD5::MD5_memcpy (POINTER output, POINTER input, unsigned int len)
{
/*
* TODO-Note: Replace "for loop" with standard memcpy if possible.
*/
unsigned int i;
for (i = 0; i < len; i++)
output[i] = input[i];
}
/**
* @brief internal memory management
* @param output OUT parameter where POINTER is an unsigned
* char*
* @param value Value to fill the memory with
* @param len The length of the data
*
*/
void MD5::MD5_memset (POINTER output,int value,unsigned int len)
{
/*
* TODO-Note: Replace "for loop" with standard memset if possible.
*/
unsigned int i;
for (i = 0; i < len; i++)
((char *)output)[i] = (char)value;
}
//----------------------------------------------------------------------
//public member-functions
/**
* @brief Initialization begins an operation,
* writing a new context
* @param context The HL_MD5_CTX context to initialize
*/
void MD5::MD5Init (HL_MD5_CTX *context)
{
context->count[0] = context->count[1] = 0;
context->state[0] = 0x67452301;
context->state[1] = 0xefcdab89;
context->state[2] = 0x98badcfe;
context->state[3] = 0x10325476;
}
/**
* @brief Block update operation. Continues an md5
* message-digest operation, processing another
* message block, and updating the context.
* @param context The HL_MD5_CTX context to update
* @param input The data to write into the context
* @param inputLen The length of the input data
*/
void MD5::MD5Update (HL_MD5_CTX *context, unsigned char *input, unsigned int inputLen)
{
unsigned int i, index, partLen;
/* Compute number of bytes mod 64 */
index = (unsigned int)((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ( (context->count[0] += ((unsigned long int)inputLen << 3))
< ((unsigned long int)inputLen << 3))
context->count[1]++;
context->count[1] += ((unsigned long int)inputLen >> 29);
partLen = 64 - index;
/*
* Transform as many times as possible.
*/
if (inputLen >= partLen)
{
MD5_memcpy ((POINTER)&context->buffer[index], (POINTER)input, partLen);
MD5Transform (context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64)
MD5Transform (context->state, &input[i]);
index = 0;
}
else
i = 0;
/* Buffer remaining input */
MD5_memcpy ((POINTER)&context->buffer[index],
(POINTER)&input[i],
inputLen-i);
}
/**
* @brief Finalization ends the md5 message-digest
* operation, writing the the message digest and
* zeroizing the context.
* @param digest This is an OUT parameter which contains
* the created hash after the method returns
* @param context The context to finalize
*/
void MD5::MD5Final (unsigned char digest[16], HL_MD5_CTX *context)
{
unsigned char bits[8];
unsigned int index, padLen;
/* Save number of bits */
Encode (bits, context->count, 8);
/*
* Pad out to 56 mod 64.
*/
index = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
MD5Update (context, PADDING, padLen);
/* Append length (before padding) */
MD5Update (context, bits, 8);
/* Store state in digest */
Encode (digest, context->state, 16);
/*
* Zeroize sensitive information.
*/
MD5_memset ((POINTER)context, 0, sizeof (*context));
}
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_md5.h.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/*
* The hashlib++ MD5 implementation is derivative from the sourcecode
* published in RFC 1321
*
* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
* rights reserved.
*
* License to copy and use this software is granted provided that it
* is identified as the "RSA Data Security, Inc. MD5 Message-Digest
* Algorithm" in all material mentioning or referencing this software
* or this function.
*
* License is also granted to make and use derivative works provided
* that such works are identified as "derived from the RSA Data
* Security, Inc. MD5 Message-Digest Algorithm" in all material
* mentioning or referencing the derived work.
*
* RSA Data Security, Inc. makes no representations concerning either
* the merchantability of this software or the suitability of this
* software for any particular purpose. It is provided "as is"
* without express or implied warranty of any kind.
*
* These notices must be retained in any copies of any part of this
* documentation and/or software.
*/
//----------------------------------------------------------------------
/**
* @file hl_md5.h
* @brief This file contains the declaration of the MD5 class
* @date Mo 17 Sep 2007
*/
//----------------------------------------------------------------------
//include protection
#ifndef MD5_H
#define MD5_H
//----------------------------------------------------------------------
//STL includes
#include <string>
//----------------------------------------------------------------------
//hl includes
#include "hl_types.h"
//----------------------------------------------------------------------
//typedefs
typedef hl_uint8 *POINTER;
/**
* @brief this struct represents a MD5-hash context.
*/
typedef struct
{
/** state (ABCD) */
unsigned long int state[4];
/** number of bits, modulo 2^64 (lsb first) */
unsigned long int count[2];
/** input buffer */
unsigned char buffer[64];
} HL_MD5_CTX;
//----------------------------------------------------------------------
/**
* @brief This class represents the implementation of
* the md5 message digest algorithm.
*
* Basically the class provides three public member-functions
* to create a hash: MD5Init(), MD5Update() and MD5Final().
* If you want to create a hash based on a string or file quickly
* you should use the md5wrapper class instead of MD5.
*/
class MD5
{
private:
/**
* @brief Basic transformation. Transforms state based on block.
* @param state state to transform
* @param block block to transform
*/
void MD5Transform (unsigned long int state[4], unsigned char block[64]);
/**
* @brief Encodes input data
* @param output Encoded data as OUT parameter
* @param input Input data
* @param len The length of the input assuming it is a
* multiple of 4
*/
void Encode (unsigned char* output,
unsigned long int *input,
unsigned int len);
/**
* @brief Decodes input data into output
* @param output Decoded data as OUT parameter
* @param input Input data
* @param len The length of the input assuming it is a
* multiple of 4
*/
void Decode (unsigned long int *output,
unsigned char *input,
unsigned int len);
/**
* @brief internal memory management
* @param output OUT parameter where POINTER is an unsigned
* char*
* @param input Data to copy where POINTER is a unsigned char*
* @param len The length of the data
*/
void MD5_memcpy (POINTER output, POINTER input, unsigned int len);
/**
* @brief internal memory management
* @param output OUT parameter where POINTER is an unsigned
* char*
* @param value Value to fill the memory with
* @param len The length of the data
*
*/
void MD5_memset (POINTER output, int value, unsigned int len);
public:
/**
* @brief Initialization begins an operation,
* writing a new context
* @param context The HL_MD5_CTX context to initialize
*/
void MD5Init (HL_MD5_CTX* context);
/**
* @brief Block update operation. Continues an md5
* message-digest operation, processing another
* message block, and updating the context.
* @param context The HL_MD5_CTX context to update
* @param input The data to write into the context
* @param inputLen The length of the input data
*/
void MD5Update (HL_MD5_CTX* context,
unsigned char *input,
unsigned int inputLen);
/**
* @brief Finalization ends the md5 message-digest
* operation, writing the the message digest and
* zeroizing the context.
* @param digest This is an OUT parameter which contains
* the created hash after the method returns
* @param context The context to finalize
*/
void MD5Final (unsigned char digest[16], HL_MD5_CTX* context);
/**
* @brief default constructor
*/
MD5(){};
};
//----------------------------------------------------------------------
//End of include protection
#endif
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_md5wrapper.cpp.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/**
* @file hl_md5wrapper.cpp
* @brief This file contains the implementation of the
* md5wrapper class
* @date Mo 17 Sep 2007
*/
//----------------------------------------------------------------------
//STL includes
#include <string>
#include <fstream>
#include <iostream>
#include <sstream>
//----------------------------------------------------------------------
//hashlib++ includes
#include "hl_md5wrapper.h"
//----------------------------------------------------------------------
//private member functions
/**
* @brief This method ends the hash process
* and returns the hash as string.
*
* @return the hash as std::string
*/
std::string md5wrapper::hashIt(void)
{
//create the hash
unsigned char buff[16] = "";
md5->MD5Final((unsigned char*)buff,&ctx);
//converte the hash to a string and return it
return convToString(buff);
}
/**
* @brief This internal member-function
* convertes the hash-data to a
* std::string (HEX).
*
* @param data The hash-data to covert into HEX
* @return the converted data as std::string
*/
std::string md5wrapper::convToString(unsigned char *data)
{
/*
* using a ostringstream to convert the hash in a
* hex string
*/
std::ostringstream os;
for(int i=0; i<16; ++i)
{
/*
* set the width to 2
*/
os.width(2);
/*
* fill with 0
*/
os.fill('0');
/*
* conv to hex
*/
os << std::hex << static_cast<unsigned int>(data[i]);
}
/*
* return as std::string
*/
return os.str();
}
/**
* @brief This method adds the given data to the
* current hash context.
*
* @param data The data to add to the current context
* @param len The length of the data to add
*/
void md5wrapper::updateContext(unsigned char *data, unsigned int len)
{
//update
md5->MD5Update(&ctx, data, len);
}
/**
* @brief This method resets the current hash context.
* In other words: It starts a new hash process.
*/
void md5wrapper::resetContext(void)
{
//init md5
md5->MD5Init(&ctx);
}
/**
* @brief This method should return the hash of the
* test-string "The quick brown fox jumps over the lazy
* dog"
*/
std::string md5wrapper::getTestHash(void)
{
return "9e107d9d372bb6826bd81d3542a419d6";
}
//----------------------------------------------------------------------
//public member functions
/**
* @brief default constructor
*/
md5wrapper::md5wrapper()
{
md5 = new MD5();
}
/**
* @brief default destructor
*/
md5wrapper::~md5wrapper()
{
delete md5;
}
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_md5wrapper.h.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/**
* @file hl_md5wrapper.h
* @brief This file contains the definition of the md5wrapper
* class.
* @date Mo 17 Sep 2007
*/
//----------------------------------------------------------------------
//include protection
#ifndef MD5WRAPPER_H
#define MD5WRAPPER_H
//----------------------------------------------------------------------
//hashlib++ includes
#include "hl_hashwrapper.h"
#include "hl_md5.h"
//----------------------------------------------------------------------
//STL includes
#include <string>
//----------------------------------------------------------------------
/**
* @brief This class represents the MD5 wrapper-class
*
* You can use this class to easily create a md5 hash.
* Just create an instance of md5wrapper and call the
* inherited memberfunctions getHashFromString()
* and getHashFromFile() to create a hash based on a
* string or a file.
*
* Have a look at the following example:
*
* @include md5example.cpp
*
* md5wrapper implements resetContext(), updateContext()
* and hashIt() to create a hash.
*/
class md5wrapper : public hashwrapper
{
protected:
/**
* MD5 access
*/
MD5 *md5;
/**
* MD5 context
*/
HL_MD5_CTX ctx;
/**
* @brief This method ends the hash process
* and returns the hash as string.
*
* @return the hash as std::string
*/
virtual std::string hashIt(void);
/**
* @brief This internal member-function
* convertes the hash-data to a
* std::string (HEX).
*
* @param data The hash-data to covert into HEX
* @return the converted data as std::string
*/
virtual std::string convToString(unsigned char *data);
/**
* @brief This method adds the given data to the
* current hash context.
*
* @param data The data to add to the current context
* @param len The length of the data to add
*/
virtual void updateContext(unsigned char *data, unsigned int len);
/**
* @brief This method resets the current hash context.
* In other words: It starts a new hash process.
*/
virtual void resetContext(void);
/**
* @brief This method should return the hash of the
* test-string "The quick brown fox jumps over the lazy
* dog"
*/
virtual std::string getTestHash(void);
public:
/**
* @brief default constructor
*/
md5wrapper();
/**
* @brief default destructor
*/
virtual ~md5wrapper();
};
//----------------------------------------------------------------------
//include protection
#endif
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_sha1.cpp.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/*
* The hashlib++ SHA1 implementation is derivative from the sourcecode
* published in RFC 3174
*
* Copyright (C) The Internet Society (2001). All Rights Reserved.
*
* This document and translations of it may be copied and furnished to
* others, and derivative works that comment on or otherwise explain it
* or assist in its implementation may be prepared, copied, published
* and distributed, in whole or in part, without restriction of any
* kind, provided that the above copyright notice and this paragraph are
* included on all such copies and derivative works. However, this
* document itself may not be modified in any way, such as by removing
* the copyright notice or references to the Internet Society or other
* Internet organizations, except as needed for the purpose of
* developing Internet standards in which case the procedures for
* copyrights defined in the Internet Standards process must be
* followed, or as required to translate it into languages other than
* English.
*
* The limited permissions granted above are perpetual and will not be
* revoked by the Internet Society or its successors or assigns.
*
* This document and the information contained herein is provided on an
* "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
* TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
* HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*/
//----------------------------------------------------------------------
/**
* @file hl_sha1.cpp
* @brief This file contains the implementation of the SHA1 class
* @date Mo 17 Sep 2007
*/
//----------------------------------------------------------------------
//hashlib++ includes
#include "hl_sha1.h"
//----------------------------------------------------------------------
//defines
/*
* Define the SHA1 circular left shift macro
*/
#define SHA1CircularShift(bits,word) \
(((word) << (bits)) | ((word) >> (32-(bits))))
//----------------------------------------------------------------------
//private member-functions
/**
* @brief Internal method to padd the message
*
* According to the standard, the message must
* be padded to an even 512 bits. The first
* padding bit must be a '1'. The last 64 bits
* represent the length of the original message.
* All bits in between should be 0.
* This function will pad the message according
* to those rules by filling the Message_Block array
* accordingly. It will also call the
* ProcessMessageBlock function provided appropriately.
* When it returns, it can be assumed that the message
* digest has been computed.
*
* @param context The context to padd
*
*/
void SHA1::SHA1PadMessage(HL_SHA1_CTX *context)
{
/*
* Check to see if the current message block is too small to hold
* the initial padding bits and length. If so, we will pad the
* block, process it, and then continue padding into a second
* block.
*/
if (context->Message_Block_Index > 55)
{
context->Message_Block[context->Message_Block_Index++] = 0x80;
while(context->Message_Block_Index < 64)
{
context->Message_Block[context->Message_Block_Index++] = 0;
}
SHA1ProcessMessageBlock(context);
while(context->Message_Block_Index < 56)
{
context->Message_Block[context->Message_Block_Index++] = 0;
}
}
else
{
context->Message_Block[context->Message_Block_Index++] = 0x80;
while(context->Message_Block_Index < 56)
{
context->Message_Block[context->Message_Block_Index++] = 0;
}
}
/*
* Store the message length as the last 8 octets
*/
context->Message_Block[56] = context->Length_High >> 24;
context->Message_Block[57] = context->Length_High >> 16;
context->Message_Block[58] = context->Length_High >> 8;
context->Message_Block[59] = context->Length_High;
context->Message_Block[60] = context->Length_Low >> 24;
context->Message_Block[61] = context->Length_Low >> 16;
context->Message_Block[62] = context->Length_Low >> 8;
context->Message_Block[63] = context->Length_Low;
SHA1ProcessMessageBlock(context);
}
/**
* @brief This member-function will process the next 512 bits of the
* message stored in the Message_Block array.
*
* Many of the variable names in this code, especially the
* single character names, were used because those were the
* names used in the publication.
*
* @param context The context to process
*/
void SHA1::SHA1ProcessMessageBlock(HL_SHA1_CTX *context)
{
const hl_uint32 K[] = { /* Constants defined in SHA-1 */
0x5A827999,
0x6ED9EBA1,
0x8F1BBCDC,
0xCA62C1D6
};
int t; /* Loop counter */
hl_uint32 temp; /* Temporary word value */
hl_uint32 W[80]; /* Word sequence */
hl_uint32 A, B, C, D, E; /* Word buffers */
/*
* Initialize the first 16 words in the array W
*/
for(t = 0; t < 16; t++)
{
W[t] = context->Message_Block[t * 4] << 24;
W[t] |= context->Message_Block[t * 4 + 1] << 16;
W[t] |= context->Message_Block[t * 4 + 2] << 8;
W[t] |= context->Message_Block[t * 4 + 3];
}
for(t = 16; t < 80; t++)
{
W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]);
}
A = context->Intermediate_Hash[0];
B = context->Intermediate_Hash[1];
C = context->Intermediate_Hash[2];
D = context->Intermediate_Hash[3];
E = context->Intermediate_Hash[4];
for(t = 0; t < 20; t++)
{
temp = SHA1CircularShift(5,A) +
((B & C) | ((~B) & D)) + E + W[t] + K[0];
E = D;
D = C;
C = SHA1CircularShift(30,B);
B = A;
A = temp;
}
for(t = 20; t < 40; t++)
{
temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1];
E = D;
D = C;
C = SHA1CircularShift(30,B);
B = A;
A = temp;
}
for(t = 40; t < 60; t++)
{
temp = SHA1CircularShift(5,A) +
((B & C) | (B & D) | (C & D)) + E + W[t] + K[2];
E = D;
D = C;
C = SHA1CircularShift(30,B);
B = A;
A = temp;
}
for(t = 60; t < 80; t++)
{
temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3];
E = D;
D = C;
C = SHA1CircularShift(30,B);
B = A;
A = temp;
}
context->Intermediate_Hash[0] += A;
context->Intermediate_Hash[1] += B;
context->Intermediate_Hash[2] += C;
context->Intermediate_Hash[3] += D;
context->Intermediate_Hash[4] += E;
context->Message_Block_Index = 0;
}
//----------------------------------------------------------------------
//public member-functions
/**
* @brief Resets the sha1 context and starts a new
* hashprocess
* @param context The context to reset
* @return 0 on succes an error number otherwise
*/
int SHA1::SHA1Reset(HL_SHA1_CTX *context)
{
if (!context)
{
return shaNull;
}
context->Length_Low = 0;
context->Length_High = 0;
context->Message_Block_Index = 0;
context->Intermediate_Hash[0] = 0x67452301;
context->Intermediate_Hash[1] = 0xEFCDAB89;
context->Intermediate_Hash[2] = 0x98BADCFE;
context->Intermediate_Hash[3] = 0x10325476;
context->Intermediate_Hash[4] = 0xC3D2E1F0;
context->Computed = 0;
context->Corrupted = 0;
return shaSuccess;
}
/**
* @brief Data input.
*
* This memberfunction add data to the specified
* context.
*
* @param context The context to add data to
* @param message_array The data to add
* @param length The length of the data to add
*/
int SHA1::SHA1Input( HL_SHA1_CTX *context,
const hl_uint8 *message_array,
unsigned int length)
{
if (!length)
{
return shaSuccess;
}
if (!context || !message_array)
{
return shaNull;
}
if (context->Computed)
{
context->Corrupted = shaStateError;
return shaStateError;
}
if (context->Corrupted)
{
return context->Corrupted;
}
while(length-- && !context->Corrupted)
{
context->Message_Block[context->Message_Block_Index++] =
(*message_array & 0xFF);
context->Length_Low += 8;
if (context->Length_Low == 0)
{
context->Length_High++;
if (context->Length_High == 0)
{
/* Message is too long */
context->Corrupted = 1;
}
}
if (context->Message_Block_Index == 64)
{
SHA1ProcessMessageBlock(context);
}
message_array++;
}
return shaSuccess;
}
/**
* @brief This ends the sha operation, zeroizing the context
* and returning the computed hash.
*
* @param context The context to get the hash from
* @param Message_Digest This is an OUT parameter which
* contains the hash after the menberfunction returns
* @return 0 on succes, an error-code otherwise
*/
int SHA1::SHA1Result( HL_SHA1_CTX *context,
hl_uint8 Message_Digest[SHA1HashSize])
{
int i;
if (!context || !Message_Digest)
{
return shaNull;
}
if (context->Corrupted)
{
return context->Corrupted;
}
if (!context->Computed)
{
SHA1PadMessage(context);
for(i=0; i<64; ++i)
{
/* message may be sensitive, clear it out */
context->Message_Block[i] = 0;
}
context->Length_Low = 0; /* and clear length */
context->Length_High = 0;
context->Computed = 1;
}
for(i = 0; i < SHA1HashSize; ++i)
{
Message_Digest[i] = context->Intermediate_Hash[i>>2]
>> 8 * ( 3 - ( i & 0x03 ) );
}
return shaSuccess;
}
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_sha1.h.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/*
* The hashlib++ SHA1 implementation is derivative from the sourcecode
* published in RFC 3174
*
* Copyright (C) The Internet Society (2001). All Rights Reserved.
*
* This document and translations of it may be copied and furnished to
* others, and derivative works that comment on or otherwise explain it
* or assist in its implementation may be prepared, copied, published
* and distributed, in whole or in part, without restriction of any
* kind, provided that the above copyright notice and this paragraph are
* included on all such copies and derivative works. However, this
* document itself may not be modified in any way, such as by removing
* the copyright notice or references to the Internet Society or other
* Internet organizations, except as needed for the purpose of
* developing Internet standards in which case the procedures for
* copyrights defined in the Internet Standards process must be
* followed, or as required to translate it into languages other than
* English.
*
* The limited permissions granted above are perpetual and will not be
* revoked by the Internet Society or its successors or assigns.
*
* This document and the information contained herein is provided on an
* "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
* TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
* HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*/
//----------------------------------------------------------------------
/**
* @file hl_sha1.h
* @brief This file contains the declaration of the SHA1 class
* @date Mo 17 Sep 2007
*/
//----------------------------------------------------------------------
//include protection
#ifndef SHA1_H
#define SHA1_H
//----------------------------------------------------------------------
//hl includes
#include "hl_types.h"
//----------------------------------------------------------------------
//enums
#ifndef _SHA_enum_
#define _SHA_enum_
enum
{
shaSuccess = 0,
shaNull, /* Null pointer parameter */
shaInputTooLong, /* input data too long */
shaStateError /* called Input after Result */
};
#endif
//----------------------------------------------------------------------
//defines
#define SHA1HashSize 20
//----------------------------------------------------------------------
//structs
/**
* @brief this struct represents a SHA1-hash context.
*/
typedef struct HL_SHA1_CTX
{
/** Message Digest */
hl_uint32 Intermediate_Hash[SHA1HashSize/4];
/** Message length in bits */
hl_uint32 Length_Low;
/** Message length in bits */
hl_uint32 Length_High;
/** Index into message block array */
hl_uint16 Message_Block_Index;
/** 512-bit message blocks */
hl_uint8 Message_Block[64];
/** Is the digest computed? */
int Computed;
/** Is the message digest corrupted? */
int Corrupted;
} HL_SHA1_CTX;
//----------------------------------------------------------------------
//class definition
/**
* @brief This class represents the implementation of
* the sha1 algorithm.
*
* Basically the class provides three public member-functions
* to create a hash: SHA1Reset(), SHA1Input() and SHA1Result().
* If you want to create a hash based on a string or file quickly
* you should use the sha1wrapper class instead of SHA1.
*/
class SHA1
{
private:
/**
* @brief Internal method to padd the message
*
* According to the standard, the message must
* be padded to an even 512 bits. The first
* padding bit must be a '1'. The last 64 bits
* represent the length of the original message.
* All bits in between should be 0.
* This function will pad the message according
* to those rules by filling the Message_Block array
* accordingly. It will also call the
* ProcessMessageBlock function provided appropriately.
* When it returns, it can be assumed that the message
* digest has been computed.
*
* @param context The context to padd
*
*/
void SHA1PadMessage(HL_SHA1_CTX *context);
/**
* @brief This member-function will process the next 512 bits of the
* message stored in the Message_Block array.
*
* Many of the variable names in this code, especially the
* single character names, were used because those were the
* names used in the publication.
*
* @param context The context to process
*/
void SHA1ProcessMessageBlock(HL_SHA1_CTX *context);
public:
/**
* @brief Resets the sha1 context and starts a new
* hashprocess
* @param context The context to reset
* @return 0 on succes an error number otherwise
*/
int SHA1Reset( HL_SHA1_CTX *context);
/**
* @brief Data input.
*
* This memberfunction add data to the specified
* context.
*
* @param context The context to add data to
* @param message_array The data to add
* @param length The length of the data to add
*/
int SHA1Input( HL_SHA1_CTX *context,
const hl_uint8 *message_array,
unsigned int length);
/**
* @brief This ends the sha operation, zeroizing the context
* and returning the computed hash.
*
* @param context The context to get the hash from
* @param Message_Digest This is an OUT parameter which
* contains the hash after the menberfunction returns
* @return 0 on succes, an error-code otherwise
*/
int SHA1Result( HL_SHA1_CTX *context,
hl_uint8 Message_Digest[SHA1HashSize]);
};
//----------------------------------------------------------------------
//end of include protection
#endif
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_sha1wrapper.cpp.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/**
* @file hl_sha1wrapper.cpp
* @brief This file contains the implementation of the
* sha1wrapper class
* @date Mo 17 Sep 2007
*/
//----------------------------------------------------------------------
//hashlib++ includes
#include "hl_sha1wrapper.h"
#include "hl_sha1.h"
#include "hl_types.h"
//----------------------------------------------------------------------
//STL includes
#include <sstream>
//----------------------------------------------------------------------
//private memberfunctions
/**
* @brief This method ends the hash process
* and returns the hash as string.
*
* @return a hash as std::string
*/
std::string sha1wrapper::hashIt(void)
{
hl_uint8 Message_Digest[20];
sha1->SHA1Result(&context, Message_Digest);
return convToString(Message_Digest);
}
/**
* @brief This internal member-function
* convertes the hash-data to a
* std::string (HEX).
*
* @param data The hash-data to covert into HEX
* @return the converted data as std::string
*/
std::string sha1wrapper::convToString(unsigned char *data)
{
std::ostringstream os;
for(int i=0; i<20; ++i)
{
/*
* set the width to 2
*/
os.width(2);
/*
* fill with 0
*/
os.fill('0');
/*
* conv to hex
*/
os << std::hex << static_cast<unsigned int>(data[i]);
}
/*
* return as std::string
*/
return os.str();
}
/**
* @brief This method adds the given data to the
* current hash context
*
* @param data The data to add to the current context
* @param len The length of the data to add
*/
void sha1wrapper::updateContext(unsigned char *data, unsigned int len)
{
sha1->SHA1Input(&context, data, len);
}
/**
* @brief This method resets the current hash context.
* In other words: It starts a new hash process.
*/
void sha1wrapper::resetContext(void)
{
sha1->SHA1Reset(&context);
}
/**
* @brief This method should return the hash of the
* test-string "The quick brown fox jumps over the lazy
* dog"
*/
std::string sha1wrapper::getTestHash(void)
{
return "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12";
}
//----------------------------------------------------------------------
//public memberfunctions
/**
* @brief default constructor
*/
sha1wrapper::sha1wrapper()
{
this->sha1 = new SHA1();
}
/**
* @brief default destructor
*/
sha1wrapper::~sha1wrapper()
{
delete this->sha1;
}
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_sha1wrapper.h.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/**
* @file hl_sha1wrapper.h
* @brief This file contains the definition of the sha1wrapper
* class.
* @date Mo 17 Sep 2007
*/
//----------------------------------------------------------------------
//include protection
#ifndef SHA1WRAPPER_H
#define SHA1WRAPPER_H
//----------------------------------------------------------------------
//hashlib++ includes
#include "hl_hashwrapper.h"
#include "hl_sha1.h"
//----------------------------------------------------------------------
/**
* @brief This class represents the SHA1 wrapper-class
*
* You can use this class to easily create a sha1 hash.
* Just create an instance of sha1wrapper and call the
* inherited memberfunctions getHashFromString()
* and getHashFromFile() to create a hash based on a
* string or a file.
*
* Have a look at the following example:
*
* @include sha1example.cpp
*
* sha1wrapper implements resetContext(), updateContext()
* and hashIt() to create a hash.
*/
class sha1wrapper : public hashwrapper
{
protected:
/**
* SHA1 access
*/
SHA1 *sha1;
/*
* SHA1 context
*/
HL_SHA1_CTX context;
/**
* @brief This method ends the hash process
* and returns the hash as string.
*
* @return a hash as std::string
*/
virtual std::string hashIt(void);
/**
* @brief This internal member-function
* convertes the hash-data to a
* std::string (HEX).
*
* @param data The hash-data to covert into HEX
* @return the converted data as std::string
*/
virtual std::string convToString(unsigned char *data);
/**
* @brief This method adds the given data to the
* current hash context
*
* @param data The data to add to the current context
* @param len The length of the data to add
*/
virtual void updateContext(unsigned char *data, unsigned int len);
/**
* @brief This method resets the current hash context.
* In other words: It starts a new hash process.
*/
virtual void resetContext(void);
/**
* @brief This method should return the hash of the
* test-string "The quick brown fox jumps over the lazy
* dog"
*/
virtual std::string getTestHash(void);
public:
/**
* @brief default constructor
*/
sha1wrapper();
/**
* @brief default destructor
*/
virtual ~sha1wrapper();
};
//----------------------------------------------------------------------
//end of include protection
#endif
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_sha256.cpp.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/*
* The hashlib++ SHA256 implementation is derivative from the sourcecode
* published by Aaron D. Gifford
*
* Copyright (c) 2000-2001, Aaron D. Gifford
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the copyright holder nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``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 AUTHOR OR CONTRIBUTOR(S) 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.
*
*/
//----------------------------------------------------------------------
/**
* @file hl_sha256.cpp
* @brief This file contains the implementation of the SHA256 class
* @date Di 25 Sep 2007
*/
//----------------------------------------------------------------------
//hashlib++ includes
#include "hl_sha256.h"
//----------------------------------------------------------------------
/*
* Standard C includes
*/
#include <string.h>
#include <assert.h>
//----------------------------------------------------------------------
#include "hl_sha2mac.h"
//----------------------------------------------------------------------
/*
* Hash constant words K for SHA-256:
*/
const static sha2_word32 K256[64] = {
0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL,
0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL,
0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL,
0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL,
0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL,
0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL,
0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL,
0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL,
0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL,
0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
};
/*
* Initial hash value H for SHA-256:
*/
const static sha2_word32 sha256_initial_hash_value[8] = {
0x6a09e667UL,
0xbb67ae85UL,
0x3c6ef372UL,
0xa54ff53aUL,
0x510e527fUL,
0x9b05688cUL,
0x1f83d9abUL,
0x5be0cd19UL
};
/*
* Constant used by End() functions for converting the
* digest to a readable hexadecimal character string:
*/
static const char *sha2_hex_digits = "0123456789abcdef";
/*** SHA-256: *********************************************************/
/**
* @brief Initialize the context
* @param context The context to init.
*/
void SHA256::SHA256_Init(HL_SHA256_CTX* context) {
if (context == (HL_SHA256_CTX*)0) {
return;
}
MEMCPY_BCOPY(context->state, sha256_initial_hash_value, SHA256_DIGEST_LENGTH);
MEMSET_BZERO(context->buffer, SHA256_BLOCK_LENGTH);
context->bitcount = 0;
}
#ifdef SHA2_UNROLL_TRANSFORM
/* Unrolled SHA-256 round macros: */
#if BYTE_ORDER == LITTLE_ENDIAN
#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \
REVERSE32(*data++, W256[j]); \
T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \
K256[j] + W256[j]; \
(d) += T1; \
(h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
j++
#else /* BYTE_ORDER == LITTLE_ENDIAN */
#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \
T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \
K256[j] + (W256[j] = *data++); \
(d) += T1; \
(h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
j++
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
#define ROUND256(a,b,c,d,e,f,g,h) \
s0 = W256[(j+1)&0x0f]; \
s0 = sigma0_256(s0); \
s1 = W256[(j+14)&0x0f]; \
s1 = sigma1_256(s1); \
T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + K256[j] + \
(W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); \
(d) += T1; \
(h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
j++
/**
* @brief Internal data transformation
* @param context The context to use
* @param data The data to transform
*/
void SHA256::SHA256_Transform(HL_SHA256_CTX* context, const sha2_word32* data) {
sha2_word32 a, b, c, d, e, f, g, h, s0, s1;
sha2_word32 T1, *W256;
int j;
W256 = (sha2_word32*)context->buffer;
/* Initialize registers with the prev. intermediate value */
a = context->state[0];
b = context->state[1];
c = context->state[2];
d = context->state[3];
e = context->state[4];
f = context->state[5];
g = context->state[6];
h = context->state[7];
j = 0;
do {
/* Rounds 0 to 15 (unrolled): */
ROUND256_0_TO_15(a,b,c,d,e,f,g,h);
ROUND256_0_TO_15(h,a,b,c,d,e,f,g);
ROUND256_0_TO_15(g,h,a,b,c,d,e,f);
ROUND256_0_TO_15(f,g,h,a,b,c,d,e);
ROUND256_0_TO_15(e,f,g,h,a,b,c,d);
ROUND256_0_TO_15(d,e,f,g,h,a,b,c);
ROUND256_0_TO_15(c,d,e,f,g,h,a,b);
ROUND256_0_TO_15(b,c,d,e,f,g,h,a);
} while (j < 16);
/* Now for the remaining rounds to 64: */
do {
ROUND256(a,b,c,d,e,f,g,h);
ROUND256(h,a,b,c,d,e,f,g);
ROUND256(g,h,a,b,c,d,e,f);
ROUND256(f,g,h,a,b,c,d,e);
ROUND256(e,f,g,h,a,b,c,d);
ROUND256(d,e,f,g,h,a,b,c);
ROUND256(c,d,e,f,g,h,a,b);
ROUND256(b,c,d,e,f,g,h,a);
} while (j < 64);
/* Compute the current intermediate hash value */
context->state[0] += a;
context->state[1] += b;
context->state[2] += c;
context->state[3] += d;
context->state[4] += e;
context->state[5] += f;
context->state[6] += g;
context->state[7] += h;
/* Clean up */
a = b = c = d = e = f = g = h = T1 = 0;
}
#else /* SHA2_UNROLL_TRANSFORM */
/**
* @brief Internal data transformation
* @param context The context to use
* @param data The data to transform
*/
void SHA256::SHA256_Transform(HL_SHA256_CTX* context, const sha2_word32* data) {
sha2_word32 a, b, c, d, e, f, g, h, s0, s1;
sha2_word32 T1, T2, *W256;
int j;
W256 = (sha2_word32*)context->buffer;
/* Initialize registers with the prev. intermediate value */
a = context->state[0];
b = context->state[1];
c = context->state[2];
d = context->state[3];
e = context->state[4];
f = context->state[5];
g = context->state[6];
h = context->state[7];
j = 0;
do {
#if BYTE_ORDER == LITTLE_ENDIAN
/* Copy data while converting to host byte order */
REVERSE32(*data++,W256[j]);
/* Apply the SHA-256 compression function to update a..h */
T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j];
#else /* BYTE_ORDER == LITTLE_ENDIAN */
/* Apply the SHA-256 compression function to update a..h with copy */
T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j] = *data++);
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
T2 = Sigma0_256(a) + Maj(a, b, c);
h = g;
g = f;
f = e;
e = d + T1;
d = c;
c = b;
b = a;
a = T1 + T2;
j++;
} while (j < 16);
do {
/* Part of the message block expansion: */
s0 = W256[(j+1)&0x0f];
s0 = sigma0_256(s0);
s1 = W256[(j+14)&0x0f];
s1 = sigma1_256(s1);
/* Apply the SHA-256 compression function to update a..h */
T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] +
(W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0);
T2 = Sigma0_256(a) + Maj(a, b, c);
h = g;
g = f;
f = e;
e = d + T1;
d = c;
c = b;
b = a;
a = T1 + T2;
j++;
} while (j < 64);
/* Compute the current intermediate hash value */
context->state[0] += a;
context->state[1] += b;
context->state[2] += c;
context->state[3] += d;
context->state[4] += e;
context->state[5] += f;
context->state[6] += g;
context->state[7] += h;
/* Clean up */
a = b = c = d = e = f = g = h = T1 = T2 = 0;
}
#endif /* SHA2_UNROLL_TRANSFORM */
/**
* @brief Updates the context
* @param context The context to update.
* @param data The data for updating the context.
* @param len The length of the given data.
*/
void SHA256::SHA256_Update(HL_SHA256_CTX* context, const sha2_byte *data, unsigned int len) {
unsigned int freespace, usedspace;
if (len == 0) {
/* Calling with no data is valid - we do nothing */
return;
}
/* Sanity check: */
assert(context != (HL_SHA256_CTX*)0 && data != (sha2_byte*)0);
usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
if (usedspace > 0) {
/* Calculate how much free space is available in the buffer */
freespace = SHA256_BLOCK_LENGTH - usedspace;
if (len >= freespace) {
/* Fill the buffer completely and process it */
MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace);
context->bitcount += freespace << 3;
len -= freespace;
data += freespace;
SHA256_Transform(context, (sha2_word32*)context->buffer);
} else {
/* The buffer is not yet full */
MEMCPY_BCOPY(&context->buffer[usedspace], data, len);
context->bitcount += len << 3;
/* Clean up: */
usedspace = freespace = 0;
return;
}
}
while (len >= SHA256_BLOCK_LENGTH) {
/* Process as many complete blocks as we can */
SHA256_Transform(context, (sha2_word32*)data);
context->bitcount += SHA256_BLOCK_LENGTH << 3;
len -= SHA256_BLOCK_LENGTH;
data += SHA256_BLOCK_LENGTH;
}
if (len > 0) {
/* There's left-overs, so save 'em */
MEMCPY_BCOPY(context->buffer, data, len);
context->bitcount += len << 3;
}
/* Clean up: */
usedspace = freespace = 0;
}
/**
* @brief Finalize the sha256 operation
* @param digest The digest to finalize the operation with.
* @param context The context to finalize.
*/
void SHA256::SHA256_Final(sha2_byte digest[], HL_SHA256_CTX* context) {
sha2_word32 *d = (sha2_word32*)digest;
unsigned int usedspace;
/* Sanity check: */
assert(context != (HL_SHA256_CTX*)0);
/* If no digest buffer is passed, we don't bother doing this: */
if (digest != (sha2_byte*)0) {
usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
#if BYTE_ORDER == LITTLE_ENDIAN
/* Convert FROM host byte order */
REVERSE64(context->bitcount,context->bitcount);
#endif
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace++] = 0x80;
if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
MEMSET_BZERO(&context->buffer[usedspace], SHA256_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace < SHA256_BLOCK_LENGTH) {
MEMSET_BZERO(&context->buffer[usedspace], SHA256_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA256_Transform(context, (sha2_word32*)context->buffer);
/* And set-up for the last transform: */
MEMSET_BZERO(context->buffer, SHA256_SHORT_BLOCK_LENGTH);
}
} else {
/* Set-up for the last transform: */
MEMSET_BZERO(context->buffer, SHA256_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Set the bit count: */
*(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
/* Final transform: */
SHA256_Transform(context, (sha2_word32*)context->buffer);
#if BYTE_ORDER == LITTLE_ENDIAN
{
/* Convert TO host byte order */
int j;
for (j = 0; j < 8; j++) {
REVERSE32(context->state[j],context->state[j]);
*d++ = context->state[j];
}
}
#else
MEMCPY_BCOPY(d, context->state, SHA256_DIGEST_LENGTH);
#endif
}
/* Clean up state data: */
MEMSET_BZERO(context, sizeof(context));
usedspace = 0;
}
/**
* @brief Ends the sha256 operation and return the
* created hash in the given buffer.
* @param context The context to end.
* @param buffer This OUT-Parameter contains the created
* hash after ending the operation.
*/
char* SHA256::SHA256_End(HL_SHA256_CTX* context, char buffer[]) {
sha2_byte digest[SHA256_DIGEST_LENGTH], *d = digest;
int i;
/* Sanity check: */
assert(context != (HL_SHA256_CTX*)0);
if (buffer != (char*)0) {
SHA256_Final(digest, context);
for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
*buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
*buffer++ = sha2_hex_digits[*d & 0x0f];
d++;
}
*buffer = (char)0;
} else {
MEMSET_BZERO(context, sizeof(context));
}
MEMSET_BZERO(digest, SHA256_DIGEST_LENGTH);
return buffer;
}
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_sha256.h.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/*
* The hashlib++ SHA256 implementation is derivative from the sourcecode
* published by Aaron D. Gifford
*
* Copyright (c) 2000-2001, Aaron D. Gifford
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the copyright holder nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``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 AUTHOR OR CONTRIBUTOR(S) 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.
*/
//----------------------------------------------------------------------
/**
* @file hl_sha256.h
* @brief This file contains the declaration of the SHA256 class
* @date Di 25 Sep 2007
*/
//----------------------------------------------------------------------
//include protection
#ifndef SHA256_H
#define SHA256_H
//----------------------------------------------------------------------
//lenght defines
#define SHA256_BLOCK_LENGTH 64
#define SHA256_SHORT_BLOCK_LENGTH (SHA256_BLOCK_LENGTH - 8)
#define SHA256_DIGEST_LENGTH 32
#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
//----------------------------------------------------------------------
//hl includes
#include "hl_types.h"
//----------------------------------------------------------------------
//typedefs
/**
* Exactly 1 byte
*/
typedef hl_uint8 sha2_byte;
/**
* Exactly 4 bytes
*/
typedef hl_uint32 sha2_word32;
/**
* Exactly 8 bytes
*/
typedef hl_uint64 sha2_word64;
/**
* @brief This struct represents a SHA256-hash context
*/
typedef struct HL_SHA256_CTX
{
/**
* state
*/
hl_uint32 state[8];
/**
* bitcount
*/
hl_uint64 bitcount;
/**
* message buffer
*/
hl_uint8 buffer[SHA256_BLOCK_LENGTH];
} HL_SHA256_CTX;
//----------------------------------------------------------------------
/**
* @brief This class represents the implementation of
* the sha256 algorithm.
*
* Basically the class provides three public member-functions
* to create a hash: SHA256_Init(), SHA256_Update() and SHA256_End().
* If you want to create a hash based on a string or file quickly
* you should use the sha256wrapper class instead of SHA256.
*/
class SHA256
{
private:
/**
* @brief Finalize the sha256 operation
* @param digest The digest to finalize the operation with.
* @param context The context to finalize.
*/
void SHA256_Final(hl_uint8 digest[SHA256_DIGEST_LENGTH],
HL_SHA256_CTX* context);
/**
* @brief Internal data transformation
* @param context The context to use
* @param data The data to transform
*/
void SHA256_Transform(HL_SHA256_CTX* context,
const sha2_word32* data);
public:
/**
* @brief Initialize the context
* @param context The context to init.
*/
void SHA256_Init(HL_SHA256_CTX *context);
/**
* @brief Updates the context
* @param context The context to update.
* @param data The data for updating the context.
* @param len The length of the given data.
*/
void SHA256_Update(HL_SHA256_CTX* context,
const hl_uint8* data,
unsigned int len);
/**
* @brief Ends the sha256 operation and return the
* created hash in the given buffer.
* @param context The context to end.
* @param buffer This OUT-Parameter contains the created
* hash after ending the operation.
*/
char* SHA256_End(HL_SHA256_CTX* context,
char buffer[SHA256_DIGEST_STRING_LENGTH]);
};
//----------------------------------------------------------------------
//end of include protection
#endif
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_sha256wrapper.cpp.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/**
* @file hl_sha256wrapper.cpp
* @brief This file contains the implementation of the sha256wrapper
* class.
* @date Di 25 Sep 2007
*/
//----------------------------------------------------------------------
//hashlib++ includes
#include "hl_sha256wrapper.h"
#include "hl_sha256.h"
//----------------------------------------------------------------------
//STL includes
#include <string>
//----------------------------------------------------------------------
//private memberfunctions
/**
* @brief This method ends the hash process
* and returns the hash as string.
*
* @return a hash as std::string
*/
std::string sha256wrapper::hashIt(void)
{
sha2_byte buff[SHA256_DIGEST_STRING_LENGTH];
sha256->SHA256_End(&context,(char*)buff);
return convToString(buff);
}
/**
* @brief This internal member-function
* convertes the hash-data to a
* std::string (HEX).
*
* @param data The hash-data to covert into HEX
* @return the converted data as std::string
*/
std::string sha256wrapper::convToString(unsigned char *data)
{
/*
* we can just copy data to a string, because
* the transforming to hash is already done
* within the sha256 implementation
*/
return std::string((const char*)data);
}
/**
* @brief This method adds the given data to the
* current hash context
*
* @param data The data to add to the current context
* @param len The length of the data to add
*/
void sha256wrapper::updateContext(unsigned char *data, unsigned int len)
{
this->sha256->SHA256_Update(&context,data,len);
}
/**
* @brief This method resets the current hash context.
* In other words: It starts a new hash process.
*/
void sha256wrapper::resetContext(void)
{
sha256->SHA256_Init(&context);
}
/**
* @brief This method should return the hash of the
* test-string "The quick brown fox jumps over the lazy
* dog"
*/
std::string sha256wrapper::getTestHash(void)
{
return "d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592";
}
//----------------------------------------------------------------------
//public memberfunctions
/**
* @brief default constructor
*/
sha256wrapper::sha256wrapper()
{
this->sha256 = new SHA256();
}
/**
* @brief default destructor
*/
sha256wrapper::~sha256wrapper()
{
delete sha256;
}
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_sha256wrapper.h.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/**
* @file hl_sha256wrapper.h
* @brief This file contains the definition of the sha256wrapper
* class.
* @date Di 25 Sep 2007
*/
//----------------------------------------------------------------------
//include protection
#ifndef SHA256WRAPPER_H
#define SHA256WRAPPER_H
//----------------------------------------------------------------------
//hashlib++ includes
#include "hl_hashwrapper.h"
#include "hl_sha256.h"
//----------------------------------------------------------------------
//STL
#include <string>
//----------------------------------------------------------------------
/**
* @brief This class represents the SHA256 wrapper-class
*
* You can use this class to easily create a sha256 hash.
* Just create an instance of sha256wrapper and call the
* inherited memberfunctions getHashFromString()
* and getHashFromFile() to create a hash based on a
* string or a file.
*
* Have a look at the following example:
*
* @include sha256example.cpp
*
* sha256wrapper implements resetContext(), updateContext()
* and hashIt() to create a hash.
*/
class sha256wrapper : public hashwrapper
{
private:
/**
* SHA256 access
*/
SHA256 *sha256;
/**
* SHA256 context
*/
HL_SHA256_CTX context;
/**
* @brief This method ends the hash process
* and returns the hash as string.
*
* @return a hash as std::string
*/
virtual std::string hashIt(void);
/**
* @brief This internal member-function
* convertes the hash-data to a
* std::string (HEX).
*
* @param data The hash-data to covert into HEX
* @return the converted data as std::string
*/
virtual std::string convToString(unsigned char *data);
/**
* @brief This method adds the given data to the
* current hash context
*
* @param data The data to add to the current context
* @param len The length of the data to add
*/
virtual void updateContext(unsigned char *data, unsigned int len);
/**
* @brief This method resets the current hash context.
* In other words: It starts a new hash process.
*/
virtual void resetContext(void);
/**
* @brief This method should return the hash of the
* test-string "The quick brown fox jumps over the lazy
* dog"
*/
virtual std::string getTestHash(void);
public:
/**
* @brief default constructor
*/
sha256wrapper();
/**
* @brief default destructor
*/
virtual ~sha256wrapper();
};
//----------------------------------------------------------------------
//end of include protection
#endif
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_sha2ext.cpp.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/*
* The hashlib++ SHA384 and SHA512 implementations are derivative from
* the sourcecode published by Aaron D. Gifford
*
* Copyright (c) 2000-2001, Aaron D. Gifford
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the copyright holder nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``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 AUTHOR OR CONTRIBUTOR(S) 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.
*
*/
//----------------------------------------------------------------------
/**
* @file sha2ext.cpp
* @brief This file contains the implementation of the SHA2Ext class
* @date Mo 12 Nov 2007
*/
//----------------------------------------------------------------------
// Standard C includes
#include <string.h>
#include <assert.h>
//----------------------------------------------------------------------
//hashlib++ includes
#include "hl_sha2ext.h"
#include "hl_sha2mac.h"
//----------------------------------------------------------------------
/* Hash constant words K for SHA-384 and SHA-512: */
const static sha2_word64 K512[80] = {
0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL,
0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL,
0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL,
0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL,
0xd807aa98a3030242ULL, 0x12835b0145706fbeULL,
0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL,
0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL,
0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL,
0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL,
0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL,
0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL,
0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL,
0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL,
0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL,
0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL,
0x06ca6351e003826fULL, 0x142929670a0e6e70ULL,
0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL,
0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL,
0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL,
0x81c2c92e47edaee6ULL, 0x92722c851482353bULL,
0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL,
0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL,
0xd192e819d6ef5218ULL, 0xd69906245565a910ULL,
0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL,
0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL,
0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL,
0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL,
0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL,
0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL,
0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL,
0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL,
0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL,
0xca273eceea26619cULL, 0xd186b8c721c0c207ULL,
0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL,
0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL,
0x113f9804bef90daeULL, 0x1b710b35131c471bULL,
0x28db77f523047d84ULL, 0x32caab7b40c72493ULL,
0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL,
0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL,
0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL
};
/* Initial hash value H for SHA-384 */
const static sha2_word64 sha384_initial_hash_value[8] = {
0xcbbb9d5dc1059ed8ULL,
0x629a292a367cd507ULL,
0x9159015a3070dd17ULL,
0x152fecd8f70e5939ULL,
0x67332667ffc00b31ULL,
0x8eb44a8768581511ULL,
0xdb0c2e0d64f98fa7ULL,
0x47b5481dbefa4fa4ULL
};
/* Initial hash value H for SHA-512 */
const static sha2_word64 sha512_initial_hash_value[8] = {
0x6a09e667f3bcc908ULL,
0xbb67ae8584caa73bULL,
0x3c6ef372fe94f82bULL,
0xa54ff53a5f1d36f1ULL,
0x510e527fade682d1ULL,
0x9b05688c2b3e6c1fULL,
0x1f83d9abfb41bd6bULL,
0x5be0cd19137e2179ULL
};
/*
* * Constant used by SHA256/384/512_End() functions for converting the
* * digest to a readable hexadecimal character string:
* */
static const char *sha2_hex_digits = "0123456789abcdef";
//----------------------------------------------------------------------
/**
* @brief Initialize the SHA512 context
* @param context The context to init.
*/
void SHA2ext::SHA512_Init(HL_SHA512_CTX* context)
{
if (context == (HL_SHA512_CTX*)0) {
return;
}
MEMCPY_BCOPY(context->state, sha512_initial_hash_value, SHA512_DIGEST_LENGTH);
MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH);
context->bitcount[0] = context->bitcount[1] = 0;
}
#ifdef SHA2_UNROLL_TRANSFORM
/* Unrolled SHA-512 round macros: */
#if BYTE_ORDER == LITTLE_ENDIAN
#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \
REVERSE64(*data++, W512[j]); \
T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \
K512[j] + W512[j]; \
(d) += T1, \
(h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)), \
j++
#else /* BYTE_ORDER == LITTLE_ENDIAN */
#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \
T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \
K512[j] + (W512[j] = *data++); \
(d) += T1; \
(h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \
j++
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
#define ROUND512(a,b,c,d,e,f,g,h) \
s0 = W512[(j+1)&0x0f]; \
s0 = sigma0_512(s0); \
s1 = W512[(j+14)&0x0f]; \
s1 = sigma1_512(s1); \
T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + K512[j] + \
(W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); \
(d) += T1; \
(h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \
j++
/**
* @brief Internal data transformation
* @param context The context to use
* @param data The data to transform
*/
void SHA2ext::SHA512_Transform(HL_SHA512_CTX* context, const sha2_word64* data) {
sha2_word64 a, b, c, d, e, f, g, h, s0, s1;
sha2_word64 T1, *W512 = (sha2_word64*)context->buffer;
int j;
/* Initialize registers with the prev. intermediate value */
a = context->state[0];
b = context->state[1];
c = context->state[2];
d = context->state[3];
e = context->state[4];
f = context->state[5];
g = context->state[6];
h = context->state[7];
j = 0;
do {
ROUND512_0_TO_15(a,b,c,d,e,f,g,h);
ROUND512_0_TO_15(h,a,b,c,d,e,f,g);
ROUND512_0_TO_15(g,h,a,b,c,d,e,f);
ROUND512_0_TO_15(f,g,h,a,b,c,d,e);
ROUND512_0_TO_15(e,f,g,h,a,b,c,d);
ROUND512_0_TO_15(d,e,f,g,h,a,b,c);
ROUND512_0_TO_15(c,d,e,f,g,h,a,b);
ROUND512_0_TO_15(b,c,d,e,f,g,h,a);
} while (j < 16);
/* Now for the remaining rounds up to 79: */
do {
ROUND512(a,b,c,d,e,f,g,h);
ROUND512(h,a,b,c,d,e,f,g);
ROUND512(g,h,a,b,c,d,e,f);
ROUND512(f,g,h,a,b,c,d,e);
ROUND512(e,f,g,h,a,b,c,d);
ROUND512(d,e,f,g,h,a,b,c);
ROUND512(c,d,e,f,g,h,a,b);
ROUND512(b,c,d,e,f,g,h,a);
} while (j < 80);
/* Compute the current intermediate hash value */
context->state[0] += a;
context->state[1] += b;
context->state[2] += c;
context->state[3] += d;
context->state[4] += e;
context->state[5] += f;
context->state[6] += g;
context->state[7] += h;
/* Clean up */
a = b = c = d = e = f = g = h = T1 = 0;
}
#else /* SHA2_UNROLL_TRANSFORM */
/**
* @brief Internal data transformation
* @param context The context to use
* @param data The data to transform
*/
void SHA2ext::SHA512_Transform(HL_SHA512_CTX* context, const sha2_word64* data) {
sha2_word64 a, b, c, d, e, f, g, h, s0, s1;
sha2_word64 T1, T2, *W512 = (sha2_word64*)context->buffer;
int j;
/* Initialize registers with the prev. intermediate value */
a = context->state[0];
b = context->state[1];
c = context->state[2];
d = context->state[3];
e = context->state[4];
f = context->state[5];
g = context->state[6];
h = context->state[7];
j = 0;
do {
#if BYTE_ORDER == LITTLE_ENDIAN
/* Convert TO host byte order */
REVERSE64(*data++, W512[j]);
/* Apply the SHA-512 compression function to update a..h */
T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j];
#else /* BYTE_ORDER == LITTLE_ENDIAN */
/* Apply the SHA-512 compression function to update a..h with copy */
T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + (W512[j] = *data++);
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
T2 = Sigma0_512(a) + Maj(a, b, c);
h = g;
g = f;
f = e;
e = d + T1;
d = c;
c = b;
b = a;
a = T1 + T2;
j++;
} while (j < 16);
do {
/* Part of the message block expansion: */
s0 = W512[(j+1)&0x0f];
s0 = sigma0_512(s0);
s1 = W512[(j+14)&0x0f];
s1 = sigma1_512(s1);
/* Apply the SHA-512 compression function to update a..h */
T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] +
(W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0);
T2 = Sigma0_512(a) + Maj(a, b, c);
h = g;
g = f;
f = e;
e = d + T1;
d = c;
c = b;
b = a;
a = T1 + T2;
j++;
} while (j < 80);
/* Compute the current intermediate hash value */
context->state[0] += a;
context->state[1] += b;
context->state[2] += c;
context->state[3] += d;
context->state[4] += e;
context->state[5] += f;
context->state[6] += g;
context->state[7] += h;
/* Clean up */
a = b = c = d = e = f = g = h = T1 = T2 = 0;
}
#endif /* SHA2_UNROLL_TRANSFORM */
void SHA2ext::SHA512_Update(HL_SHA512_CTX* context, const sha2_byte *data, unsigned int len) {
unsigned int freespace, usedspace;
if (len == 0) {
/* Calling with no data is valid - we do nothing */
return;
}
/* Sanity check: */
assert(context != (HL_SHA512_CTX*)0 && data != (sha2_byte*)0);
usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
if (usedspace > 0) {
/* Calculate how much free space is available in the buffer */
freespace = SHA512_BLOCK_LENGTH - usedspace;
if (len >= freespace) {
/* Fill the buffer completely and process it */
MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace);
ADDINC128(context->bitcount, freespace << 3);
len -= freespace;
data += freespace;
SHA512_Transform(context, (sha2_word64*)context->buffer);
} else {
/* The buffer is not yet full */
MEMCPY_BCOPY(&context->buffer[usedspace], data, len);
ADDINC128(context->bitcount, len << 3);
/* Clean up: */
usedspace = freespace = 0;
return;
}
}
while (len >= SHA512_BLOCK_LENGTH) {
/* Process as many complete blocks as we can */
SHA512_Transform(context, (sha2_word64*)data);
ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3);
len -= SHA512_BLOCK_LENGTH;
data += SHA512_BLOCK_LENGTH;
}
if (len > 0) {
/* There's left-overs, so save 'em */
MEMCPY_BCOPY(context->buffer, data, len);
ADDINC128(context->bitcount, len << 3);
}
/* Clean up: */
usedspace = freespace = 0;
}
void SHA2ext::SHA512_Last(HL_SHA512_CTX* context)
{
unsigned int usedspace;
usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
#if BYTE_ORDER == LITTLE_ENDIAN
/* Convert FROM host byte order */
REVERSE64(context->bitcount[0],context->bitcount[0]);
REVERSE64(context->bitcount[1],context->bitcount[1]);
#endif
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace++] = 0x80;
if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
MEMSET_BZERO(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace < SHA512_BLOCK_LENGTH) {
MEMSET_BZERO(&context->buffer[usedspace], SHA512_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA512_Transform(context, (sha2_word64*)context->buffer);
/* And set-up for the last transform: */
MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH - 2);
}
} else {
/* Prepare for final transform: */
MEMSET_BZERO(context->buffer, SHA512_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Store the length of input data (in bits): */
*(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
*(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
/* Final transform: */
SHA512_Transform(context, (sha2_word64*)context->buffer);
}
void SHA2ext::SHA512_Final(sha2_byte digest[], HL_SHA512_CTX* context)
{
sha2_word64 *d = (sha2_word64*)digest;
/* Sanity check: */
assert(context != (HL_SHA512_CTX*)0);
/* If no digest buffer is passed, we don't bother doing this: */
if (digest != (sha2_byte*)0) {
SHA512_Last(context);
/* Save the hash data for output: */
#if BYTE_ORDER == LITTLE_ENDIAN
{
/* Convert TO host byte order */
int j;
for (j = 0; j < 8; j++) {
REVERSE64(context->state[j],context->state[j]);
*d++ = context->state[j];
}
}
#else
MEMCPY_BCOPY(d, context->state, SHA512_DIGEST_LENGTH);
#endif
}
/* Zero out state data */
MEMSET_BZERO(context, sizeof(context));
}
char* SHA2ext::SHA512_End(HL_SHA512_CTX* context, char buffer[])
{
sha2_byte digest[SHA512_DIGEST_LENGTH], *d = digest;
int i;
/* Sanity check: */
assert(context != (HL_SHA512_CTX*)0);
if (buffer != (char*)0) {
SHA512_Final(digest, context);
for (i = 0; i < SHA512_DIGEST_LENGTH; i++) {
*buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
*buffer++ = sha2_hex_digits[*d & 0x0f];
d++;
}
*buffer = (char)0;
} else {
MEMSET_BZERO(context, sizeof(context));
}
MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH);
return buffer;
}
void SHA2ext::SHA384_Init(HL_SHA_384_CTX* context)
{
if (context == (HL_SHA_384_CTX*)0) {
return;
}
MEMCPY_BCOPY(context->state, sha384_initial_hash_value, SHA512_DIGEST_LENGTH);
MEMSET_BZERO(context->buffer, SHA384_BLOCK_LENGTH);
context->bitcount[0] = context->bitcount[1] = 0;
}
void SHA2ext::SHA384_Update(HL_SHA_384_CTX* context, const sha2_byte* data, unsigned int len)
{
SHA512_Update((HL_SHA512_CTX*)context, data, len);
}
void SHA2ext::SHA384_Final(sha2_byte digest[], HL_SHA_384_CTX* context)
{
sha2_word64 *d = (sha2_word64*)digest;
/* Sanity check: */
assert(context != (HL_SHA_384_CTX*)0);
/* If no digest buffer is passed, we don't bother doing this: */
if (digest != (sha2_byte*)0) {
SHA512_Last((HL_SHA512_CTX*)context);
/* Save the hash data for output: */
#if BYTE_ORDER == LITTLE_ENDIAN
{
/* Convert TO host byte order */
int j;
for (j = 0; j < 6; j++) {
REVERSE64(context->state[j],context->state[j]);
*d++ = context->state[j];
}
}
#else
MEMCPY_BCOPY(d, context->state, SHA384_DIGEST_LENGTH);
#endif
}
/* Zero out state data */
MEMSET_BZERO(context, sizeof(context));
}
char* SHA2ext::SHA384_End(HL_SHA_384_CTX* context, char buffer[])
{
sha2_byte digest[SHA384_DIGEST_LENGTH], *d = digest;
int i;
/* Sanity check: */
assert(context != (HL_SHA_384_CTX*)0);
if (buffer != (char*)0) {
SHA384_Final(digest, context);
for (i = 0; i < SHA384_DIGEST_LENGTH; i++) {
*buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
*buffer++ = sha2_hex_digits[*d & 0x0f];
d++;
}
*buffer = (char)0;
} else {
MEMSET_BZERO(context, sizeof(context));
}
MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH);
return buffer;
}
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_sha2ext.h.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/*
* The hashlib++ SHA384 and SHA512 implementations are derivative from the
* sourcecode published by Aaron D. Gifford
*
* Copyright (c) 2000-2001, Aaron D. Gifford
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the copyright holder nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``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 AUTHOR OR CONTRIBUTOR(S) 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.
*/
//----------------------------------------------------------------------
/**
* @file hl_sha2ext.h
* @brief This file contains the declaration of the SHA384 and
* SHA512 classes
* @date Mo 12 Nov 2007
*/
//----------------------------------------------------------------------
//include protection
#ifndef SHA2ext_H
#define SHA2ext_H
//----------------------------------------------------------------------
//lenght defines
#define SHA384_BLOCK_LENGTH 128
#define SHA384_DIGEST_LENGTH 48
#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1)
#define SHA512_BLOCK_LENGTH 128
#define SHA512_DIGEST_LENGTH 64
#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
#define SHA512_SHORT_BLOCK_LENGTH (SHA512_BLOCK_LENGTH - 16)
//----------------------------------------------------------------------
//hl includes
#include "hl_types.h"
//----------------------------------------------------------------------
//typedefs
/**
* Exactly 1 byte
*/
typedef hl_uint8 sha2_byte;
/**
* Exactly 4 bytes
*/
typedef hl_uint32 sha2_word32;
/**
* Exactly 8 bytes
*/
typedef hl_uint64 sha2_word64;
/**
* @brief This struct represents a SHA512-hash context
*/
typedef struct HL_SHA512_CTX
{
hl_uint64 state[8];
hl_uint64 bitcount[2];
hl_uint8 buffer[SHA512_BLOCK_LENGTH];
} HL_SHA512_CTX;
/**
* @brief This struct represents a SHA384-hash context
*/
typedef HL_SHA512_CTX HL_SHA_384_CTX;
//----------------------------------------------------------------------
/**
* @brief This class represents the implementation of
* the SHA384 and SHA512 algorithm.
*
* Basically the class provides six public member-functions
* to create a hash: SHA384_Init(), SHA384_Update(), SHA384_End(),
* SHA512_Init(), SHA512_Update() and SHA512_End().
* If you want to create a hash based on a string or file quickly
* you should use the sha384wrapper or sha512wrapper classes.
*/
class SHA2ext
{
private:
/**
* @brief Finalize the sha384 operation
* @param digest The digest to finalize the operation with.
* @param context The context to finalize.
*/
void SHA384_Final(hl_uint8 digest[SHA384_DIGEST_LENGTH],
HL_SHA_384_CTX* context);
/**
* @brief Finalize the sha512 operation
* @param digest The digest to finalize the operation with.
* @param context The context to finalize.
*/
void SHA512_Final(hl_uint8 digest[SHA512_DIGEST_LENGTH],
HL_SHA512_CTX* context);
/**
* @brief Internal method
*
* used by SHA512 and SHA384
* @author Benjamin Grdelbach
* @param context The context of the operation
*/
void SHA512_Last(HL_SHA512_CTX* context);
/**
* @brief Internal data transformation
* @param context The context to use
* @param data The data to transform
*/
void SHA512_Transform(HL_SHA512_CTX* context,
const sha2_word64* data);
public:
/**
* @brief Initialize the SHA384 context
* @param context The context to init.
*/
void SHA384_Init(HL_SHA_384_CTX* context);
/**
* @brief Initialize the SHA512 context
* @param context The context to init.
*/
void SHA512_Init(HL_SHA512_CTX* context);
/**
* @brief Updates the SHA512 context
* @param context The context to update.
* @param data The data for updating the context.
* @param len The length of the given data.
*/
void SHA384_Update(HL_SHA_384_CTX* context,
const hl_uint8* data,
unsigned int len);
/**
* @brief Updates the SHA284 context
* @param context The context to update.
* @param data The data for updating the context.
* @param len The length of the given data.
*/
void SHA512_Update(HL_SHA512_CTX* context,
const hl_uint8* data,
unsigned int len);
/**
* @brief Ends the SHA384 operation and return the
* created hash in the given buffer.
* @param context The context to end.
* @param buffer This OUT-Parameter contains the created
* hash after ending the operation.
*/
char* SHA384_End(HL_SHA_384_CTX* context,
char buffer[SHA384_DIGEST_STRING_LENGTH]);
/**
* @brief Ends the SHA512 operation and return the
* created hash in the given buffer.
* @param context The context to end.
* @param buffer This OUT-Parameter contains the created
* hash after ending the operation.
*/
char* SHA512_End(HL_SHA512_CTX* context,
char buffer[SHA512_DIGEST_STRING_LENGTH]);
};
//----------------------------------------------------------------------
//end of include protection
#endif
//----------------------------------------------------------------------
//EOF
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_sha2mac.h.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/*
* The hashlib++ SHA384 and SHA512 implementations are derivative from
* the sourcecode published by Aaron D. Gifford
*
* Copyright (c) 2000-2001, Aaron D. Gifford
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the copyright holder nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``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 AUTHOR OR CONTRIBUTOR(S) 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.
*
*/
//----------------------------------------------------------------------
/**
* @file hl_sha2mac.h
* @brief This file contains useful macros for use with SHA384
* and SHA512
* @date Mo 12 Nov 2007
*/
//----------------------------------------------------------------------
/*
* SHA-256/384/512 Machine Architecture Definitions
* BYTE_ORDER NOTE:
*
* Please make sure that your system defines BYTE_ORDER. If your
* architecture is little-endian, make sure it also defines
* LITTLE_ENDIAN and that the two (BYTE_ORDER and LITTLE_ENDIAN) are
* equivilent.
*
* If your system does not define the above, then you can do so by
* hand like this:
*
* #define LITTLE_ENDIAN 1234
* #define BIG_ENDIAN 4321
*
* And for little-endian machines, add:
*
* #define BYTE_ORDER LITTLE_ENDIAN
*
* Or for big-endian machines:
*
* #define BYTE_ORDER BIG_ENDIAN
*
* The FreeBSD machine this was written on defines
* BYTE_ORDER appropriately by including <sys/types.h>
* (which in turn includes <machine/endian.h> where the appropriate
* definitions are actually made).
*/
#define LITTLE_ENDIAN 1234
#define BYTE_ORDER LITTLE_ENDIAN
#if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN)
#error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN
#endif
/*** ENDIAN REVERSAL MACROS *******************************************/
#if BYTE_ORDER == LITTLE_ENDIAN
#define REVERSE32(w,x) { \
sha2_word32 tmp = (w); \
tmp = (tmp >> 16) | (tmp << 16); \
(x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \
}
#define REVERSE64(w,x) { \
sha2_word64 tmp = (w); \
tmp = (tmp >> 32) | (tmp << 32); \
tmp = ((tmp & 0xff00ff00ff00ff00ULL) >> 8) | \
((tmp & 0x00ff00ff00ff00ffULL) << 8); \
(x) = ((tmp & 0xffff0000ffff0000ULL) >> 16) | \
((tmp & 0x0000ffff0000ffffULL) << 16); \
}
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
/*
* Macro for incrementally adding the unsigned 64-bit integer n to the
* unsigned 128-bit integer (represented using a two-element array of
* 64-bit words):
*/
#define ADDINC128(w,n) { \
(w)[0] += (sha2_word64)(n); \
if ((w)[0] < (n)) { \
(w)[1]++; \
} \
}
/*
* Macros for copying blocks of memory and for zeroing out ranges
* of memory. Using these macros makes it easy to switch from
* using memset()/memcpy() and using bzero()/bcopy().
*
* Please define either SHA2_USE_MEMSET_MEMCPY or define
* SHA2_USE_BZERO_BCOPY depending on which function set you
* choose to use:
*/
#if !defined(SHA2_USE_MEMSET_MEMCPY) && !defined(SHA2_USE_BZERO_BCOPY)
/* Default to memset()/memcpy() if no option is specified */
#define SHA2_USE_MEMSET_MEMCPY 1
#endif
#if defined(SHA2_USE_MEMSET_MEMCPY) && defined(SHA2_USE_BZERO_BCOPY)
/* Abort with an error if BOTH options are defined */
#error Define either SHA2_USE_MEMSET_MEMCPY or SHA2_USE_BZERO_BCOPY, not both!
#endif
#ifdef SHA2_USE_MEMSET_MEMCPY
#define MEMSET_BZERO(p,l) memset((p), 0, (l))
#define MEMCPY_BCOPY(d,s,l) memcpy((d), (s), (l))
#endif
#ifdef SHA2_USE_BZERO_BCOPY
#define MEMSET_BZERO(p,l) bzero((p), (l))
#define MEMCPY_BCOPY(d,s,l) bcopy((s), (d), (l))
#endif
/*** THE SIX LOGICAL FUNCTIONS ****************************************
*
* Bit shifting and rotation (used by the six SHA-XYZ logical functions:
*
* NOTE: The naming of R and S appears backwards here (R is a SHIFT and
* S is a ROTATION) because the SHA-256/384/512 description document
* (see http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf) uses this
* same "backwards" definition.
*/
/* Shift-right (used in SHA-256, SHA-384, and SHA-512): */
#define R(b,x) ((x) >> (b))
/* 32-bit Rotate-right (used in SHA-256): */
#define S32(b,x) (((x) >> (b)) | ((x) << (32 - (b))))
/* 64-bit Rotate-right (used in SHA-384 and SHA-512): */
#define S64(b,x) (((x) >> (b)) | ((x) << (64 - (b))))
/* Two of six logical functions used in SHA-256, SHA-384, and SHA-512: */
#define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z)))
#define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
/* Four of six logical functions used in SHA-256: */
#define Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x)))
#define Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x)))
#define sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x)))
#define sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x)))
/* Four of six logical functions used in SHA-384 and SHA-512: */
#define Sigma0_512(x) (S64(28, (x)) ^ S64(34, (x)) ^ S64(39, (x)))
#define Sigma1_512(x) (S64(14, (x)) ^ S64(18, (x)) ^ S64(41, (x)))
#define sigma0_512(x) (S64( 1, (x)) ^ S64( 8, (x)) ^ R( 7, (x)))
#define sigma1_512(x) (S64(19, (x)) ^ S64(61, (x)) ^ R( 6, (x)))
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_sha384wrapper.cpp.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/**
* @file hl_sha384wrapper.cpp
* @brief This file contains the implementation of the sha384wrapper
* class.
* @date Mo 12 Nov 2007
*/
//----------------------------------------------------------------------
//hashlib++ includes
#include "hl_sha384wrapper.h"
//----------------------------------------------------------------------
//STL includes
#include <string>
//----------------------------------------------------------------------
//private memberfunctions
/**
* @brief This method ends the hash process
* and returns the hash as string.
*
* @return a hash as std::string
*/
std::string sha384wrapper::hashIt(void)
{
sha2_byte buff[SHA384_DIGEST_STRING_LENGTH];
sha384->SHA384_End(&context,(char*)buff);
return convToString(buff);
}
/**
* @brief This internal member-function
* convertes the hash-data to a
* std::string (HEX).
*
* @param data The hash-data to covert into HEX
* @return the converted data as std::string
*/
std::string sha384wrapper::convToString(unsigned char *data)
{
/*
* we can just copy data to a string, because
* the transforming to hash is already done
* within the sha384 implementation
*/
return std::string((const char*)data);
}
/**
* @brief This method adds the given data to the
* current hash context
*
* @param data The data to add to the current context
* @param len The length of the data to add
*/
void sha384wrapper::updateContext(unsigned char *data, unsigned int len)
{
this->sha384->SHA384_Update(&context,data,len);
}
/**
* @brief This method resets the current hash context.
* In other words: It starts a new hash process.
*/
void sha384wrapper::resetContext(void)
{
sha384->SHA384_Init(&context);
}
/**
* @brief This method should return the hash of the
* test-string "The quick brown fox jumps over the lazy
* dog"
*/
std::string sha384wrapper::getTestHash(void)
{
return "ca737f1014a48f4c0b6dd43cb177b0afd9e5169367544c494011e3317dbf9a509cb1e5dc1e85a941bbee3d7f2afbc9b1";
}
//----------------------------------------------------------------------
//public memberfunctions
/**
* @brief default constructor
*/
sha384wrapper::sha384wrapper()
{
this->sha384 = new SHA2ext();
}
/**
* @brief default destructor
*/
sha384wrapper::~sha384wrapper()
{
delete sha384;
}
================================================
FILE: _draft/flash_cpp/hashlib/.svn/text-base/hl_sha384wrapper.h.svn-base
================================================
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) 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.
*
* 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 OWNER 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.
*/
//----------------------------------------------------------------------
/**
* @file hl_sha384wrapper.h
* @brief This file contains the definition of the sha384wrapper
* class.
* @date Mo 12 Nov 2007
*/
//----------------------------------------------------------------------
//include protection
#ifndef SHA384WRAPPER_H
#define SHA384WRAPPER_H
//----------------------------------------------------------------------
//hashlib++ includes
#include "hl_hashwrapper.h"
#include "hl_sha2ext.h"
//----------------------------------------------------------------------
//STL
#include <string>
//----------------------------------------------------------------------
/**
* @brief This class represents the SHA384 wrapper-class
*
* You can use this class to easily create a sha384 hash.
* Just create an instance of sha384wrapper and call the
* inherited memberfunctions getHashFromString()
* and getHashFromFile() to create a hash based on a
* string or a file.
*
* Have a look at the following example:
*
* @include sha384example.cpp
*
* sha384wrapper implements resetContext(), updateContext()
* and hashIt() to create a hash.
*/
class sha384wrapper : public hashwrapper
{
private:
/**
* SHA384 access
* via extended SHA2
*/
SHA2ext *sha384;
/**
* SHA384 context
*/
HL_SHA_384_CTX context;
/**
* @brief This method ends the hash process
* and returns the hash as string.
*
* @return a hash as std::string
*/
virtual std::string hashIt(void);
/**
* @brief This internal member-function
* convertes the hash-data to a
* std::string (HEX).
*
* @param data The hash-data to covert into HEX
* @return the converted data as std::
gitextract_4gxwg5qi/
├── .gitignore
├── .jshintrc
├── .travis.yml
├── Gruntfile.js
├── LICENSE
├── README.md
├── _draft/
│ ├── demo.html
│ ├── demo.js
│ ├── demo2.html
│ ├── demo2.js
│ ├── flash_cpp/
│ │ ├── Test.swc
│ │ ├── as3api.cpp
│ │ ├── exports.txt
│ │ ├── hashlib/
│ │ │ ├── .hashlibpp.h.swp
│ │ │ ├── .svn/
│ │ │ │ ├── all-wcprops
│ │ │ │ ├── entries
│ │ │ │ └── text-base/
│ │ │ │ ├── Makefile.svn-base
│ │ │ │ ├── hashlibpp.h.svn-base
│ │ │ │ ├── hl_exception.h.svn-base
│ │ │ │ ├── hl_hashwrapper.h.svn-base
│ │ │ │ ├── hl_md5.cpp.svn-base
│ │ │ │ ├── hl_md5.h.svn-base
│ │ │ │ ├── hl_md5wrapper.cpp.svn-base
│ │ │ │ ├── hl_md5wrapper.h.svn-base
│ │ │ │ ├── hl_sha1.cpp.svn-base
│ │ │ │ ├── hl_sha1.h.svn-base
│ │ │ │ ├── hl_sha1wrapper.cpp.svn-base
│ │ │ │ ├── hl_sha1wrapper.h.svn-base
│ │ │ │ ├── hl_sha256.cpp.svn-base
│ │ │ │ ├── hl_sha256.h.svn-base
│ │ │ │ ├── hl_sha256wrapper.cpp.svn-base
│ │ │ │ ├── hl_sha256wrapper.h.svn-base
│ │ │ │ ├── hl_sha2ext.cpp.svn-base
│ │ │ │ ├── hl_sha2ext.h.svn-base
│ │ │ │ ├── hl_sha2mac.h.svn-base
│ │ │ │ ├── hl_sha384wrapper.cpp.svn-base
│ │ │ │ ├── hl_sha384wrapper.h.svn-base
│ │ │ │ ├── hl_sha512wrapper.cpp.svn-base
│ │ │ │ ├── hl_sha512wrapper.h.svn-base
│ │ │ │ ├── hl_types.h.svn-base
│ │ │ │ ├── hl_wrapperfactory.cpp.svn-base
│ │ │ │ └── hl_wrapperfactory.h.svn-base
│ │ │ ├── Makefile
│ │ │ ├── hashlibpp.h
│ │ │ ├── hl_exception.h
│ │ │ ├── hl_hashwrapper.h
│ │ │ ├── hl_md5.cpp
│ │ │ ├── hl_md5.h
│ │ │ ├── hl_md5wrapper.cpp
│ │ │ ├── hl_md5wrapper.h
│ │ │ ├── hl_sha1.cpp
│ │ │ ├── hl_sha1.h
│ │ │ ├── hl_sha1wrapper.cpp
│ │ │ ├── hl_sha1wrapper.h
│ │ │ ├── hl_sha256.cpp
│ │ │ ├── hl_sha256.h
│ │ │ ├── hl_sha256wrapper.cpp
│ │ │ ├── hl_sha256wrapper.h
│ │ │ ├── hl_sha2ext.cpp
│ │ │ ├── hl_sha2ext.h
│ │ │ ├── hl_sha2mac.h
│ │ │ ├── hl_sha384wrapper.cpp
│ │ │ ├── hl_sha384wrapper.h
│ │ │ ├── hl_sha512wrapper.cpp
│ │ │ ├── hl_sha512wrapper.h
│ │ │ ├── hl_types.h
│ │ │ ├── hl_wrapperfactory.cpp
│ │ │ └── hl_wrapperfactory.h
│ │ ├── main.cpp
│ │ └── makefile
│ ├── hashFile.js
│ ├── md5.js
│ ├── md5File.js
│ └── music/
│ ├── index.html
│ ├── jquery.js
│ ├── md5.js
│ ├── server/
│ │ └── fileupload.php
│ ├── style.css
│ ├── upload.js
│ └── webuploader.js
├── bower.json
├── build/
│ ├── docTpl/
│ │ ├── class.ejs
│ │ ├── content.ejs
│ │ ├── css/
│ │ │ └── doc.css
│ │ ├── events.ejs
│ │ ├── items.ejs
│ │ ├── layout.ejs
│ │ ├── module.ejs
│ │ ├── options.ejs
│ │ ├── plugins.ejs
│ │ └── sidebar.ejs
│ ├── fis/
│ │ ├── intro.js
│ │ └── outro.js
│ ├── intro.js
│ ├── outro.js
│ └── tasks/
│ ├── build.js
│ ├── concat.js
│ └── doc.js
├── css/
│ └── webuploader.css
├── dist/
│ ├── README.md
│ ├── Uploader.swf
│ ├── webuploader.css
│ ├── webuploader.custom.js
│ ├── webuploader.fis.js
│ ├── webuploader.flashonly.js
│ ├── webuploader.html5nodepend.js
│ ├── webuploader.html5only.js
│ ├── webuploader.js
│ ├── webuploader.noimage.js
│ ├── webuploader.nolog.js
│ └── webuploader.withoutimage.js
├── examples/
│ ├── cropper/
│ │ ├── cropper.css
│ │ ├── cropper.js
│ │ ├── index.html
│ │ ├── jquery.js
│ │ ├── style.css
│ │ └── uploader.js
│ ├── image-upload/
│ │ ├── expressInstall.swf
│ │ ├── icons.psd
│ │ ├── index.html
│ │ ├── jquery.js
│ │ ├── progress.psd
│ │ ├── style.css
│ │ └── upload.js
│ ├── md5-demo/
│ │ ├── index.html
│ │ └── script.js
│ └── requirejs/
│ ├── app.js
│ ├── index.html
│ └── require.js
├── flash/
│ ├── .actionScriptProperties
│ ├── .project
│ ├── .settings/
│ │ └── org.eclipse.core.resources.prefs
│ ├── Uploader.iml
│ ├── lib/
│ │ ├── Test.swc
│ │ ├── as3corelib.swc
│ │ ├── lib.swc
│ │ └── stringecho.swc
│ ├── lib.fla
│ └── src/
│ ├── ComponentFactory.as
│ ├── Uploader.as
│ └── com/
│ ├── Blob.as
│ ├── File.as
│ ├── FilePicker.as
│ ├── FileReader.as
│ ├── FileReaderSync.as
│ ├── Image.as
│ ├── Md5.as
│ ├── XMLHttpRequest.as
│ ├── errors/
│ │ ├── DOMError.as
│ │ ├── ImageError.as
│ │ └── RuntimeError.as
│ ├── events/
│ │ ├── FilePickerEvent.as
│ │ ├── ImageEvent.as
│ │ ├── ODataEvent.as
│ │ ├── OErrorEvent.as
│ │ ├── OProgressEvent.as
│ │ └── URLStreamProgressEvent.as
│ ├── image/
│ │ ├── BMP.as
│ │ ├── ExifParser.as
│ │ ├── GIF.as
│ │ ├── ImageEditor.as
│ │ ├── JPEG.as
│ │ ├── JPEGEncoder.as
│ │ ├── PNG.as
│ │ ├── ascb/
│ │ │ └── filters/
│ │ │ ├── ColorMatrixArrays.as
│ │ │ └── ConvolutionMatrixArrays.as
│ │ ├── events/
│ │ │ └── ExifParserEvent.as
│ │ └── formatlos/
│ │ ├── BitmapDataUnlimited.as
│ │ ├── Gif.as
│ │ └── events/
│ │ └── BitmapDataUnlimitedEvent.as
│ └── utils/
│ ├── BMPDecoder.as
│ ├── Base64.as
│ ├── BinaryReader.as
│ ├── Buffer.as
│ ├── OEventDispatcher.as
│ ├── URLStreamProgress.as
│ ├── Utils.as
│ └── Zhenpin.as
├── jekyll/
│ ├── _config.yml
│ ├── _includes/
│ │ ├── comments.html
│ │ ├── footer.html
│ │ └── header.html
│ ├── _layouts/
│ │ ├── default.html
│ │ └── post.html
│ ├── _plugins/
│ │ └── fancytoc.rb
│ ├── css/
│ │ ├── bootstrap-theme.css
│ │ ├── bootstrap.css
│ │ ├── demo.css
│ │ ├── font-awesome.css
│ │ ├── style.css
│ │ ├── syntax.css
│ │ └── webuploader.css
│ ├── demo.md
│ ├── doc/
│ │ ├── css/
│ │ │ └── doc.css
│ │ └── index.html
│ ├── document.md
│ ├── download.md
│ ├── fonts/
│ │ └── FontAwesome.otf
│ ├── getting-started.md
│ ├── images/
│ │ └── logo.psd
│ ├── index.md
│ └── js/
│ ├── Uploader.swf
│ ├── bootstrap.js
│ ├── demo.js
│ ├── getting-started.js
│ ├── global.js
│ └── webuploader.js
├── package.json
├── server/
│ ├── crossdomain.xml
│ ├── fileupload.php
│ ├── fileupload2.php
│ └── preview.php
├── src/
│ ├── base.js
│ ├── dollar-builtin.js
│ ├── dollar-third.js
│ ├── dollar.js
│ ├── file.js
│ ├── lib/
│ │ ├── blob.js
│ │ ├── dnd.js
│ │ ├── file.js
│ │ ├── filepaste.js
│ │ ├── filepicker.js
│ │ ├── image.js
│ │ ├── md5.js
│ │ └── transport.js
│ ├── mediator.js
│ ├── preset/
│ │ ├── all.js
│ │ ├── flashonly.js
│ │ ├── html5only.js
│ │ └── withoutimage.js
│ ├── promise-builtin.js
│ ├── promise-third.js
│ ├── promise.js
│ ├── queue.js
│ ├── runtime/
│ │ ├── client.js
│ │ ├── compbase.js
│ │ ├── flash/
│ │ │ ├── blob.js
│ │ │ ├── filepicker.js
│ │ │ ├── image.js
│ │ │ ├── md5.js
│ │ │ ├── runtime.js
│ │ │ └── transport.js
│ │ ├── html5/
│ │ │ ├── androidpatch.js
│ │ │ ├── blob.js
│ │ │ ├── dnd.js
│ │ │ ├── filepaste.js
│ │ │ ├── filepicker.js
│ │ │ ├── image.js
│ │ │ ├── imagemeta/
│ │ │ │ └── exif.js
│ │ │ ├── imagemeta.js
│ │ │ ├── jpegencoder.js
│ │ │ ├── md5.js
│ │ │ ├── runtime.js
│ │ │ ├── transport.js
│ │ │ └── util.js
│ │ └── runtime.js
│ ├── uploader.js
│ ├── webuploader.js
│ └── widgets/
│ ├── filednd.js
│ ├── filepaste.js
│ ├── filepicker.js
│ ├── image.js
│ ├── log.js
│ ├── md5.js
│ ├── queue.js
│ ├── runtime.js
│ ├── upload.js
│ ├── validator.js
│ └── widget.js
└── test/
├── Qunit/
│ ├── qunit-1.14.0.css
│ └── qunit-1.14.0.js
├── index.html
├── require.js
├── testDesign/
│ └── webuploader.xmind
└── units/
├── base.js
└── filepicker.js
SYMBOL INDEX (716 symbols across 74 files)
FILE: _draft/demo.js
function addFile (line 62) | function addFile( file ) {
function removeFile (line 171) | function removeFile( file ) {
function updateTotalProgress (line 179) | function updateTotalProgress() {
function updateStatus (line 197) | function updateStatus() {
function setState (line 224) | function setState( val ) {
FILE: _draft/demo2.js
function addFile (line 62) | function addFile( file ) {
function removeFile (line 171) | function removeFile( file ) {
function updateTotalProgress (line 179) | function updateTotalProgress() {
function updateStatus (line 197) | function updateStatus() {
function setState (line 224) | function setState( val ) {
FILE: _draft/flash_cpp/as3api.cpp
function md5String (line 24) | void md5String(){
FILE: _draft/flash_cpp/hashlib/hl_exception.h
type hlerror (line 52) | typedef enum hlerrors
function class (line 67) | class hlException
function hlerror (line 117) | hlerror error_number(void)
FILE: _draft/flash_cpp/hashlib/hl_hashwrapper.h
function class (line 106) | class hashwrapper
FILE: _draft/flash_cpp/hashlib/hl_md5.h
type hl_uint8 (line 80) | typedef hl_uint8 *POINTER;
type HL_MD5_CTX (line 85) | typedef struct
function class (line 108) | class MD5
FILE: _draft/flash_cpp/hashlib/hl_md5wrapper.h
function class (line 70) | class md5wrapper : public hashwrapper
FILE: _draft/flash_cpp/hashlib/hl_sha1.h
type HL_SHA1_CTX (line 103) | typedef struct HL_SHA1_CTX
function class (line 140) | class SHA1
FILE: _draft/flash_cpp/hashlib/hl_sha1wrapper.h
function class (line 66) | class sha1wrapper : public hashwrapper
FILE: _draft/flash_cpp/hashlib/hl_sha256.h
type hl_uint8 (line 93) | typedef hl_uint8 sha2_byte;
type hl_uint32 (line 98) | typedef hl_uint32 sha2_word32;
type hl_uint64 (line 103) | typedef hl_uint64 sha2_word64;
type HL_SHA256_CTX (line 108) | typedef struct HL_SHA256_CTX
function class (line 137) | class SHA256
FILE: _draft/flash_cpp/hashlib/hl_sha256wrapper.h
function class (line 71) | class sha256wrapper : public hashwrapper
FILE: _draft/flash_cpp/hashlib/hl_sha2ext.h
type hl_uint8 (line 97) | typedef hl_uint8 sha2_byte;
type hl_uint32 (line 102) | typedef hl_uint32 sha2_word32;
type hl_uint64 (line 107) | typedef hl_uint64 sha2_word64;
type HL_SHA512_CTX (line 112) | typedef struct HL_SHA512_CTX
type HL_SHA512_CTX (line 123) | typedef HL_SHA512_CTX HL_SHA_384_CTX;
function class (line 137) | class SHA2ext
FILE: _draft/flash_cpp/hashlib/hl_sha384wrapper.h
function class (line 70) | class sha384wrapper : public hashwrapper
FILE: _draft/flash_cpp/hashlib/hl_sha512wrapper.h
function class (line 70) | class sha512wrapper : public hashwrapper
FILE: _draft/flash_cpp/hashlib/hl_types.h
type hl_uint8 (line 47) | typedef unsigned char hl_uint8;
type hl_uint16 (line 52) | typedef unsigned short int hl_uint16;
type hl_uint32 (line 57) | typedef unsigned int hl_uint32;
type hl_uint64 (line 63) | typedef unsigned long long int hl_uint64;
type hl_uint64 (line 65) | typedef unsigned long long int hl_uint64;
type hl_uint64 (line 67) | typedef unsigned __int64 hl_uint64;
FILE: _draft/flash_cpp/hashlib/hl_wrapperfactory.cpp
function hashwrapper (line 54) | hashwrapper* wrapperfactory::create(HL_Wrappertype type)
function hashwrapper (line 86) | hashwrapper* wrapperfactory::create(std::string type)
FILE: _draft/flash_cpp/hashlib/hl_wrapperfactory.h
type HL_Wrappertype (line 52) | enum HL_Wrappertype { HL_MD5, HL_SHA1, HL_SHA256, HL_SHA384, HL_SHA512 }
function class (line 62) | class wrapperfactory
FILE: _draft/flash_cpp/main.cpp
function main (line 5) | int main() {
FILE: _draft/md5.js
function md5cycle (line 2) | function md5cycle(x, k) {
function cmn (line 83) | function cmn(q, a, b, x, s, t) {
function ff (line 88) | function ff(a, b, c, d, x, s, t) {
function gg (line 92) | function gg(a, b, c, d, x, s, t) {
function hh (line 96) | function hh(a, b, c, d, x, s, t) {
function ii (line 100) | function ii(a, b, c, d, x, s, t) {
function md51 (line 104) | function md51(s) {
function md5blk (line 142) | function md5blk(s) { /* I figured global was faster. */
function rhex (line 153) | function rhex(n) {
function hex (line 161) | function hex(x) {
function md5 (line 167) | function md5(s) {
FILE: _draft/music/jquery.js
function M (line 2) | function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.n...
function F (line 2) | function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t...
function P (line 2) | function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==...
function R (line 2) | function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache...
function W (line 2) | function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-...
function $ (line 2) | function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&...
function it (line 2) | function it(){return!0}
function ot (line 2) | function ot(){return!1}
function rt (line 3) | function rt(e){return Y.test(e+"")}
function it (line 3) | function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i....
function ot (line 3) | function ot(e){return e[x]=!0,e}
function at (line 3) | function at(e){var t=p.createElement("div");try{return e(t)}catch(n){ret...
function st (line 3) | function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)...
function ut (line 3) | function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j)...
function lt (line 3) | function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"...
function ct (line 3) | function ct(e){return function(t){var n=t.nodeName.toLowerCase();return(...
function pt (line 3) | function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,...
function ft (line 3) | function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0)...
function dt (line 3) | function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}
function ht (line 3) | function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.firs...
function gt (line 3) | function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i-...
function mt (line 3) | function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)...
function yt (line 3) | function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)...
function vt (line 3) | function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relat...
function bt (line 3) | function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d)...
function xt (line 3) | function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}
function wt (line 3) | function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0...
function Tt (line 3) | function Tt(){}
function pt (line 3) | function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}
function ft (line 3) | function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,...
function dt (line 3) | function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.cre...
function Lt (line 3) | function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ow...
function Ht (line 3) | function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.spec...
function qt (line 3) | function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttrib...
function Mt (line 3) | function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval...
function _t (line 3) | function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e)...
function Ft (line 3) | function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCas...
function Ot (line 3) | function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getEl...
function Bt (line 3) | function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}
function tn (line 4) | function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.sl...
function nn (line 4) | function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(...
function rn (line 4) | function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.sty...
function on (line 4) | function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[...
function an (line 4) | function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:...
function sn (line 4) | function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o...
function un (line 4) | function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(...
function ln (line 4) | function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[...
function gn (line 4) | function gn(e,t,n,r){var i;if(b.isArray(t))b.each(t,function(t,i){n||pn....
function Hn (line 4) | function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var ...
function qn (line 4) | function qn(e,n,r,i){var o={},a=e===jn;function s(u){var l;return o[u]=!...
function Mn (line 4) | function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i...
function k (line 4) | function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t...
function _n (line 4) | function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFi...
function Fn (line 4) | function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e....
function In (line 4) | function In(){try{return new e.XMLHttpRequest}catch(t){}}
function zn (line 4) | function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(...
function Kn (line 4) | function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}
function Zn (line 4) | function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]...
function er (line 4) | function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(functio...
function tr (line 4) | function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e...
function nr (line 4) | function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e....
function rr (line 4) | function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}
function ir (line 4) | function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r...
function or (line 4) | function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.pa...
FILE: _draft/music/md5.js
function md5cycle (line 2) | function md5cycle(x, k) {
function cmn (line 83) | function cmn(q, a, b, x, s, t) {
function ff (line 88) | function ff(a, b, c, d, x, s, t) {
function gg (line 92) | function gg(a, b, c, d, x, s, t) {
function hh (line 96) | function hh(a, b, c, d, x, s, t) {
function ii (line 100) | function ii(a, b, c, d, x, s, t) {
function md51 (line 104) | function md51(s) {
function md5blk (line 142) | function md5blk(s) { /* I figured global was faster. */
function rhex (line 153) | function rhex(n) {
function hex (line 161) | function hex(x) {
function md5 (line 167) | function md5(s) {
FILE: _draft/music/upload.js
function addFile (line 56) | function addFile(file) {
function removeFile (line 140) | function removeFile(file) {
function updateTotalProgress (line 148) | function updateTotalProgress() {
function updateStatus (line 166) | function updateStatus() {
function setState (line 194) | function setState(val) {
function readContent (line 350) | function readContent(file, cb) {
function Md5File (line 391) | function Md5File(file, callback) {
FILE: _draft/music/webuploader.js
function uncurryThis (line 113) | function uncurryThis( fn ) {
function bindFn (line 119) | function bindFn( fn, context ) {
function createObject (line 125) | function createObject( proto ) {
function findHandlers (line 442) | function findHandlers( arr, name, callback, context ) {
function eachEvent (line 452) | function eachEvent( events, callback, iterator ) {
function triggerHanders (line 459) | function triggerHanders( events, args ) {
function Uploader (line 669) | function Uploader( opts ) {
function Runtime (line 849) | function Runtime( options ) {
function RuntimeClient (line 979) | function RuntimeClient( component, standalone ) {
function Blob (line 1077) | function Blob( ruid, source ) {
function File (line 1120) | function File( ruid, file ) {
function FilePicker (line 1150) | function FilePicker( opts ) {
function isArrayLike (line 1253) | function isArrayLike( obj ) {
function Widget (line 1270) | function Widget( uploader ) {
function gid (line 1540) | function gid() {
function WUFile (line 1551) | function WUFile( source ) {
function DragAndDrop (line 1722) | function DragAndDrop( opts ) {
function FilePaste (line 1771) | function FilePaste( opts ) {
function Image (line 1811) | function Image( opts ) {
function Transport (line 1905) | function Transport( opts ) {
function Queue (line 2042) | function Queue() {
function CompBase (line 2235) | function CompBase( owner, runtime ) {
function getFlashVersion (line 2270) | function getFlashVersion() {
function FlashRuntime (line 2288) | function FlashRuntime() {
function Html5Runtime (line 2623) | function Html5Runtime() {
function CuteFile (line 4687) | function CuteFile( file, chunkSize ) {
function hashString (line 5392) | function hashString( str ) {
FILE: build/tasks/build.js
function convert (line 12) | function convert( name, _path, contents ) {
FILE: build/tasks/concat.js
function stripBanner (line 14) | function stripBanner(src, options) {
function filesFilter (line 38) | function filesFilter( f, files ) {
function fileProcess (line 108) | function fileProcess( src, filepath, cwd ) {
FILE: dist/webuploader.custom.js
function Callbacks (line 172) | function Callbacks( once ) {
function Deferred (line 261) | function Deferred( func ) {
function uncurryThis (line 516) | function uncurryThis( fn ) {
function bindFn (line 522) | function bindFn( fn, context ) {
function createObject (line 528) | function createObject( proto ) {
function findHandlers (line 817) | function findHandlers( arr, name, callback, context ) {
function eachEvent (line 827) | function eachEvent( events, callback, iterator ) {
function triggerHanders (line 834) | function triggerHanders( events, args ) {
function Uploader (line 1043) | function Uploader( opts ) {
function Runtime (line 1242) | function Runtime( options ) {
function RuntimeClient (line 1374) | function RuntimeClient( component, standalone ) {
function Blob (line 1477) | function Blob( ruid, source ) {
function File (line 1527) | function File( ruid, file ) {
function FilePicker (line 1563) | function FilePicker( opts ) {
function isArrayLike (line 1706) | function isArrayLike( obj ) {
function Widget (line 1723) | function Widget( uploader ) {
function Image (line 2086) | function Image( opts ) {
function gid (line 2496) | function gid() {
function WUFile (line 2507) | function WUFile( source ) {
function Queue (line 2685) | function Queue() {
function Transport (line 3301) | function Transport( opts ) {
function CuteFile (line 3527) | function CuteFile( file, chunkSize ) {
function send (line 4362) | function send(data) {
function CompBase (line 4415) | function CompBase( owner, runtime ) {
function Html5Runtime (line 4447) | function Html5Runtime() {
function detectVerticalSquash (line 5487) | function detectVerticalSquash( img, iw, ih ) {
function detectSubsampling (line 5539) | function detectSubsampling( img ) {
function JPEGEncoder (line 5656) | function JPEGEncoder(quality) {
FILE: dist/webuploader.fis.js
function uncurryThis (line 188) | function uncurryThis( fn ) {
function bindFn (line 194) | function bindFn( fn, context ) {
function createObject (line 200) | function createObject( proto ) {
function findHandlers (line 489) | function findHandlers( arr, name, callback, context ) {
function eachEvent (line 499) | function eachEvent( events, callback, iterator ) {
function triggerHanders (line 506) | function triggerHanders( events, args ) {
function Uploader (line 715) | function Uploader( opts ) {
function Runtime (line 914) | function Runtime( options ) {
function RuntimeClient (line 1046) | function RuntimeClient( component, standalone ) {
function DragAndDrop (line 1152) | function DragAndDrop( opts ) {
function isArrayLike (line 1200) | function isArrayLike( obj ) {
function Widget (line 1217) | function Widget( uploader ) {
function FilePaste (line 1509) | function FilePaste( opts ) {
function Blob (line 1590) | function Blob( ruid, source ) {
function File (line 1640) | function File( ruid, file ) {
function FilePicker (line 1676) | function FilePicker( opts ) {
function Image (line 1960) | function Image( opts ) {
function gid (line 2370) | function gid() {
function WUFile (line 2381) | function WUFile( source ) {
function Queue (line 2559) | function Queue() {
function Transport (line 3175) | function Transport( opts ) {
function CuteFile (line 3401) | function CuteFile( file, chunkSize ) {
function hashString (line 4381) | function hashString( str ) {
function Md5 (line 4434) | function Md5() {
function CompBase (line 4541) | function CompBase( owner, runtime ) {
function Html5Runtime (line 4573) | function Html5Runtime() {
function JPEGEncoder (line 5623) | function JPEGEncoder(quality) {
function detectVerticalSquash (line 6692) | function detectVerticalSquash( img, iw, ih ) {
function detectSubsampling (line 6744) | function detectSubsampling( img ) {
function getFlashVersion (line 7658) | function getFlashVersion() {
function FlashRuntime (line 7676) | function FlashRuntime() {
function send (line 8160) | function send(data) {
FILE: dist/webuploader.flashonly.js
function uncurryThis (line 213) | function uncurryThis( fn ) {
function bindFn (line 219) | function bindFn( fn, context ) {
function createObject (line 225) | function createObject( proto ) {
function findHandlers (line 514) | function findHandlers( arr, name, callback, context ) {
function eachEvent (line 524) | function eachEvent( events, callback, iterator ) {
function triggerHanders (line 531) | function triggerHanders( events, args ) {
function Uploader (line 740) | function Uploader( opts ) {
function Runtime (line 939) | function Runtime( options ) {
function RuntimeClient (line 1071) | function RuntimeClient( component, standalone ) {
function Blob (line 1174) | function Blob( ruid, source ) {
function File (line 1224) | function File( ruid, file ) {
function FilePicker (line 1260) | function FilePicker( opts ) {
function isArrayLike (line 1403) | function isArrayLike( obj ) {
function Widget (line 1420) | function Widget( uploader ) {
function Image (line 1783) | function Image( opts ) {
function gid (line 2193) | function gid() {
function WUFile (line 2204) | function WUFile( source ) {
function Queue (line 2382) | function Queue() {
function Transport (line 2998) | function Transport( opts ) {
function CuteFile (line 3224) | function CuteFile( file, chunkSize ) {
function hashString (line 4204) | function hashString( str ) {
function CompBase (line 4254) | function CompBase( owner, runtime ) {
function getFlashVersion (line 4288) | function getFlashVersion() {
function FlashRuntime (line 4306) | function FlashRuntime() {
FILE: dist/webuploader.html5nodepend.js
function each (line 148) | function each( obj, iterator ) {
function extend (line 175) | function extend( target, source, deep ) {
function setAttribute (line 193) | function setAttribute( node, name, value ) {
function $ (line 201) | function $( elem ) {
function type (line 316) | function type( obj ) {
function Callbacks (line 399) | function Callbacks( once ) {
function Deferred (line 488) | function Deferred( func ) {
function uncurryThis (line 743) | function uncurryThis( fn ) {
function bindFn (line 749) | function bindFn( fn, context ) {
function createObject (line 755) | function createObject( proto ) {
function findHandlers (line 1044) | function findHandlers( arr, name, callback, context ) {
function eachEvent (line 1054) | function eachEvent( events, callback, iterator ) {
function triggerHanders (line 1061) | function triggerHanders( events, args ) {
function Uploader (line 1270) | function Uploader( opts ) {
function Runtime (line 1469) | function Runtime( options ) {
function RuntimeClient (line 1601) | function RuntimeClient( component, standalone ) {
function DragAndDrop (line 1707) | function DragAndDrop( opts ) {
function isArrayLike (line 1755) | function isArrayLike( obj ) {
function Widget (line 1772) | function Widget( uploader ) {
function FilePaste (line 2064) | function FilePaste( opts ) {
function Blob (line 2145) | function Blob( ruid, source ) {
function File (line 2195) | function File( ruid, file ) {
function FilePicker (line 2231) | function FilePicker( opts ) {
function Image (line 2515) | function Image( opts ) {
function gid (line 2925) | function gid() {
function WUFile (line 2936) | function WUFile( source ) {
function Queue (line 3114) | function Queue() {
function Transport (line 3730) | function Transport( opts ) {
function CuteFile (line 3956) | function CuteFile( file, chunkSize ) {
function hashString (line 4936) | function hashString( str ) {
function CompBase (line 4986) | function CompBase( owner, runtime ) {
function Html5Runtime (line 5018) | function Html5Runtime() {
function detectVerticalSquash (line 6335) | function detectVerticalSquash( img, iw, ih ) {
function detectSubsampling (line 6387) | function detectSubsampling( img ) {
FILE: dist/webuploader.html5only.js
function uncurryThis (line 213) | function uncurryThis( fn ) {
function bindFn (line 219) | function bindFn( fn, context ) {
function createObject (line 225) | function createObject( proto ) {
function findHandlers (line 514) | function findHandlers( arr, name, callback, context ) {
function eachEvent (line 524) | function eachEvent( events, callback, iterator ) {
function triggerHanders (line 531) | function triggerHanders( events, args ) {
function Uploader (line 740) | function Uploader( opts ) {
function Runtime (line 939) | function Runtime( options ) {
function RuntimeClient (line 1071) | function RuntimeClient( component, standalone ) {
function DragAndDrop (line 1177) | function DragAndDrop( opts ) {
function isArrayLike (line 1225) | function isArrayLike( obj ) {
function Widget (line 1242) | function Widget( uploader ) {
function FilePaste (line 1534) | function FilePaste( opts ) {
function Blob (line 1615) | function Blob( ruid, source ) {
function File (line 1665) | function File( ruid, file ) {
function FilePicker (line 1701) | function FilePicker( opts ) {
function Image (line 1985) | function Image( opts ) {
function gid (line 2395) | function gid() {
function WUFile (line 2406) | function WUFile( source ) {
function Queue (line 2584) | function Queue() {
function Transport (line 3200) | function Transport( opts ) {
function CuteFile (line 3426) | function CuteFile( file, chunkSize ) {
function hashString (line 4406) | function hashString( str ) {
function CompBase (line 4456) | function CompBase( owner, runtime ) {
function Html5Runtime (line 4488) | function Html5Runtime() {
function detectVerticalSquash (line 5805) | function detectVerticalSquash( img, iw, ih ) {
function detectSubsampling (line 5857) | function detectSubsampling( img ) {
FILE: dist/webuploader.js
function uncurryThis (line 213) | function uncurryThis( fn ) {
function bindFn (line 219) | function bindFn( fn, context ) {
function createObject (line 225) | function createObject( proto ) {
function findHandlers (line 514) | function findHandlers( arr, name, callback, context ) {
function eachEvent (line 524) | function eachEvent( events, callback, iterator ) {
function triggerHanders (line 531) | function triggerHanders( events, args ) {
function Uploader (line 740) | function Uploader( opts ) {
function Runtime (line 939) | function Runtime( options ) {
function RuntimeClient (line 1071) | function RuntimeClient( component, standalone ) {
function DragAndDrop (line 1177) | function DragAndDrop( opts ) {
function isArrayLike (line 1225) | function isArrayLike( obj ) {
function Widget (line 1242) | function Widget( uploader ) {
function FilePaste (line 1534) | function FilePaste( opts ) {
function Blob (line 1615) | function Blob( ruid, source ) {
function File (line 1665) | function File( ruid, file ) {
function FilePicker (line 1701) | function FilePicker( opts ) {
function Image (line 1985) | function Image( opts ) {
function gid (line 2395) | function gid() {
function WUFile (line 2406) | function WUFile( source ) {
function Queue (line 2584) | function Queue() {
function Transport (line 3200) | function Transport( opts ) {
function CuteFile (line 3426) | function CuteFile( file, chunkSize ) {
function hashString (line 4406) | function hashString( str ) {
function Md5 (line 4459) | function Md5() {
function CompBase (line 4566) | function CompBase( owner, runtime ) {
function Html5Runtime (line 4598) | function Html5Runtime() {
function JPEGEncoder (line 5648) | function JPEGEncoder(quality) {
function detectVerticalSquash (line 6717) | function detectVerticalSquash( img, iw, ih ) {
function detectSubsampling (line 6769) | function detectSubsampling( img ) {
function getFlashVersion (line 7683) | function getFlashVersion() {
function FlashRuntime (line 7701) | function FlashRuntime() {
function send (line 8185) | function send(data) {
FILE: dist/webuploader.noimage.js
function uncurryThis (line 213) | function uncurryThis( fn ) {
function bindFn (line 219) | function bindFn( fn, context ) {
function createObject (line 225) | function createObject( proto ) {
function findHandlers (line 514) | function findHandlers( arr, name, callback, context ) {
function eachEvent (line 524) | function eachEvent( events, callback, iterator ) {
function triggerHanders (line 531) | function triggerHanders( events, args ) {
function Uploader (line 740) | function Uploader( opts ) {
function Runtime (line 939) | function Runtime( options ) {
function RuntimeClient (line 1071) | function RuntimeClient( component, standalone ) {
function DragAndDrop (line 1177) | function DragAndDrop( opts ) {
function isArrayLike (line 1225) | function isArrayLike( obj ) {
function Widget (line 1242) | function Widget( uploader ) {
function FilePaste (line 1534) | function FilePaste( opts ) {
function Blob (line 1615) | function Blob( ruid, source ) {
function File (line 1665) | function File( ruid, file ) {
function FilePicker (line 1701) | function FilePicker( opts ) {
function gid (line 1988) | function gid() {
function WUFile (line 1999) | function WUFile( source ) {
function Queue (line 2177) | function Queue() {
function Transport (line 2793) | function Transport( opts ) {
function CuteFile (line 3019) | function CuteFile( file, chunkSize ) {
function hashString (line 3999) | function hashString( str ) {
function CompBase (line 4049) | function CompBase( owner, runtime ) {
function Html5Runtime (line 4081) | function Html5Runtime() {
function getFlashVersion (line 4746) | function getFlashVersion() {
function FlashRuntime (line 4764) | function FlashRuntime() {
FILE: dist/webuploader.nolog.js
function uncurryThis (line 213) | function uncurryThis( fn ) {
function bindFn (line 219) | function bindFn( fn, context ) {
function createObject (line 225) | function createObject( proto ) {
function findHandlers (line 514) | function findHandlers( arr, name, callback, context ) {
function eachEvent (line 524) | function eachEvent( events, callback, iterator ) {
function triggerHanders (line 531) | function triggerHanders( events, args ) {
function Uploader (line 740) | function Uploader( opts ) {
function Runtime (line 939) | function Runtime( options ) {
function RuntimeClient (line 1071) | function RuntimeClient( component, standalone ) {
function DragAndDrop (line 1177) | function DragAndDrop( opts ) {
function isArrayLike (line 1225) | function isArrayLike( obj ) {
function Widget (line 1242) | function Widget( uploader ) {
function FilePaste (line 1534) | function FilePaste( opts ) {
function Blob (line 1615) | function Blob( ruid, source ) {
function File (line 1665) | function File( ruid, file ) {
function FilePicker (line 1701) | function FilePicker( opts ) {
function Image (line 1985) | function Image( opts ) {
function gid (line 2395) | function gid() {
function WUFile (line 2406) | function WUFile( source ) {
function Queue (line 2584) | function Queue() {
function Transport (line 3200) | function Transport( opts ) {
function CuteFile (line 3426) | function CuteFile( file, chunkSize ) {
function hashString (line 4406) | function hashString( str ) {
function Md5 (line 4459) | function Md5() {
function CompBase (line 4566) | function CompBase( owner, runtime ) {
function Html5Runtime (line 4598) | function Html5Runtime() {
function JPEGEncoder (line 5648) | function JPEGEncoder(quality) {
function detectVerticalSquash (line 6717) | function detectVerticalSquash( img, iw, ih ) {
function detectSubsampling (line 6769) | function detectSubsampling( img ) {
function getFlashVersion (line 7683) | function getFlashVersion() {
function FlashRuntime (line 7701) | function FlashRuntime() {
FILE: dist/webuploader.withoutimage.js
function uncurryThis (line 205) | function uncurryThis( fn ) {
function bindFn (line 211) | function bindFn( fn, context ) {
function createObject (line 217) | function createObject( proto ) {
function findHandlers (line 506) | function findHandlers( arr, name, callback, context ) {
function eachEvent (line 516) | function eachEvent( events, callback, iterator ) {
function triggerHanders (line 523) | function triggerHanders( events, args ) {
function Uploader (line 732) | function Uploader( opts ) {
function Runtime (line 930) | function Runtime( options ) {
function RuntimeClient (line 1062) | function RuntimeClient( component, standalone ) {
function DragAndDrop (line 1168) | function DragAndDrop( opts ) {
function isArrayLike (line 1216) | function isArrayLike( obj ) {
function Widget (line 1233) | function Widget( uploader ) {
function FilePaste (line 1525) | function FilePaste( opts ) {
function Blob (line 1606) | function Blob( ruid, source ) {
function File (line 1656) | function File( ruid, file ) {
function FilePicker (line 1691) | function FilePicker( opts ) {
function gid (line 1967) | function gid() {
function WUFile (line 1978) | function WUFile( source ) {
function Queue (line 2156) | function Queue() {
function Transport (line 2747) | function Transport( opts ) {
function CuteFile (line 2960) | function CuteFile( file, chunkSize ) {
function hashString (line 3893) | function hashString( str ) {
function CompBase (line 3943) | function CompBase( owner, runtime ) {
function Html5Runtime (line 3975) | function Html5Runtime() {
function getFlashVersion (line 4607) | function getFlashVersion() {
function FlashRuntime (line 4625) | function FlashRuntime() {
FILE: examples/cropper/jquery.js
function M (line 2) | function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.n...
function F (line 2) | function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t...
function P (line 2) | function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==...
function R (line 2) | function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache...
function W (line 2) | function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-...
function $ (line 2) | function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&...
function it (line 2) | function it(){return!0}
function ot (line 2) | function ot(){return!1}
function rt (line 3) | function rt(e){return Y.test(e+"")}
function it (line 3) | function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i....
function ot (line 3) | function ot(e){return e[x]=!0,e}
function at (line 3) | function at(e){var t=p.createElement("div");try{return e(t)}catch(n){ret...
function st (line 3) | function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)...
function ut (line 3) | function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j)...
function lt (line 3) | function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"...
function ct (line 3) | function ct(e){return function(t){var n=t.nodeName.toLowerCase();return(...
function pt (line 3) | function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,...
function ft (line 3) | function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0)...
function dt (line 3) | function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}
function ht (line 3) | function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.firs...
function gt (line 3) | function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i-...
function mt (line 3) | function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)...
function yt (line 3) | function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)...
function vt (line 3) | function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relat...
function bt (line 3) | function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d)...
function xt (line 3) | function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}
function wt (line 3) | function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0...
function Tt (line 3) | function Tt(){}
function pt (line 3) | function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}
function ft (line 3) | function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,...
function dt (line 3) | function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.cre...
function Lt (line 3) | function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ow...
function Ht (line 3) | function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.spec...
function qt (line 3) | function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttrib...
function Mt (line 3) | function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval...
function _t (line 3) | function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e)...
function Ft (line 3) | function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCas...
function Ot (line 3) | function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getEl...
function Bt (line 3) | function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}
function tn (line 4) | function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.sl...
function nn (line 4) | function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(...
function rn (line 4) | function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.sty...
function on (line 4) | function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[...
function an (line 4) | function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:...
function sn (line 4) | function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o...
function un (line 4) | function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(...
function ln (line 4) | function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[...
function gn (line 4) | function gn(e,t,n,r){var i;if(b.isArray(t))b.each(t,function(t,i){n||pn....
function Hn (line 4) | function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var ...
function qn (line 4) | function qn(e,n,r,i){var o={},a=e===jn;function s(u){var l;return o[u]=!...
function Mn (line 4) | function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i...
function k (line 4) | function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t...
function _n (line 4) | function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFi...
function Fn (line 4) | function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e....
function In (line 4) | function In(){try{return new e.XMLHttpRequest}catch(t){}}
function zn (line 4) | function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(...
function Kn (line 4) | function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}
function Zn (line 4) | function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]...
function er (line 4) | function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(functio...
function tr (line 4) | function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e...
function nr (line 4) | function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e....
function rr (line 4) | function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}
function ir (line 4) | function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r...
function or (line 4) | function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.pa...
FILE: examples/cropper/uploader.js
function srcWrap (line 183) | function srcWrap( src, cb ) {
FILE: examples/image-upload/jquery.js
function M (line 2) | function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.n...
function F (line 2) | function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t...
function P (line 2) | function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==...
function R (line 2) | function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache...
function W (line 2) | function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-...
function $ (line 2) | function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&...
function it (line 2) | function it(){return!0}
function ot (line 2) | function ot(){return!1}
function rt (line 3) | function rt(e){return Y.test(e+"")}
function it (line 3) | function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i....
function ot (line 3) | function ot(e){return e[x]=!0,e}
function at (line 3) | function at(e){var t=p.createElement("div");try{return e(t)}catch(n){ret...
function st (line 3) | function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)...
function ut (line 3) | function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j)...
function lt (line 3) | function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"...
function ct (line 3) | function ct(e){return function(t){var n=t.nodeName.toLowerCase();return(...
function pt (line 3) | function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,...
function ft (line 3) | function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0)...
function dt (line 3) | function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}
function ht (line 3) | function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.firs...
function gt (line 3) | function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i-...
function mt (line 3) | function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)...
function yt (line 3) | function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)...
function vt (line 3) | function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relat...
function bt (line 3) | function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d)...
function xt (line 3) | function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}
function wt (line 3) | function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0...
function Tt (line 3) | function Tt(){}
function pt (line 3) | function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}
function ft (line 3) | function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,...
function dt (line 3) | function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.cre...
function Lt (line 3) | function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ow...
function Ht (line 3) | function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.spec...
function qt (line 3) | function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttrib...
function Mt (line 3) | function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval...
function _t (line 3) | function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e)...
function Ft (line 3) | function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCas...
function Ot (line 3) | function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getEl...
function Bt (line 3) | function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}
function tn (line 4) | function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.sl...
function nn (line 4) | function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(...
function rn (line 4) | function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.sty...
function on (line 4) | function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[...
function an (line 4) | function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:...
function sn (line 4) | function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o...
function un (line 4) | function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(...
function ln (line 4) | function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[...
function gn (line 4) | function gn(e,t,n,r){var i;if(b.isArray(t))b.each(t,function(t,i){n||pn....
function Hn (line 4) | function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var ...
function qn (line 4) | function qn(e,n,r,i){var o={},a=e===jn;function s(u){var l;return o[u]=!...
function Mn (line 4) | function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i...
function k (line 4) | function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t...
function _n (line 4) | function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFi...
function Fn (line 4) | function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e....
function In (line 4) | function In(){try{return new e.XMLHttpRequest}catch(t){}}
function zn (line 4) | function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(...
function Kn (line 4) | function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}
function Zn (line 4) | function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]...
function er (line 4) | function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(functio...
function tr (line 4) | function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e...
function nr (line 4) | function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e....
function rr (line 4) | function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}
function ir (line 4) | function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r...
function or (line 4) | function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.pa...
FILE: examples/image-upload/upload.js
function addFile (line 214) | function addFile( file ) {
function removeFile (line 374) | function removeFile( file ) {
function updateTotalProgress (line 382) | function updateTotalProgress() {
function updateStatus (line 401) | function updateStatus() {
function setState (line 428) | function setState( val ) {
FILE: examples/requirejs/app.js
function addFile (line 91) | function addFile( file ) {
function removeFile (line 231) | function removeFile( file ) {
function updateTotalProgress (line 239) | function updateTotalProgress() {
function updateStatus (line 257) | function updateStatus() {
function setState (line 284) | function setState( val ) {
FILE: examples/requirejs/require.js
function G (line 7) | function G(b){return"[object Function]"===N.call(b)}
function H (line 7) | function H(b){return"[object Array]"===N.call(b)}
function v (line 7) | function v(b,c){if(b){var d;for(d=0;d<b.length&&(!b[d]||!c(b[d],d,b));d+...
function U (line 7) | function U(b,c){if(b){var d;for(d=b.length-1;-1<d&&(!b[d]||!c(b[d],d,b))...
function s (line 7) | function s(b,c){return ga.call(b,c)}
function j (line 7) | function j(b,c){return s(b,c)&&b[c]}
function B (line 7) | function B(b,c){for(var d in b)if(s(b,d)&&c(b[d],d))break}
function V (line 7) | function V(b,c,d,g){c&&B(c,function(c,h){if(d||!s(b,h))g&&"object"===typ...
function t (line 8) | function t(b,c){return function(){return c.apply(b,arguments)}}
function da (line 8) | function da(b){throw b;}
function ea (line 8) | function ea(b){if(!b)return b;var c=ca;v(b.split("."),function(b){c=c[b]...
function C (line 8) | function C(b,c,d,g){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"...
function ha (line 8) | function ha(b){function c(a,e,b){var f,n,c,d,g,h,i,I=e&&e.split("/");n=I...
FILE: jekyll/_plugins/fancytoc.rb
type Jekyll (line 2) | module Jekyll
type FancyToCFilter (line 3) | module FancyToCFilter
function fancytoc (line 4) | def fancytoc(input)
FILE: jekyll/js/bootstrap.js
function transitionEnd (line 34) | function transitionEnd() {
function removeElement (line 119) | function removeElement() {
function clearMenus (line 771) | function clearMenus() {
function getParent (line 782) | function getParent($this) {
function complete (line 1343) | function complete() {
function ScrollSpy (line 1611) | function ScrollSpy(element, options) {
function next (line 1812) | function next() {
FILE: jekyll/js/demo.js
function addFile (line 97) | function addFile( file ) {
function removeFile (line 237) | function removeFile( file ) {
function updateTotalProgress (line 245) | function updateTotalProgress() {
function updateStatus (line 263) | function updateStatus() {
function setState (line 290) | function setState( val ) {
FILE: jekyll/js/global.js
function formatNumber (line 36) | function formatNumber(val, len) {
function formatDate (line 47) | function formatDate( str ) {
function loadComments (line 58) | function loadComments( data ) {
FILE: jekyll/js/webuploader.js
function uncurryThis (line 213) | function uncurryThis( fn ) {
function bindFn (line 219) | function bindFn( fn, context ) {
function createObject (line 225) | function createObject( proto ) {
function findHandlers (line 514) | function findHandlers( arr, name, callback, context ) {
function eachEvent (line 524) | function eachEvent( events, callback, iterator ) {
function triggerHanders (line 531) | function triggerHanders( events, args ) {
function Uploader (line 740) | function Uploader( opts ) {
function Runtime (line 939) | function Runtime( options ) {
function RuntimeClient (line 1071) | function RuntimeClient( component, standalone ) {
function DragAndDrop (line 1177) | function DragAndDrop( opts ) {
function isArrayLike (line 1225) | function isArrayLike( obj ) {
function Widget (line 1242) | function Widget( uploader ) {
function FilePaste (line 1534) | function FilePaste( opts ) {
function Blob (line 1615) | function Blob( ruid, source ) {
function File (line 1665) | function File( ruid, file ) {
function FilePicker (line 1701) | function FilePicker( opts ) {
function Image (line 1985) | function Image( opts ) {
function gid (line 2395) | function gid() {
function WUFile (line 2406) | function WUFile( source ) {
function Queue (line 2584) | function Queue() {
function Transport (line 3200) | function Transport( opts ) {
function CuteFile (line 3426) | function CuteFile( file, chunkSize ) {
function hashString (line 4406) | function hashString( str ) {
function Md5 (line 4459) | function Md5() {
function CompBase (line 4566) | function CompBase( owner, runtime ) {
function Html5Runtime (line 4598) | function Html5Runtime() {
function JPEGEncoder (line 5648) | function JPEGEncoder(quality) {
function detectVerticalSquash (line 6717) | function detectVerticalSquash( img, iw, ih ) {
function detectSubsampling (line 6769) | function detectSubsampling( img ) {
function getFlashVersion (line 7683) | function getFlashVersion() {
function FlashRuntime (line 7701) | function FlashRuntime() {
function send (line 8185) | function send(data) {
FILE: server/fileupload2.php
function mymd5 (line 155) | function mymd5( $file ) {
FILE: src/base.js
function uncurryThis (line 31) | function uncurryThis( fn ) {
function bindFn (line 37) | function bindFn( fn, context ) {
function createObject (line 43) | function createObject( proto ) {
FILE: src/dollar-builtin.js
function each (line 17) | function each( obj, iterator ) {
function extend (line 44) | function extend( target, source, deep ) {
function setAttribute (line 62) | function setAttribute( node, name, value ) {
function $ (line 70) | function $( elem ) {
function type (line 185) | function type( obj ) {
FILE: src/file.js
function gid (line 15) | function gid() {
function WUFile (line 26) | function WUFile( source ) {
FILE: src/lib/blob.js
function Blob (line 9) | function Blob( ruid, source ) {
FILE: src/lib/dnd.js
function DragAndDrop (line 12) | function DragAndDrop( opts ) {
FILE: src/lib/file.js
function File (line 14) | function File( ruid, file ) {
FILE: src/lib/filepaste.js
function FilePaste (line 12) | function FilePaste( opts ) {
FILE: src/lib/filepicker.js
function FilePicker (line 12) | function FilePicker( opts ) {
FILE: src/lib/image.js
function Image (line 12) | function Image( opts ) {
FILE: src/lib/md5.js
function Md5 (line 9) | function Md5() {
FILE: src/lib/transport.js
function Transport (line 12) | function Transport( opts ) {
FILE: src/mediator.js
function findHandlers (line 14) | function findHandlers( arr, name, callback, context ) {
function eachEvent (line 24) | function eachEvent( events, callback, iterator ) {
function triggerHanders (line 31) | function triggerHanders( events, args ) {
FILE: src/promise-builtin.js
function Callbacks (line 13) | function Callbacks( once ) {
function Deferred (line 102) | function Deferred( func ) {
FILE: src/queue.js
function Queue (line 18) | function Queue() {
FILE: src/runtime/client.js
function RuntimeClient (line 45) | function RuntimeClient( component, standalone ) {
FILE: src/runtime/compbase.js
function CompBase (line 6) | function CompBase( owner, runtime ) {
FILE: src/runtime/flash/runtime.js
function getFlashVersion (line 15) | function getFlashVersion() {
function FlashRuntime (line 33) | function FlashRuntime() {
FILE: src/runtime/html5/image.js
function detectVerticalSquash (line 314) | function detectVerticalSquash( img, iw, ih ) {
function detectSubsampling (line 366) | function detectSubsampling( img ) {
FILE: src/runtime/html5/jpegencoder.js
function JPEGEncoder (line 47) | function JPEGEncoder(quality) {
FILE: src/runtime/html5/runtime.js
function Html5Runtime (line 13) | function Html5Runtime() {
FILE: src/runtime/runtime.js
function Runtime (line 23) | function Runtime( options ) {
FILE: src/uploader.js
function Uploader (line 24) | function Uploader( opts ) {
FILE: src/widgets/log.js
function send (line 43) | function send(data) {
FILE: src/widgets/upload.js
function CuteFile (line 103) | function CuteFile( file, chunkSize ) {
FILE: src/widgets/validator.js
function hashString (line 188) | function hashString( str ) {
FILE: src/widgets/widget.js
function isArrayLike (line 15) | function isArrayLike( obj ) {
function Widget (line 32) | function Widget( uploader ) {
FILE: test/Qunit/qunit-1.14.0.js
function F (line 212) | function F() {}
function done (line 811) | function done() {
function validTest (line 885) | function validTest( test ) {
function extractStacktrace (line 928) | function extractStacktrace( e, offset ) {
function sourceFromStacktrace (line 966) | function sourceFromStacktrace( offset ) {
function escapeText (line 977) | function escapeText( s ) {
function synchronize (line 999) | function synchronize( callback, last ) {
function process (line 1007) | function process( last ) {
function saveGlobal (line 1028) | function saveGlobal() {
function checkPollution (line 1044) | function checkPollution() {
function diff (line 1063) | function diff( a, b ) {
function extend (line 1079) | function extend( a, b ) {
function addEvent (line 1101) | function addEvent( elem, type, fn ) {
function addEvents (line 1122) | function addEvents( elems, type, fn ) {
function hasClass (line 1129) | function hasClass( elem, name ) {
function addClass (line 1133) | function addClass( elem, name ) {
function removeClass (line 1139) | function removeClass( elem, name ) {
function id (line 1149) | function id( name ) {
function registerLoggingCallback (line 1153) | function registerLoggingCallback( key ) {
function runLoggingCallbacks (line 1160) | function runLoggingCallbacks( key, scope, args ) {
function inArray (line 1173) | function inArray( elem, array ) {
function Test (line 1187) | function Test( settings ) {
function run (line 1457) | function run() {
function bindCallbacks (line 1691) | function bindCallbacks( o, callbacks, args ) {
function useStrictEquality (line 1717) | function useStrictEquality( b, a ) {
function quote (line 1905) | function quote( str ) {
function literal (line 1908) | function literal( o ) {
function join (line 1911) | function join( pre, arr, post ) {
function array (line 1923) | function array( arr, stack ) {
function diff (line 2141) | function diff( o, n ) {
FILE: test/require.js
function G (line 7) | function G(b){return"[object Function]"===N.call(b)}
function H (line 7) | function H(b){return"[object Array]"===N.call(b)}
function v (line 7) | function v(b,c){if(b){var d;for(d=0;d<b.length&&(!b[d]||!c(b[d],d,b));d+...
function U (line 7) | function U(b,c){if(b){var d;for(d=b.length-1;-1<d&&(!b[d]||!c(b[d],d,b))...
function s (line 7) | function s(b,c){return ga.call(b,c)}
function j (line 7) | function j(b,c){return s(b,c)&&b[c]}
function B (line 7) | function B(b,c){for(var d in b)if(s(b,d)&&c(b[d],d))break}
function V (line 7) | function V(b,c,d,g){c&&B(c,function(c,h){if(d||!s(b,h))g&&"object"===typ...
function t (line 8) | function t(b,c){return function(){return c.apply(b,arguments)}}
function da (line 8) | function da(b){throw b;}
function ea (line 8) | function ea(b){if(!b)return b;var c=ca;v(b.split("."),function(b){c=c[b]...
function C (line 8) | function C(b,c,d,g){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"...
function ha (line 8) | function ha(b){function c(a,e,b){var f,n,c,d,g,h,i,I=e&&e.split("/");n=I...
Condensed preview — 276 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (4,236K chars).
[
{
"path": ".gitignore",
"chars": 242,
"preview": ".DS_Store\n.idea\n/pages\n/node_modules\n/doc\nserver/*\n!server/preview.php\n!server/fileupload.php\n!server/fileupload2.php\n!s"
},
{
"path": ".jshintrc",
"chars": 2299,
"preview": "{\n \"maxerr\" : 50,\n \"bitwise\" : false,\n \"camelcase\" : true,\n \"curly\" : true,\n \"eq"
},
{
"path": ".travis.yml",
"chars": 109,
"preview": "language: node_js\n\nnode_js:\n - 0.10\n\nbefore_script:\n - npm install -g grunt-cli\n\nscript:\n - grunt test"
},
{
"path": "Gruntfile.js",
"chars": 7672,
"preview": "module.exports = function(grunt) {\n 'use strict';\n\n grunt.initConfig({\n pkg: grunt.file.readJSON('package.j"
},
{
"path": "LICENSE",
"chars": 1494,
"preview": "Copyright (c) 2014, FEX@Baidu Inc.\nAll rights reserved.\n\nRedistribution and use of this software in source and binary fo"
},
{
"path": "README.md",
"chars": 1449,
"preview": "不再对使用问题进行答复,如果有希望的功能改进或者bugfix可以提交PR\n==================================================\n\n\n# WebUploader 文件上传 [![Build St"
},
{
"path": "_draft/demo.html",
"chars": 1343,
"preview": "<!DOCTYPE html>\n<html lang=\"zh-CN\">\n<head>\n <meta charset=\"UTF-8\">\n <title>WebUploader演示 - 秒传</title>\n <link re"
},
{
"path": "_draft/demo.js",
"chars": 12220,
"preview": "(function( $ ){\n // 当domReady的时候开始初始化\n $(function() {\n var $wrap = $('#uploader'),\n\n // 图片容器\n "
},
{
"path": "_draft/demo2.html",
"chars": 1344,
"preview": "<!DOCTYPE html>\n<html lang=\"zh-CN\">\n<head>\n <meta charset=\"UTF-8\">\n <title>WebUploader演示 - 秒传</title>\n <link re"
},
{
"path": "_draft/demo2.js",
"chars": 12261,
"preview": "(function( $ ){\n // 当domReady的时候开始初始化\n $(function() {\n var $wrap = $('#uploader'),\n\n // 图片容器\n "
},
{
"path": "_draft/flash_cpp/as3api.cpp",
"chars": 1406,
"preview": "#include <stdlib.h>\n#include <string>\n#include \"AS3/AS3.h\"\n\n#include \"hashlib/hl_hashwrapper.h\"\n#include \"hashlib/hl_md5"
},
{
"path": "_draft/flash_cpp/exports.txt",
"chars": 361,
"preview": "# built in symbols that must always be preserved\n_start1\nmalloc\nfree\nmemcpy\nmemmove\nflascc_uiTickProc\n_sync_synchronize\n"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/all-wcprops",
"chars": 3078,
"preview": "K 25\nsvn:wc:ra_dav:version-url\nV 43\n/svnroot/hashlib2plus/!svn/ver/77/trunk/src\nEND\nhl_sha384wrapper.cpp\nK 25\nsvn:wc:ra_"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/entries",
"chars": 4223,
"preview": "10\n\ndir\n77\nhttps://hashlib2plus.svn.sourceforge.net/svnroot/hashlib2plus/trunk/src\nhttps://hashlib2plus.svn.sourceforge."
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/Makefile.svn-base",
"chars": 5642,
"preview": "# \n# hashlib++ - a simple hash library for C++\n# \n# Copyright (c) 2007-2010 Benjamin Grdelbach\n# \n# Redistribution and u"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hashlibpp.h.svn-base",
"chars": 2352,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_exception.h.svn-base",
"chars": 3369,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_hashwrapper.h.svn-base",
"chars": 8769,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2011 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_md5.cpp.svn-base",
"chars": 13295,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_md5.h.svn-base",
"chars": 6702,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_md5wrapper.cpp.svn-base",
"chars": 4134,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_md5wrapper.h.svn-base",
"chars": 4196,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_sha1.cpp.svn-base",
"chars": 11048,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_sha1.h.svn-base",
"chars": 7519,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_sha1wrapper.cpp.svn-base",
"chars": 4007,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_sha1wrapper.h.svn-base",
"chars": 4168,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_sha256.cpp.svn-base",
"chars": 14721,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_sha256.h.svn-base",
"chars": 6438,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n *\n * Redistribution "
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_sha256wrapper.cpp.svn-base",
"chars": 3947,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_sha256wrapper.h.svn-base",
"chars": 4305,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_sha2ext.cpp.svn-base",
"chars": 17403,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_sha2ext.h.svn-base",
"chars": 8064,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n *\n * Redistribution "
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_sha2mac.h.svn-base",
"chars": 7977,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_sha384wrapper.cpp.svn-base",
"chars": 3871,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_sha384wrapper.h.svn-base",
"chars": 4327,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_sha512wrapper.cpp.svn-base",
"chars": 3904,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_sha512wrapper.h.svn-base",
"chars": 4326,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_types.h.svn-base",
"chars": 2583,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_wrapperfactory.cpp.svn-base",
"chars": 3250,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grüdelbach\n * \n * Redistributio"
},
{
"path": "_draft/flash_cpp/hashlib/.svn/text-base/hl_wrapperfactory.h.svn-base",
"chars": 3080,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grüdelbach\n * \n * Redistributio"
},
{
"path": "_draft/flash_cpp/hashlib/Makefile",
"chars": 5642,
"preview": "# \n# hashlib++ - a simple hash library for C++\n# \n# Copyright (c) 2007-2010 Benjamin Grdelbach\n# \n# Redistribution and u"
},
{
"path": "_draft/flash_cpp/hashlib/hashlibpp.h",
"chars": 2352,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_exception.h",
"chars": 3369,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_hashwrapper.h",
"chars": 8769,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2011 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_md5.cpp",
"chars": 13295,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_md5.h",
"chars": 6702,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_md5wrapper.cpp",
"chars": 4134,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_md5wrapper.h",
"chars": 4196,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_sha1.cpp",
"chars": 11048,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_sha1.h",
"chars": 7519,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_sha1wrapper.cpp",
"chars": 4007,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_sha1wrapper.h",
"chars": 4168,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_sha256.cpp",
"chars": 14721,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_sha256.h",
"chars": 6438,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n *\n * Redistribution "
},
{
"path": "_draft/flash_cpp/hashlib/hl_sha256wrapper.cpp",
"chars": 3947,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_sha256wrapper.h",
"chars": 4305,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_sha2ext.cpp",
"chars": 17403,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_sha2ext.h",
"chars": 8064,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n *\n * Redistribution "
},
{
"path": "_draft/flash_cpp/hashlib/hl_sha2mac.h",
"chars": 7977,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_sha384wrapper.cpp",
"chars": 3871,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_sha384wrapper.h",
"chars": 4327,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_sha512wrapper.cpp",
"chars": 3904,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_sha512wrapper.h",
"chars": 4326,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_types.h",
"chars": 2583,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grdelbach\n * \n * Redistribution"
},
{
"path": "_draft/flash_cpp/hashlib/hl_wrapperfactory.cpp",
"chars": 3250,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grüdelbach\n * \n * Redistributio"
},
{
"path": "_draft/flash_cpp/hashlib/hl_wrapperfactory.h",
"chars": 3080,
"preview": "/* \n * hashlib++ - a simple hash library for C++\n * \n * Copyright (c) 2007-2010 Benjamin Grüdelbach\n * \n * Redistributio"
},
{
"path": "_draft/flash_cpp/main.cpp",
"chars": 76,
"preview": "#include <stdlib.h>\n#include \"AS3/AS3.h\"\n\n\nint main() {\n AS3_GoAsync();\n}"
},
{
"path": "_draft/flash_cpp/makefile",
"chars": 1401,
"preview": "T05: check\n\t@echo \"-------- Sample 5 --------\"\n\n\t@echo && echo \"Now compile a SWC and demo SWF\"\n\t\"$(FLASCC)/usr/bin/g++\""
},
{
"path": "_draft/hashFile.js",
"chars": 1361,
"preview": "// 此文件在worker环境下运行。\nimportScripts('md5.js');\n\nvar hashMe = function(file, callbackFunction) {\n\n var thisObj = this,\n "
},
{
"path": "_draft/md5.js",
"chars": 6806,
"preview": "(function( window ){\n function md5cycle(x, k) {\n var a = x[0],\n b = x[1],\n c = x[2],\n "
},
{
"path": "_draft/md5File.js",
"chars": 1501,
"preview": "// 此文件在worker环境下运行。\nimportScripts('md5.js');\n\nvar fr = new FileReader();\n\nvar Md5File = (function() {\n /*var throttle"
},
{
"path": "_draft/music/index.html",
"chars": 1297,
"preview": "<!DOCTYPE html>\n<html lang=\"zh-CN\">\n<head>\n <meta charset=\"UTF-8\">\n <title>WebUploader演示</title>\n <link rel=\"st"
},
{
"path": "_draft/music/jquery.js",
"chars": 92593,
"preview": "/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license\n*/(function(e,t){var n,r,i=typeof t,o=e."
},
{
"path": "_draft/music/md5.js",
"chars": 6808,
"preview": "(function( window ) {\n function md5cycle(x, k) {\n var a = x[0],\n b = x[1],\n c = x[2],\n "
},
{
"path": "_draft/music/server/fileupload.php",
"chars": 5352,
"preview": "<?php\n/**\n * upload.php\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://"
},
{
"path": "_draft/music/style.css",
"chars": 9184,
"preview": "/* ----------------Reset Css--------------------- */\nhtml, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, "
},
{
"path": "_draft/music/upload.js",
"chars": 12685,
"preview": "(function($) {\n // 当domReady的时候开始初始化\n $(function() {\n var $wrap = $('#uploader'),\n\n // 图片容器\n "
},
{
"path": "_draft/music/webuploader.js",
"chars": 172011,
"preview": "/* WebUploader 0.1.0 */\n(function( window, undefined ) {\n /**\n * @fileOverview 让内部各个部件的代码可以用[amd](https://github."
},
{
"path": "bower.json",
"chars": 665,
"preview": "{\n \"name\": \"fex-webuploader\",\n \"main\": \"dist/webuploader.js\",\n \"homepage\": \"https://github.com/fex-team/webuploader\","
},
{
"path": "build/docTpl/class.ejs",
"chars": 2017,
"preview": "<div class=\"clearfix category\">\n\n\n <% var item; if( (item = items[ 0 ]) && item.hasOwnProperty('constructor') ) { %>\n"
},
{
"path": "build/docTpl/content.ejs",
"chars": 96,
"preview": "<% _.forEach( modules, function( module ) { %>\n <%- renderTpl( 'module', module ) %>\n<% }) %>"
},
{
"path": "build/docTpl/css/doc.css",
"chars": 1026,
"preview": "ul.signature {\n margin: 1em 0;\n padding: 0;\n font: normal 12px/18px Monaco, Consolas, \"Lucida Console\", monospa"
},
{
"path": "build/docTpl/events.ejs",
"chars": 645,
"preview": "<div>\n <h3 id=\"<%- gennerateID(module + ':' + name + ':events') %>\">事件说明</h3>\n <table class=\"table table-bordered\""
},
{
"path": "build/docTpl/items.ejs",
"chars": 1546,
"preview": "<% _.sortBy( items, function( value ){ return value.uses ? value.uses.length : 0; } ).forEach(function( item ) { %>\n<% i"
},
{
"path": "build/docTpl/layout.ejs",
"chars": 466,
"preview": "---\nlayout: default\ntitle: <%= title %>\nnavName: API\ngroup: 'nav'\nweight : 3\nstyles:\n - /doc/css/doc.css\n---\n<%- render"
},
{
"path": "build/docTpl/module.ejs",
"chars": 821,
"preview": "<div class=\"container\">\n <% if ( title ) { %>\n <div class=\"page-header\">\n <h1 id=\"<%- gennerateID( name ) %>\""
},
{
"path": "build/docTpl/options.ejs",
"chars": 794,
"preview": "<div>\n <h3 id=\"<%- gennerateID(module + ':' + name + ':options') %>\">参数说明</h3>\n <ul class=\"params-list\">\n <"
},
{
"path": "build/docTpl/plugins.ejs",
"chars": 412,
"preview": "<div>\n <hr />\n <h2 id=\"<%- gennerateID(module + ':' + name + ':plugins') %>\">插件介绍</h2>\n <br />\n <ol class=\"p"
},
{
"path": "build/docTpl/sidebar.ejs",
"chars": 760,
"preview": "<div class=\"post-toc\">\n <ul class=\"nav\">\n <% _.forEach( navs, function( classes, modulename ) { %>\n <% "
},
{
"path": "build/fis/intro.js",
"chars": 2942,
"preview": "var jQuery = require('example:widget/ui/jquery/jquery.js');\n\nmodule.exports = (function( root, factory ) {\n var modul"
},
{
"path": "build/fis/outro.js",
"chars": 70,
"preview": "\n\n var _require = require;\n return _require('webuploader');\n});\n"
},
{
"path": "build/intro.js",
"chars": 3822,
"preview": "/**\n * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定义方式组织起来。\n *\n * AMD API 内部的简单不完全实现"
},
{
"path": "build/outro.js",
"chars": 40,
"preview": "\n return require('webuploader');\n});\n"
},
{
"path": "build/tasks/build.js",
"chars": 5977,
"preview": "/**\n * @fileOverview 负责合并amd modules为一个单文件。\n */\n\n'use strict';\n\nvar requirejs = require('requirejs'),\n fs = require('"
},
{
"path": "build/tasks/concat.js",
"chars": 8398,
"preview": "/*\n * grunt-contrib-concat\n * http://gruntjs.com/\n *\n * Copyright (c) 2013 \"Cowboy\" Ben Alman, contributors\n * Licensed "
},
{
"path": "build/tasks/doc.js",
"chars": 413,
"preview": "module.exports = function( grunt ) {\n grunt.registerTask( 'doc', '生成文档', function() {\n var Doc = require( 'gmu"
},
{
"path": "css/webuploader.css",
"chars": 515,
"preview": ".webuploader-container {\n\tposition: relative;\n}\n.webuploader-element-invisible {\n\tposition: absolute !important;\n\tclip: "
},
{
"path": "dist/README.md",
"chars": 718,
"preview": "目录说明\n========================\n\n```bash\n├── Uploader.swf # SWF文件,当使用Flash运行时需要引入。\n├\n├── webuploader."
},
{
"path": "dist/webuploader.css",
"chars": 515,
"preview": ".webuploader-container {\n\tposition: relative;\n}\n.webuploader-element-invisible {\n\tposition: absolute !important;\n\tclip: "
},
{
"path": "dist/webuploader.custom.js",
"chars": 222066,
"preview": "/*! WebUploader 0.1.8-alpha */\n\n\n/**\n * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定"
},
{
"path": "dist/webuploader.fis.js",
"chars": 271044,
"preview": "/*! WebUploader 0.1.8-alpha */\n\n\nvar jQuery = require('example:widget/ui/jquery/jquery.js');\n\nmodule.exports = (function"
},
{
"path": "dist/webuploader.flashonly.js",
"chars": 147467,
"preview": "/*! WebUploader 0.1.8-alpha */\n\n\n/**\n * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定"
},
{
"path": "dist/webuploader.html5nodepend.js",
"chars": 215751,
"preview": "/*! WebUploader 0.1.8-alpha */\n\n\n/**\n * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定"
},
{
"path": "dist/webuploader.html5only.js",
"chars": 196343,
"preview": "/*! WebUploader 0.1.8-alpha */\n\n\n/**\n * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定"
},
{
"path": "dist/webuploader.js",
"chars": 271894,
"preview": "/*! WebUploader 0.1.8-alpha */\n\n\n/**\n * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定"
},
{
"path": "dist/webuploader.noimage.js",
"chars": 161990,
"preview": "/*! WebUploader 0.1.8-alpha */\n\n\n/**\n * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定"
},
{
"path": "dist/webuploader.nolog.js",
"chars": 269300,
"preview": "/*! WebUploader 0.1.8-alpha */\n\n\n/**\n * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定"
},
{
"path": "dist/webuploader.withoutimage.js",
"chars": 155990,
"preview": "/*! WebUploader 0.1.5 */\n\n\n/**\n * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定义方式组织起"
},
{
"path": "examples/cropper/cropper.css",
"chars": 4008,
"preview": "/*!\n * Cropper v0.3.2\n * https://github.com/fengyuanchen/cropper\n *\n * Copyright 2014 Fengyuan Chen\n * Released under th"
},
{
"path": "examples/cropper/cropper.js",
"chars": 24921,
"preview": "/*!\n * Cropper v0.3.2\n * https://github.com/fengyuanchen/cropper\n *\n * Copyright 2014 Fengyuan Chen\n * Released under th"
},
{
"path": "examples/cropper/index.html",
"chars": 1068,
"preview": "<!DOCTYPE html>\n<html lang=\"zh-CN\">\n<head>\n <meta charset=\"UTF-8\">\n <title>WebUploader演示 - 带裁剪功能 </title>\n <lin"
},
{
"path": "examples/cropper/jquery.js",
"chars": 92593,
"preview": "/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license\n*/(function(e,t){var n,r,i=typeof t,o=e."
},
{
"path": "examples/cropper/style.css",
"chars": 1832,
"preview": "/* ----------------Reset Css--------------------- */\nhtml, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, "
},
{
"path": "examples/cropper/uploader.js",
"chars": 7679,
"preview": "(function( factory ) {\n if ( !window.jQuery ) {\n alert('jQuery is required.')\n }\n\n jQuery(function() {\n "
},
{
"path": "examples/image-upload/index.html",
"chars": 1336,
"preview": "<!DOCTYPE html>\n<html lang=\"zh-CN\">\n<head>\n <meta charset=\"UTF-8\">\n <title>WebUploader演示</title>\n <link rel=\"st"
},
{
"path": "examples/image-upload/jquery.js",
"chars": 92593,
"preview": "/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license\n*/(function(e,t){var n,r,i=typeof t,o=e."
},
{
"path": "examples/image-upload/style.css",
"chars": 8900,
"preview": "/* ----------------Reset Css--------------------- */\nhtml, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, "
},
{
"path": "examples/image-upload/upload.js",
"chars": 19036,
"preview": "(function( $ ){\n // 当domReady的时候开始初始化\n $(function() {\n var $wrap = $('#uploader'),\n\n // 图片容器\n "
},
{
"path": "examples/md5-demo/index.html",
"chars": 742,
"preview": "<!DOCTYPE html>\n<html lang=\"zh-CN\">\n<head>\n <meta charset=\"UTF-8\">\n <title>WebUploader演示 - 带裁剪功能 </title>\n <lin"
},
{
"path": "examples/md5-demo/script.js",
"chars": 1723,
"preview": "(function($) {\n $(function() {\n var log = (function() {\n var dom = $('#log');\n\n return f"
},
{
"path": "examples/requirejs/app.js",
"chars": 13767,
"preview": "requirejs.config({\n baseUrl: '../../dist',\n paths: {\n jquery: '../examples/image-upload/jquery'\n }\n});\n\n"
},
{
"path": "examples/requirejs/index.html",
"chars": 1221,
"preview": "<!DOCTYPE html>\n<html lang=\"zh-CN\">\n<head>\n <meta charset=\"UTF-8\">\n <title>WebUploader演示</title>\n <link rel=\"st"
},
{
"path": "examples/requirejs/require.js",
"chars": 15209,
"preview": "/*\n RequireJS 2.1.10 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.\n Available via the MIT or new BSD"
},
{
"path": "flash/.actionScriptProperties",
"chars": 3974,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<actionScriptProperties analytics=\"false\" mainApplicationPath=\"Up"
},
{
"path": "flash/.project",
"chars": 816,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<projectDescription>\n\t<name>Uploader</name>\n\t<comment></comment>\n\t<projects>\n\t</p"
},
{
"path": "flash/.settings/org.eclipse.core.resources.prefs",
"chars": 85,
"preview": "#Fri Oct 25 17:23:15 CST 2013\neclipse.preferences.version=1\nencoding/<project>=utf-8\n"
},
{
"path": "flash/Uploader.iml",
"chars": 1662,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"Flex\" version=\"4\">\n <component name=\"FlexBuildConfigurationManager"
},
{
"path": "flash/src/ComponentFactory.as",
"chars": 2774,
"preview": "package\n{\n import com.Blob;\n import com.File;\n import com.FilePicker;\n import com.FileReader;\n import com"
},
{
"path": "flash/src/Uploader.as",
"chars": 5957,
"preview": "package\n{\n import com.errors.RuntimeError;\n import com.events.OProgressEvent;\n import com.utils.Utils;\n impo"
},
{
"path": "flash/src/com/Blob.as",
"chars": 5101,
"preview": "package com\n{\n\timport com.utils.Buffer;\n\t\n\timport flash.net.FileReference;\n\timport flash.utils.ByteArray;\n\timport com.ut"
},
{
"path": "flash/src/com/File.as",
"chars": 1110,
"preview": "package com\n{\n\timport com.utils.Utils;\n\n\tpublic class File extends Blob\n\t{\n\t\tprivate var _name:String = '';\n\t\tpublic fun"
},
{
"path": "flash/src/com/FilePicker.as",
"chars": 3561,
"preview": "package com\n{\n\timport com.events.FilePickerEvent;\n\n\timport flash.display.Sprite;\n\timport flash.events.Event;\n\timport fla"
},
{
"path": "flash/src/com/FileReader.as",
"chars": 6285,
"preview": "package com\n{\n\timport com.errors.DOMError;\n\timport com.events.OErrorEvent;\n\timport com.events.OProgressEvent;\n\timport co"
},
{
"path": "flash/src/com/FileReaderSync.as",
"chars": 791,
"preview": "package com\n{\t\n\timport com.errors.DOMError;\n\timport com.utils.Base64;\n\timport flash.utils.ByteArray;\n\t\n\tpublic class Fil"
},
{
"path": "flash/src/com/Image.as",
"chars": 8625,
"preview": "package com\n{\n\timport com.errors.ImageError;\n\timport com.events.ODataEvent;\n\timport com.events.OErrorEvent;\n\timport com."
},
{
"path": "flash/src/com/Md5.as",
"chars": 2207,
"preview": "package com\n{\nimport com.errors.ImageError;\nimport com.events.ODataEvent;\nimport com.events.OErrorEvent;\nimport com.even"
},
{
"path": "flash/src/com/XMLHttpRequest.as",
"chars": 13565,
"preview": "package com\n{\n\timport com.adobe.serialization.json.JSON;\n\timport com.errors.RuntimeError;\n\timport com.events.OErrorEvent"
},
{
"path": "flash/src/com/errors/DOMError.as",
"chars": 358,
"preview": "package com.errors\n{\n\tpublic class DOMError extends Error\n\t{\n\t\tpublic static const NOT_FOUND_ERR:uint = 1;\n\t\tpublic stat"
},
{
"path": "flash/src/com/errors/ImageError.as",
"chars": 148,
"preview": "package com.errors\n{\n\tpublic class ImageError\n\t{\n\t\tpublic static const WRONG_FORMAT:uint = 0;\n\t\tpublic static const OUT_"
},
{
"path": "flash/src/com/errors/RuntimeError.as",
"chars": 459,
"preview": "package com.errors\n{\n\tpublic class RuntimeError extends Error\n\t{\n\t\tpublic static const NOT_INIT_ERR:uint = 1;\n\t\tpublic s"
},
{
"path": "flash/src/com/events/FilePickerEvent.as",
"chars": 424,
"preview": "package com.events\n{\n\timport flash.events.Event;\n\t\n\tpublic class FilePickerEvent extends Event\n\t{\n\t\tpublic static const "
},
{
"path": "flash/src/com/events/ImageEvent.as",
"chars": 390,
"preview": "package com.events\n{\n\timport flash.events.Event;\n\t\n\tpublic class ImageEvent extends Event\n\t{\n\t\tpublic static const RESIZ"
},
{
"path": "flash/src/com/events/ODataEvent.as",
"chars": 392,
"preview": "package com.events\n{\n\timport flash.events.Event;\n\t\n\tpublic class ODataEvent extends Event\n\t{\n\t\tpublic static const DATA:"
},
{
"path": "flash/src/com/events/OErrorEvent.as",
"chars": 388,
"preview": "package com.events\n{\n\timport flash.events.Event;\n\n\tpublic class OErrorEvent extends Event\n\t{\n\t\tpublic static const ERROR"
},
{
"path": "flash/src/com/events/OProgressEvent.as",
"chars": 546,
"preview": "package com.events\n{\n\timport flash.events.Event;\n\timport flash.events.ProgressEvent;\n\n\tpublic class OProgressEvent exten"
},
{
"path": "flash/src/com/events/URLStreamProgressEvent.as",
"chars": 363,
"preview": "package com.events\n{\t\n\timport flash.events.Event;\n\n\tpublic class URLStreamProgressEvent extends Event\n\t{\n\t\tpublic static"
},
{
"path": "flash/src/com/image/BMP.as",
"chars": 1102,
"preview": "/**\n * Copyright 2011, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/licens"
},
{
"path": "flash/src/com/image/ExifParser.as",
"chars": 10475,
"preview": "/**\n * Copyright 2011, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/licens"
},
{
"path": "flash/src/com/image/GIF.as",
"chars": 1105,
"preview": "/**\n * Copyright 2011, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/licens"
},
{
"path": "flash/src/com/image/ImageEditor.as",
"chars": 5858,
"preview": "package com.image\n{\n\timport flash.display.Bitmap;\n\timport flash.display.BitmapData;\n\timport flash.filters.BlurFilter;\n\ti"
},
{
"path": "flash/src/com/image/JPEG.as",
"chars": 5365,
"preview": "/**\n * Copyright 2011, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/licens"
},
{
"path": "flash/src/com/image/JPEGEncoder.as",
"chars": 19374,
"preview": "package com.image\n{\n\t/*\n\t*\n\t* MUCH (4x) faster version of jpeg encoder. Use instead of com.adobe.images.JPGEncoder\n\t*\n\t*"
},
{
"path": "flash/src/com/image/PNG.as",
"chars": 1497,
"preview": "/**\n * Copyright 2011, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/licens"
},
{
"path": "flash/src/com/image/ascb/filters/ColorMatrixArrays.as",
"chars": 1657,
"preview": "package com.image.ascb.filters {\n\n\tpublic class ColorMatrixArrays {\n\n\t\tpublic static const DIGITAL_NEGATIVE:Array = [-1,"
},
{
"path": "flash/src/com/image/ascb/filters/ConvolutionMatrixArrays.as",
"chars": 292,
"preview": "package com.image.ascb.filters {\n\n\tpublic class ConvolutionMatrixArrays {\n\n\t\tpublic static const EMBOSS:Array = [-2, -1,"
},
{
"path": "flash/src/com/image/events/ExifParserEvent.as",
"chars": 611,
"preview": "/**\n * Copyright 2011, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/licens"
},
{
"path": "flash/src/com/image/formatlos/BitmapDataUnlimited.as",
"chars": 8069,
"preview": "/*\nCopyright (c) 2008 Martin Raedlinger (mr@formatlos.de)\n\nPermission is hereby granted, free of charge, to any person o"
},
{
"path": "flash/src/com/image/formatlos/Gif.as",
"chars": 4716,
"preview": "/*\nCopyright (c) 2008 Martin Raedlinger (mr@formatlos.de)\n\nPermission is hereby granted, free of charge, to any person o"
},
{
"path": "flash/src/com/image/formatlos/events/BitmapDataUnlimitedEvent.as",
"chars": 1655,
"preview": "/*\rCopyright (c) 2008 Martin Raedlinger (mr@formatlos.de)\r\rPermission is hereby granted, free of charge, to any person o"
},
{
"path": "flash/src/com/utils/BMPDecoder.as",
"chars": 14531,
"preview": "package com.utils {\n\timport flash.display.BitmapData;\n\timport flash.errors.IOError;\n\timport flash.utils.ByteArray;\n\timpo"
},
{
"path": "flash/src/com/utils/Base64.as",
"chars": 5535,
"preview": "/* \n* Copyright (C) 2012 Jean-Philippe Auclair \n* Licensed under the MIT license: http://www.opensource.org/licenses/mit"
},
{
"path": "flash/src/com/utils/BinaryReader.as",
"chars": 1813,
"preview": "/**\n *\n * Copyright 2011, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/lic"
},
{
"path": "flash/src/com/utils/Buffer.as",
"chars": 1150,
"preview": "package com.utils\n{\n\timport flash.net.FileReference;\n\timport flash.utils.ByteArray;\n\n\tpublic class Buffer\n\t{\t\t\n\t\tprivate"
},
{
"path": "flash/src/com/utils/OEventDispatcher.as",
"chars": 1605,
"preview": "package com.utils\n{\n\timport flash.events.EventDispatcher;\n\t\n\tpublic class OEventDispatcher extends EventDispatcher\n\t{\n\t\t"
},
{
"path": "flash/src/com/utils/URLStreamProgress.as",
"chars": 3639,
"preview": "package com.utils\n{\n\timport com.events.URLStreamProgressEvent;\n\t\n\timport flash.events.Event;\n\timport flash.events.EventD"
},
{
"path": "flash/src/com/utils/Utils.as",
"chars": 2625,
"preview": "package com.utils\n{\n public class Utils\n {\n static public function trim(str:String) : String\n {\n "
},
{
"path": "flash/src/com/utils/Zhenpin.as",
"chars": 808,
"preview": "package com.utils\n{\n\timport flash.events.Event;\n\timport flash.events.IOErrorEvent;\n\timport flash.media.Sound;\n\timport fl"
},
{
"path": "jekyll/_config.yml",
"chars": 179,
"preview": "name: Web Uploader\nmarkdown: redcarpet\nredcarpet:\n extensions:\n - with_toc_data\n - html_toc\nhighlighter: true\nbas"
},
{
"path": "jekyll/_includes/comments.html",
"chars": 491,
"preview": "{% if page.commentIssueId %}\n\n<div id=\"ghComments\" class=\"comments\" data-issue-id=\"{{page.commentIssueId}}\">\n <h2>评论<"
},
{
"path": "jekyll/_includes/footer.html",
"chars": 1122,
"preview": "<div id=\"footer\" class=\"footer\">\n <div class=\"footer-inner container\">\n <div class=\"row\">\n <div cla"
},
{
"path": "jekyll/_includes/header.html",
"chars": 1579,
"preview": "<div class=\"navbar navbar-fixed-top navbar-inverse\" role=\"navigation\">\n <div class=\"container\">\n <div class=\"n"
},
{
"path": "jekyll/_layouts/default.html",
"chars": 2405,
"preview": "<!DOCTYPE html>\n<html lang=\"zh-CN\">\n\n<head>\n <meta charset=\"UTF-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"I"
},
{
"path": "jekyll/_layouts/post.html",
"chars": 1245,
"preview": "---\nlayout: default\n---\n\n{% if page.bannerTitle %}\n<!-- Main jumbotron for a primary marketing message or call to action"
},
{
"path": "jekyll/_plugins/fancytoc.rb",
"chars": 306,
"preview": "\nmodule Jekyll\n module FancyToCFilter\n def fancytoc(input)\n converter = Redcarpet::Markdown.new(Redcarpet::Rend"
},
{
"path": "jekyll/css/bootstrap-theme.css",
"chars": 14716,
"preview": "/*!\n * Bootstrap v3.0.3 (http://getbootstrap.com)\n * Copyright 2013 Twitter, Inc.\n * Licensed under http://www.apache.or"
},
{
"path": "jekyll/css/bootstrap.css",
"chars": 122848,
"preview": "/*!\n * Bootstrap v3.0.3 (http://getbootstrap.com)\n * Copyright 2013 Twitter, Inc.\n * Licensed under http://www.apache.or"
},
{
"path": "jekyll/css/demo.css",
"chars": 7662,
"preview": "#container {\n color: #838383;\n font-size: 12px;\n}\n\n#uploader .queueList {\n margin: 20px;\n border: 3px dashed"
},
{
"path": "jekyll/css/font-awesome.css",
"chars": 21658,
"preview": "/*!\n * Font Awesome 4.0.3 by @davegandy - http://fontawesome.io - @fontawesome\n * License - http://fontawesome.io/lice"
},
{
"path": "jekyll/css/style.css",
"chars": 9852,
"preview": "body {\n margin-top: 50px;\n font-size: 16px;\n font-family: \"Myriad Pro\", \"Hiragino Sans GB\",\"Microsoft YaHei\",\"微"
},
{
"path": "jekyll/css/syntax.css",
"chars": 3738,
"preview": ".highlight { background: #ffffff; }\n.highlight .c { color: #999988; font-style: italic } /* Comment */\n.highlight .err "
},
{
"path": "jekyll/css/webuploader.css",
"chars": 515,
"preview": ".webuploader-container {\n\tposition: relative;\n}\n.webuploader-element-invisible {\n\tposition: absolute !important;\n\tclip: "
},
{
"path": "jekyll/demo.md",
"chars": 834,
"preview": "---\nlayout: post\ntitle: 演示\nnavName: Demo\ngroup: 'nav'\nweight : 4\nhideTitle: true\nnoToc: true\ncommentIssueId: 81\nstyles:\n"
},
{
"path": "jekyll/doc/css/doc.css",
"chars": 1026,
"preview": "ul.signature {\n margin: 1em 0;\n padding: 0;\n font: normal 12px/18px Monaco, Consolas, \"Lucida Console\", monospa"
},
{
"path": "jekyll/doc/index.html",
"chars": 64485,
"preview": "---\nlayout: default\ntitle: WebUploader API文档\nnavName: API\ngroup: 'nav'\nweight : 3\nstyles:\n - /doc/css/doc.css\n---\n\n "
},
{
"path": "jekyll/document.md",
"chars": 4831,
"preview": "---\nlayout: post\ntitle: 文档\nnavName: Document\ngroup: 'nav'\nweight : 2\nhideTitle: true\ncommentIssueId: 80\n---\n\n## 接口说明\nWeb"
},
{
"path": "jekyll/download.md",
"chars": 2447,
"preview": "---\nlayout: post\ntitle: 下载\nnavName: Download\ngroup: 'nav'\nweight : 5\nhideTitle: true\ncommentIssueId: 82\n---\n## 包内容\n\n下载包中"
},
{
"path": "jekyll/getting-started.md",
"chars": 5912,
"preview": "---\nlayout: post\ntitle: 快速开始\nnavName: Getting started\ngroup: 'nav'\nweight : 1,\nstyles:\n - /css/webuploader.css\nscripts:"
},
{
"path": "jekyll/index.md",
"chars": 2798,
"preview": "---\nlayout: default\ntitle: Web Uploader\n---\n\n<!-- Main jumbotron for a primary marketing message or call to action -->\n<"
},
{
"path": "jekyll/js/bootstrap.js",
"chars": 58533,
"preview": "/*!\n * Bootstrap v3.0.3 (http://getbootstrap.com)\n * Copyright 2013 Twitter, Inc.\n * Licensed under http://www.apache.or"
},
{
"path": "jekyll/js/demo.js",
"chars": 12629,
"preview": "jQuery(function() {\n var $ = jQuery, // just in case. Make sure it's not an other libaray.\n\n $wrap = $('#up"
},
{
"path": "jekyll/js/getting-started.js",
"chars": 4862,
"preview": "// 文件上传\njQuery(function() {\n var $ = jQuery,\n $list = $('#thelist'),\n $btn = $('#ctlBtn'),\n stat"
},
{
"path": "jekyll/js/global.js",
"chars": 2401,
"preview": "jQuery(function() {\n var $ = jQuery,\n $toc = $('.post-toc');\n\n\n\n $toc.each(function() {\n var $this ="
},
{
"path": "jekyll/js/webuploader.js",
"chars": 271894,
"preview": "/*! WebUploader 0.1.8-alpha */\n\n\n/**\n * @fileOverview 让内部各个部件的代码可以用[amd](https://github.com/amdjs/amdjs-api/wiki/AMD)模块定"
},
{
"path": "package.json",
"chars": 967,
"preview": "{\n \"name\": \"WebUploader\",\n \"version\": \"0.1.8-alpha\",\n \"description\": \"WebUploader是一个简单的以Html5为主,Flash为辅的现代文件上传组件。在现代的"
},
{
"path": "server/crossdomain.xml",
"chars": 100,
"preview": "<?xml version=\"1.0\" ?>\n<cross-domain-policy>\n<allow-access-from domain=\"*\" />\n</cross-domain-policy>"
},
{
"path": "server/fileupload.php",
"chars": 5003,
"preview": "<?php\n/**\n * upload.php\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://"
},
{
"path": "server/fileupload2.php",
"chars": 4958,
"preview": "<?php\n/**\n * upload.php\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://"
},
{
"path": "server/preview.php",
"chars": 2255,
"preview": "<?php\n/**\n * 此页面用来协助 IE6/7 预览图片,因为 IE 6/7 不支持 base64\n */\n\n#!! 注意\n#!! 此文件只是个示例,不要用于真正的产品之中。\n#!! 不保证代码安全性。\n#!! IMPORTANT:\n"
},
{
"path": "src/base.js",
"chars": 10020,
"preview": "/**\n * @fileOverview 基础类方法。\n */\n\n/**\n * Web Uploader内部类的详细说明,以下提及的功能类,都可以在`WebUploader`这个变量中访问到。\n *\n * As you know, Web "
},
{
"path": "src/dollar-builtin.js",
"chars": 6560,
"preview": "/**\n * @fileOverview jq-bridge 主要实现像jQuery一样的功能方法,可以替换成jQuery,\n * 这里只实现了此组件所需的部分。\n *\n * **此文件的代码还不可用,还是直接用jquery吧**\n * "
}
]
// ... and 76 more files (download for full content)
About this extraction
This page contains the full source code of the fex-team/webuploader GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 276 files (3.9 MB), approximately 1.0M tokens, and a symbol index with 716 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.