rm-digest 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +39 -0
- data/Rakefile +2 -0
- data/lib/rm-digest.rb +20 -0
- data/lib/rm-digest/md5.rb +17 -0
- data/lib/rm-digest/sha1.rb +17 -0
- data/lib/rm-digest/util.rb +14 -0
- data/lib/rm-digest/version.rb +3 -0
- data/rm-digest.gemspec +16 -0
- data/vendor/MD5SHA1Digest/MD5SHA1Digest.bridgesupport +3 -0
- data/vendor/MD5SHA1Digest/MD5SHA1Digest.xcodeproj/project.pbxproj +255 -0
- data/vendor/MD5SHA1Digest/MD5SHA1Digest/MD5SHA1Digest-Prefix.pch +7 -0
- data/vendor/MD5SHA1Digest/MD5SHA1Digest/NSData+MD5Digest.h +18 -0
- data/vendor/MD5SHA1Digest/MD5SHA1Digest/NSData+MD5Digest.m +40 -0
- data/vendor/MD5SHA1Digest/MD5SHA1Digest/NSData+SHA1Digest.h +19 -0
- data/vendor/MD5SHA1Digest/MD5SHA1Digest/NSData+SHA1Digest.m +40 -0
- metadata +63 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Tom Meinlschmidt
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# RmDigest
|
2
|
+
|
3
|
+
Simple gem to provide MD5 and SHA1 digest functionality. It uses ObjC library, included in ```vendor``` directory
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'rm-digest'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install rm-digest
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```
|
22
|
+
digestSHA1String = RmDigest::SHA1.hexdigest('some string')
|
23
|
+
digestMD51String = RmDigest::MD5.hexdigest('some string')
|
24
|
+
```
|
25
|
+
|
26
|
+
Gem provides byte based digests
|
27
|
+
|
28
|
+
```
|
29
|
+
digestSHA1Bytes = RmDigest::SHA1.digest('some string')
|
30
|
+
digestMD51Bytes = RmDigest::MD5.digest('some string')
|
31
|
+
```
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/rm-digest.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
unless defined?(Motion::Project::Config)
|
2
|
+
raise "This file must be required within a RubyMotion project Rakefile."
|
3
|
+
end
|
4
|
+
|
5
|
+
Motion::Project::App.setup do |app|
|
6
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'rm-digest/*.rb')).each do |file|
|
7
|
+
app.files.unshift(file)
|
8
|
+
end
|
9
|
+
digest_vendor = File.expand_path(File.join(File.dirname(__FILE__), '../vendor/MD5SHA1Digest'))
|
10
|
+
app.vendor_project(digest_vendor, :xcode, headers_dir: 'MD5SHA1Digest')
|
11
|
+
end
|
12
|
+
|
13
|
+
require "rm-digest/version"
|
14
|
+
require File.expand_path('../rm-digest/util', __FILE__)
|
15
|
+
require File.expand_path('../rm-digest/sha1', __FILE__)
|
16
|
+
require File.expand_path('../rm-digest/md5', __FILE__)
|
17
|
+
|
18
|
+
module RmDigest
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RmDigest
|
2
|
+
module MD5
|
3
|
+
|
4
|
+
class << self
|
5
|
+
|
6
|
+
def hexdigest(string, encoding = NSUTF8StringEncoding)
|
7
|
+
RmDigest::Util.toNSData(string, encoding).MD5HexDigest
|
8
|
+
end
|
9
|
+
|
10
|
+
def digest(string, encoding = NSUTF8StringEncoding)
|
11
|
+
RmDigest::Util.toNSData(string, encoding).MD5Digest
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RmDigest
|
2
|
+
module SHA1
|
3
|
+
|
4
|
+
class << self
|
5
|
+
|
6
|
+
def hexdigest(string, encoding = NSUTF8StringEncoding)
|
7
|
+
RmDigest::Util.toNSData(string, encoding).SHA1HexDigest
|
8
|
+
end
|
9
|
+
|
10
|
+
def digest(string, encoding = NSUTF8StringEncoding)
|
11
|
+
RmDigest::Util.toNSData(string, encoding).SHA1Digest
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
data/rm-digest.gemspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/rm-digest/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Tom Meinlschmidt"]
|
6
|
+
gem.email = ["tomas@meinlschmidt.com"]
|
7
|
+
gem.description = %q{MD5 and SHA1 Digest}
|
8
|
+
gem.summary = %q{MD5 and SHA1 Digest}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
|
+
gem.name = "rm-digest"
|
14
|
+
gem.require_paths = ["lib"]
|
15
|
+
gem.version = RmDigest::VERSION
|
16
|
+
end
|
@@ -0,0 +1,255 @@
|
|
1
|
+
// !$*UTF8*$!
|
2
|
+
{
|
3
|
+
archiveVersion = 1;
|
4
|
+
classes = {
|
5
|
+
};
|
6
|
+
objectVersion = 46;
|
7
|
+
objects = {
|
8
|
+
|
9
|
+
/* Begin PBXBuildFile section */
|
10
|
+
1B352E4716DED0F6007C4ECE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B352E4616DED0F6007C4ECE /* Foundation.framework */; };
|
11
|
+
1B352E5616DED12C007C4ECE /* NSData+MD5Digest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B352E5516DED12C007C4ECE /* NSData+MD5Digest.m */; };
|
12
|
+
1B352E5916DED18F007C4ECE /* NSData+SHA1Digest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B352E5816DED18F007C4ECE /* NSData+SHA1Digest.m */; };
|
13
|
+
/* End PBXBuildFile section */
|
14
|
+
|
15
|
+
/* Begin PBXCopyFilesBuildPhase section */
|
16
|
+
1B352E4116DED0F6007C4ECE /* CopyFiles */ = {
|
17
|
+
isa = PBXCopyFilesBuildPhase;
|
18
|
+
buildActionMask = 2147483647;
|
19
|
+
dstPath = "include/${PRODUCT_NAME}";
|
20
|
+
dstSubfolderSpec = 16;
|
21
|
+
files = (
|
22
|
+
);
|
23
|
+
runOnlyForDeploymentPostprocessing = 0;
|
24
|
+
};
|
25
|
+
/* End PBXCopyFilesBuildPhase section */
|
26
|
+
|
27
|
+
/* Begin PBXFileReference section */
|
28
|
+
1B352E4316DED0F6007C4ECE /* libMD5SHA1Digest.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMD5SHA1Digest.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
29
|
+
1B352E4616DED0F6007C4ECE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
30
|
+
1B352E4A16DED0F6007C4ECE /* MD5SHA1Digest-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MD5SHA1Digest-Prefix.pch"; sourceTree = "<group>"; };
|
31
|
+
1B352E5416DED12C007C4ECE /* NSData+MD5Digest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+MD5Digest.h"; sourceTree = "<group>"; };
|
32
|
+
1B352E5516DED12C007C4ECE /* NSData+MD5Digest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+MD5Digest.m"; sourceTree = "<group>"; };
|
33
|
+
1B352E5716DED18F007C4ECE /* NSData+SHA1Digest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+SHA1Digest.h"; sourceTree = "<group>"; };
|
34
|
+
1B352E5816DED18F007C4ECE /* NSData+SHA1Digest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+SHA1Digest.m"; sourceTree = "<group>"; };
|
35
|
+
/* End PBXFileReference section */
|
36
|
+
|
37
|
+
/* Begin PBXFrameworksBuildPhase section */
|
38
|
+
1B352E4016DED0F6007C4ECE /* Frameworks */ = {
|
39
|
+
isa = PBXFrameworksBuildPhase;
|
40
|
+
buildActionMask = 2147483647;
|
41
|
+
files = (
|
42
|
+
1B352E4716DED0F6007C4ECE /* Foundation.framework in Frameworks */,
|
43
|
+
);
|
44
|
+
runOnlyForDeploymentPostprocessing = 0;
|
45
|
+
};
|
46
|
+
/* End PBXFrameworksBuildPhase section */
|
47
|
+
|
48
|
+
/* Begin PBXGroup section */
|
49
|
+
1B352E3A16DED0F6007C4ECE = {
|
50
|
+
isa = PBXGroup;
|
51
|
+
children = (
|
52
|
+
1B352E4816DED0F6007C4ECE /* MD5SHA1Digest */,
|
53
|
+
1B352E4516DED0F6007C4ECE /* Frameworks */,
|
54
|
+
1B352E4416DED0F6007C4ECE /* Products */,
|
55
|
+
);
|
56
|
+
sourceTree = "<group>";
|
57
|
+
};
|
58
|
+
1B352E4416DED0F6007C4ECE /* Products */ = {
|
59
|
+
isa = PBXGroup;
|
60
|
+
children = (
|
61
|
+
1B352E4316DED0F6007C4ECE /* libMD5SHA1Digest.a */,
|
62
|
+
);
|
63
|
+
name = Products;
|
64
|
+
sourceTree = "<group>";
|
65
|
+
};
|
66
|
+
1B352E4516DED0F6007C4ECE /* Frameworks */ = {
|
67
|
+
isa = PBXGroup;
|
68
|
+
children = (
|
69
|
+
1B352E4616DED0F6007C4ECE /* Foundation.framework */,
|
70
|
+
);
|
71
|
+
name = Frameworks;
|
72
|
+
sourceTree = "<group>";
|
73
|
+
};
|
74
|
+
1B352E4816DED0F6007C4ECE /* MD5SHA1Digest */ = {
|
75
|
+
isa = PBXGroup;
|
76
|
+
children = (
|
77
|
+
1B352E4916DED0F6007C4ECE /* Supporting Files */,
|
78
|
+
1B352E5416DED12C007C4ECE /* NSData+MD5Digest.h */,
|
79
|
+
1B352E5516DED12C007C4ECE /* NSData+MD5Digest.m */,
|
80
|
+
1B352E5716DED18F007C4ECE /* NSData+SHA1Digest.h */,
|
81
|
+
1B352E5816DED18F007C4ECE /* NSData+SHA1Digest.m */,
|
82
|
+
);
|
83
|
+
path = MD5SHA1Digest;
|
84
|
+
sourceTree = "<group>";
|
85
|
+
};
|
86
|
+
1B352E4916DED0F6007C4ECE /* Supporting Files */ = {
|
87
|
+
isa = PBXGroup;
|
88
|
+
children = (
|
89
|
+
1B352E4A16DED0F6007C4ECE /* MD5SHA1Digest-Prefix.pch */,
|
90
|
+
);
|
91
|
+
name = "Supporting Files";
|
92
|
+
sourceTree = "<group>";
|
93
|
+
};
|
94
|
+
/* End PBXGroup section */
|
95
|
+
|
96
|
+
/* Begin PBXNativeTarget section */
|
97
|
+
1B352E4216DED0F6007C4ECE /* MD5SHA1Digest */ = {
|
98
|
+
isa = PBXNativeTarget;
|
99
|
+
buildConfigurationList = 1B352E5116DED0F6007C4ECE /* Build configuration list for PBXNativeTarget "MD5SHA1Digest" */;
|
100
|
+
buildPhases = (
|
101
|
+
1B352E3F16DED0F6007C4ECE /* Sources */,
|
102
|
+
1B352E4016DED0F6007C4ECE /* Frameworks */,
|
103
|
+
1B352E4116DED0F6007C4ECE /* CopyFiles */,
|
104
|
+
);
|
105
|
+
buildRules = (
|
106
|
+
);
|
107
|
+
dependencies = (
|
108
|
+
);
|
109
|
+
name = MD5SHA1Digest;
|
110
|
+
productName = MD5SHA1Digest;
|
111
|
+
productReference = 1B352E4316DED0F6007C4ECE /* libMD5SHA1Digest.a */;
|
112
|
+
productType = "com.apple.product-type.library.static";
|
113
|
+
};
|
114
|
+
/* End PBXNativeTarget section */
|
115
|
+
|
116
|
+
/* Begin PBXProject section */
|
117
|
+
1B352E3B16DED0F6007C4ECE /* Project object */ = {
|
118
|
+
isa = PBXProject;
|
119
|
+
attributes = {
|
120
|
+
LastUpgradeCheck = 0460;
|
121
|
+
ORGANIZATIONNAME = "Tom Meinlschmidt";
|
122
|
+
};
|
123
|
+
buildConfigurationList = 1B352E3E16DED0F6007C4ECE /* Build configuration list for PBXProject "MD5SHA1Digest" */;
|
124
|
+
compatibilityVersion = "Xcode 3.2";
|
125
|
+
developmentRegion = English;
|
126
|
+
hasScannedForEncodings = 0;
|
127
|
+
knownRegions = (
|
128
|
+
en,
|
129
|
+
);
|
130
|
+
mainGroup = 1B352E3A16DED0F6007C4ECE;
|
131
|
+
productRefGroup = 1B352E4416DED0F6007C4ECE /* Products */;
|
132
|
+
projectDirPath = "";
|
133
|
+
projectRoot = "";
|
134
|
+
targets = (
|
135
|
+
1B352E4216DED0F6007C4ECE /* MD5SHA1Digest */,
|
136
|
+
);
|
137
|
+
};
|
138
|
+
/* End PBXProject section */
|
139
|
+
|
140
|
+
/* Begin PBXSourcesBuildPhase section */
|
141
|
+
1B352E3F16DED0F6007C4ECE /* Sources */ = {
|
142
|
+
isa = PBXSourcesBuildPhase;
|
143
|
+
buildActionMask = 2147483647;
|
144
|
+
files = (
|
145
|
+
1B352E5616DED12C007C4ECE /* NSData+MD5Digest.m in Sources */,
|
146
|
+
1B352E5916DED18F007C4ECE /* NSData+SHA1Digest.m in Sources */,
|
147
|
+
);
|
148
|
+
runOnlyForDeploymentPostprocessing = 0;
|
149
|
+
};
|
150
|
+
/* End PBXSourcesBuildPhase section */
|
151
|
+
|
152
|
+
/* Begin XCBuildConfiguration section */
|
153
|
+
1B352E4F16DED0F6007C4ECE /* Debug */ = {
|
154
|
+
isa = XCBuildConfiguration;
|
155
|
+
buildSettings = {
|
156
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
157
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
158
|
+
CLANG_CXX_LIBRARY = "libc++";
|
159
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
160
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
161
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
162
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
163
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
164
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
165
|
+
COPY_PHASE_STRIP = NO;
|
166
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
167
|
+
GCC_DYNAMIC_NO_PIC = NO;
|
168
|
+
GCC_OPTIMIZATION_LEVEL = 0;
|
169
|
+
GCC_PREPROCESSOR_DEFINITIONS = (
|
170
|
+
"DEBUG=1",
|
171
|
+
"$(inherited)",
|
172
|
+
);
|
173
|
+
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
174
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
175
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
176
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
177
|
+
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
178
|
+
ONLY_ACTIVE_ARCH = YES;
|
179
|
+
SDKROOT = iphoneos;
|
180
|
+
TARGETED_DEVICE_FAMILY = "1,2";
|
181
|
+
};
|
182
|
+
name = Debug;
|
183
|
+
};
|
184
|
+
1B352E5016DED0F6007C4ECE /* Release */ = {
|
185
|
+
isa = XCBuildConfiguration;
|
186
|
+
buildSettings = {
|
187
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
188
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
189
|
+
CLANG_CXX_LIBRARY = "libc++";
|
190
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
191
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
192
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
193
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
194
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
195
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
196
|
+
COPY_PHASE_STRIP = YES;
|
197
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
198
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
199
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
200
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
201
|
+
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
202
|
+
SDKROOT = iphoneos;
|
203
|
+
TARGETED_DEVICE_FAMILY = "1,2";
|
204
|
+
VALIDATE_PRODUCT = YES;
|
205
|
+
};
|
206
|
+
name = Release;
|
207
|
+
};
|
208
|
+
1B352E5216DED0F6007C4ECE /* Debug */ = {
|
209
|
+
isa = XCBuildConfiguration;
|
210
|
+
buildSettings = {
|
211
|
+
DSTROOT = /tmp/MD5SHA1Digest.dst;
|
212
|
+
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
213
|
+
GCC_PREFIX_HEADER = "MD5SHA1Digest/MD5SHA1Digest-Prefix.pch";
|
214
|
+
OTHER_LDFLAGS = "-ObjC";
|
215
|
+
PRODUCT_NAME = "$(TARGET_NAME)";
|
216
|
+
SKIP_INSTALL = YES;
|
217
|
+
};
|
218
|
+
name = Debug;
|
219
|
+
};
|
220
|
+
1B352E5316DED0F6007C4ECE /* Release */ = {
|
221
|
+
isa = XCBuildConfiguration;
|
222
|
+
buildSettings = {
|
223
|
+
DSTROOT = /tmp/MD5SHA1Digest.dst;
|
224
|
+
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
225
|
+
GCC_PREFIX_HEADER = "MD5SHA1Digest/MD5SHA1Digest-Prefix.pch";
|
226
|
+
OTHER_LDFLAGS = "-ObjC";
|
227
|
+
PRODUCT_NAME = "$(TARGET_NAME)";
|
228
|
+
SKIP_INSTALL = YES;
|
229
|
+
};
|
230
|
+
name = Release;
|
231
|
+
};
|
232
|
+
/* End XCBuildConfiguration section */
|
233
|
+
|
234
|
+
/* Begin XCConfigurationList section */
|
235
|
+
1B352E3E16DED0F6007C4ECE /* Build configuration list for PBXProject "MD5SHA1Digest" */ = {
|
236
|
+
isa = XCConfigurationList;
|
237
|
+
buildConfigurations = (
|
238
|
+
1B352E4F16DED0F6007C4ECE /* Debug */,
|
239
|
+
1B352E5016DED0F6007C4ECE /* Release */,
|
240
|
+
);
|
241
|
+
defaultConfigurationIsVisible = 0;
|
242
|
+
defaultConfigurationName = Release;
|
243
|
+
};
|
244
|
+
1B352E5116DED0F6007C4ECE /* Build configuration list for PBXNativeTarget "MD5SHA1Digest" */ = {
|
245
|
+
isa = XCConfigurationList;
|
246
|
+
buildConfigurations = (
|
247
|
+
1B352E5216DED0F6007C4ECE /* Debug */,
|
248
|
+
1B352E5316DED0F6007C4ECE /* Release */,
|
249
|
+
);
|
250
|
+
defaultConfigurationIsVisible = 0;
|
251
|
+
};
|
252
|
+
/* End XCConfigurationList section */
|
253
|
+
};
|
254
|
+
rootObject = 1B352E3B16DED0F6007C4ECE /* Project object */;
|
255
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
//
|
2
|
+
// NSData+MD5Digest.h
|
3
|
+
// MD5SHA1Digest
|
4
|
+
//
|
5
|
+
// Created by Tom Meinlschmidt on 28.2.2013.
|
6
|
+
// Copyright (c) 2013 Tom Meinlschmidt. All rights reserved.
|
7
|
+
//
|
8
|
+
#import <Foundation/Foundation.h>
|
9
|
+
|
10
|
+
@interface NSData (MD5Digest)
|
11
|
+
|
12
|
+
+(NSData *)MD5Digest:(NSData *)input;
|
13
|
+
-(NSData *)MD5Digest;
|
14
|
+
|
15
|
+
+(NSString *)MD5HexDigest:(NSData *)input;
|
16
|
+
-(NSString *)MD5HexDigest;
|
17
|
+
|
18
|
+
@end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
//
|
2
|
+
// NSData+MD5Digest.m
|
3
|
+
// MD5SHA1Digest
|
4
|
+
//
|
5
|
+
// Created by Tom Meinlschmidt on 28.2.2013.
|
6
|
+
// Copyright (c) 2013 Tom Meinlschmidt. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "NSData+MD5Digest.h"
|
10
|
+
#import <CommonCrypto/CommonDigest.h>
|
11
|
+
|
12
|
+
@implementation NSData (MD5)
|
13
|
+
|
14
|
+
+(NSData *)MD5Digest:(NSData *)input {
|
15
|
+
unsigned char result[CC_MD5_DIGEST_LENGTH];
|
16
|
+
|
17
|
+
CC_MD5(input.bytes, input.length, result);
|
18
|
+
return [[NSData alloc] initWithBytes:result length:CC_MD5_DIGEST_LENGTH];
|
19
|
+
}
|
20
|
+
|
21
|
+
-(NSData *)MD5Digest {
|
22
|
+
return [NSData MD5Digest:self];
|
23
|
+
}
|
24
|
+
|
25
|
+
+(NSString *)MD5HexDigest:(NSData *)input {
|
26
|
+
unsigned char result[CC_MD5_DIGEST_LENGTH];
|
27
|
+
|
28
|
+
CC_MD5(input.bytes, input.length, result);
|
29
|
+
NSMutableString *ret = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH*2];
|
30
|
+
for (int i = 0; i<CC_MD5_DIGEST_LENGTH; i++) {
|
31
|
+
[ret appendFormat:@"%02x",result[i]];
|
32
|
+
}
|
33
|
+
return ret;
|
34
|
+
}
|
35
|
+
|
36
|
+
-(NSString *)MD5HexDigest {
|
37
|
+
return [NSData MD5HexDigest:self];
|
38
|
+
}
|
39
|
+
|
40
|
+
@end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
//
|
2
|
+
// NSData+SHA1Digest.h
|
3
|
+
// MD5SHA1Digest
|
4
|
+
//
|
5
|
+
// Created by Tom Meinlschmidt on 28.2.2013.
|
6
|
+
// Copyright (c) 2013 Tom Meinlschmidt. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
|
11
|
+
@interface NSData (SHA1Digest)
|
12
|
+
|
13
|
+
+(NSData *)SHA1Digest:(NSData *)input;
|
14
|
+
-(NSData *)SHA1Digest;
|
15
|
+
|
16
|
+
+(NSString *)SHA1HexDigest:(NSData *)input;
|
17
|
+
-(NSString *)SHA1HexDigest;
|
18
|
+
|
19
|
+
@end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
//
|
2
|
+
// NSData+SHA1Digest.m
|
3
|
+
// MD5SHA1Digest
|
4
|
+
//
|
5
|
+
// Created by Tom Meinlschmidt on 28.2.2013.
|
6
|
+
// Copyright (c) 2013 Tom Meinlschmidt. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "NSData+SHA1Digest.h"
|
10
|
+
#import <CommonCrypto/CommonDigest.h>
|
11
|
+
|
12
|
+
@implementation NSData (SHA1)
|
13
|
+
|
14
|
+
+(NSData *)SHA1Digest:(NSData *)input {
|
15
|
+
unsigned char result[CC_SHA1_DIGEST_LENGTH];
|
16
|
+
|
17
|
+
CC_SHA1(input.bytes, input.length, result);
|
18
|
+
return [[NSData alloc] initWithBytes:result length:CC_SHA1_DIGEST_LENGTH];
|
19
|
+
}
|
20
|
+
|
21
|
+
-(NSData *)SHA1Digest {
|
22
|
+
return [NSData SHA1Digest:self];
|
23
|
+
}
|
24
|
+
|
25
|
+
+(NSString *)SHA1HexDigest:(NSData *)input {
|
26
|
+
unsigned char result[CC_SHA1_DIGEST_LENGTH];
|
27
|
+
|
28
|
+
CC_SHA1(input.bytes, input.length, result);
|
29
|
+
NSMutableString *ret = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH*2];
|
30
|
+
for (int i = 0; i<CC_SHA1_DIGEST_LENGTH; i++) {
|
31
|
+
[ret appendFormat:@"%02x",result[i]];
|
32
|
+
}
|
33
|
+
return ret;
|
34
|
+
}
|
35
|
+
|
36
|
+
-(NSString *)SHA1HexDigest {
|
37
|
+
return [NSData SHA1HexDigest:self];
|
38
|
+
}
|
39
|
+
|
40
|
+
@end
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rm-digest
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tom Meinlschmidt
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-28 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: MD5 and SHA1 Digest
|
15
|
+
email:
|
16
|
+
- tomas@meinlschmidt.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- lib/rm-digest.rb
|
27
|
+
- lib/rm-digest/md5.rb
|
28
|
+
- lib/rm-digest/sha1.rb
|
29
|
+
- lib/rm-digest/util.rb
|
30
|
+
- lib/rm-digest/version.rb
|
31
|
+
- rm-digest.gemspec
|
32
|
+
- vendor/MD5SHA1Digest/MD5SHA1Digest.bridgesupport
|
33
|
+
- vendor/MD5SHA1Digest/MD5SHA1Digest.xcodeproj/project.pbxproj
|
34
|
+
- vendor/MD5SHA1Digest/MD5SHA1Digest/MD5SHA1Digest-Prefix.pch
|
35
|
+
- vendor/MD5SHA1Digest/MD5SHA1Digest/NSData+MD5Digest.h
|
36
|
+
- vendor/MD5SHA1Digest/MD5SHA1Digest/NSData+MD5Digest.m
|
37
|
+
- vendor/MD5SHA1Digest/MD5SHA1Digest/NSData+SHA1Digest.h
|
38
|
+
- vendor/MD5SHA1Digest/MD5SHA1Digest/NSData+SHA1Digest.m
|
39
|
+
homepage: ''
|
40
|
+
licenses: []
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
requirements: []
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 1.8.10
|
60
|
+
signing_key:
|
61
|
+
specification_version: 3
|
62
|
+
summary: MD5 and SHA1 Digest
|
63
|
+
test_files: []
|