Skip to content

Commit 17d1b2c

Browse files
authored
Merge pull request #135 from dart-lang/merge-crypto-package
Merge `package:crypto`
2 parents 0240a52 + 5a1b799 commit 17d1b2c

34 files changed

+4856
-0
lines changed

.github/labeler.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
- changed-files:
55
- any-glob-to-any-file: 'pkgs/args/**'
66

7+
"package:crypto":
8+
- changed-files:
9+
- any-glob-to-any-file: 'pkgs/crypto/**'
10+
711
"package:fixnum":
812
- changed-files:
913
- any-glob-to-any-file: 'pkgs/fixnum/**'

.github/workflows/crypto.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: package:crypto
2+
3+
on:
4+
# Run CI on pushes to the main branch, and on PRs against main.
5+
push:
6+
branches: [ main ]
7+
paths:
8+
- '.github/workflows/crypto.yaml'
9+
- 'pkgs/crypto/**'
10+
pull_request:
11+
branches: [ main ]
12+
paths:
13+
- '.github/workflows/crypto.yaml'
14+
- 'pkgs/crypto/**'
15+
schedule:
16+
- cron: "0 0 * * 0"
17+
env:
18+
PUB_ENVIRONMENT: bot.github
19+
20+
defaults:
21+
run:
22+
working-directory: pkgs/crypto/
23+
24+
jobs:
25+
# Check code formatting and static analysis on a single OS (linux)
26+
# against Dart dev.
27+
analyze:
28+
runs-on: ubuntu-latest
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
sdk: [dev]
33+
steps:
34+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
35+
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
36+
with:
37+
sdk: ${{ matrix.sdk }}
38+
- id: install
39+
name: Install dependencies
40+
run: dart pub get
41+
- name: Check formatting
42+
run: dart format --output=none --set-exit-if-changed .
43+
if: always() && steps.install.outcome == 'success'
44+
- name: Analyze code
45+
run: dart analyze --fatal-infos
46+
if: always() && steps.install.outcome == 'success'
47+
48+
# Run tests on a matrix consisting of two dimensions:
49+
# 1. OS: ubuntu-latest, (macos-latest, windows-latest)
50+
# 2. release channel: dev
51+
test:
52+
needs: analyze
53+
runs-on: ${{ matrix.os }}
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
# Add macos-latest and/or windows-latest if relevant for this package.
58+
os: [ubuntu-latest]
59+
sdk: [3.4, dev]
60+
steps:
61+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
62+
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
63+
with:
64+
sdk: ${{ matrix.sdk }}
65+
- id: install
66+
name: Install dependencies
67+
run: dart pub get
68+
- name: Run VM tests
69+
run: dart test --platform vm
70+
if: always() && steps.install.outcome == 'success'
71+
- name: Run Chrome tests
72+
run: dart test --platform chrome
73+
if: always() && steps.install.outcome == 'success'
74+
- name: Run Chrome tests - wasm
75+
# TODO: investigate why we get hangs when concurrency is > 1
76+
run: dart test --platform chrome --compiler dart2wasm -j 1
77+
if: always() && steps.install.outcome == 'success'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This repository is home to various Dart packages under the [dart.dev](https://pu
99
| Package | Description | Version |
1010
|---|---|---|
1111
| [args](pkgs/args/) | Library for defining parsers for parsing raw command-line arguments into a set of options and values. | [![pub package](https://img.shields.io/pub/v/args.svg)](https://pub.dev/packages/args) |
12+
| [crypto](pkgs/crypto/) | Implementations of SHA, MD5, and HMAC cryptographic functions. | [![pub package](https://img.shields.io/pub/v/crypto.svg)](https://pub.dev/packages/crypto) |
1213
| [fixnum](pkgs/fixnum/) | Library for 32- and 64-bit signed fixed-width integers. | [![pub package](https://img.shields.io/pub/v/fixnum.svg)](https://pub.dev/packages/fixnum) |
1314

1415
## Publishing automation

pkgs/crypto/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.dart_tool
2+
.packages
3+
pubspec.lock

pkgs/crypto/.test_config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"test_package": {
3+
"platforms": ["vm"]
4+
}
5+
}

pkgs/crypto/AUTHORS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Below is a list of people and organizations that have contributed
2+
# to the project. Names should be added to the list like so:
3+
#
4+
# Name/Organization <email address>
5+
6+
Google Inc.

pkgs/crypto/CHANGELOG.md

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
## 3.0.6
2+
3+
* Move to `dart-lang/core` monorepo.
4+
5+
## 3.0.5
6+
7+
* Revert switch to enable fast "sinks" on Wasm because it breaks `dart2js` with
8+
server mode.
9+
10+
## 3.0.4
11+
12+
* Fix WebAssembly support.
13+
* Require Dart 3.4
14+
15+
## 3.0.3
16+
17+
* Require Dart 2.19.0.
18+
* Add topics to `pubspec.yaml`.
19+
20+
## 3.0.2
21+
22+
* Require Dart 2.14.0.
23+
* Fix bug calculating hashes for content larger than 512MB when compiled to JS.
24+
25+
## 3.0.1
26+
27+
* Fix doc links in README.
28+
29+
## 3.0.0
30+
31+
* Stable release for null safety.
32+
* Adds SHA-2 512/224 and SHA-2 512/256 from FIPS 180-4
33+
* Removes `newInstance` instance members on some classes
34+
and updates documentation.
35+
36+
## 2.1.5
37+
38+
* Improve example and package description to address package site maintenance
39+
suggestions.
40+
41+
## 2.1.4
42+
* BugFix: padding was incorrect for some SHA-512/328.
43+
44+
## 2.1.3
45+
* **Security vulnerability**: Fixed constant-time comparison in `Digest`.
46+
47+
## 2.1.2
48+
* Fix bug in SHA-2 384/512 blocksize.
49+
* Added HMAC-SHA-2 test vectors
50+
51+
## 2.1.1+1
52+
* Bump version number for publish mishap (spare file uploaded with `pub
53+
publish`).
54+
55+
## 2.1.1
56+
* Added a workaround for a bug in DDC (used in build_web_compilers 1.x).
57+
This bug is not present in DDK (used in build_web_compilers 2.x).
58+
59+
## 2.1.0
60+
* Added SHA384, and SHA512
61+
* Add Sha224 + Refactor
62+
* Support 32bit and 64bit operations for SHA384/51
63+
* Add conditional imports
64+
* De-listify 32bit allocations
65+
* Add sha monte tests for 224,256,384, and 512
66+
67+
## 2.0.5
68+
69+
* Changed the max message size instead to 0x3ffffffffffff, which is the largest
70+
portable value for both JS and the Dart VM.
71+
72+
## 2.0.4
73+
74+
* Made max message size a BigNum instead of an int so that dart2js can compile
75+
with crypto.
76+
77+
## 2.0.3
78+
79+
* Updated SDK version to 2.0.0-dev.17.0
80+
81+
## 2.0.2+1
82+
83+
* Fix SDK constraint.
84+
85+
## 2.0.2
86+
87+
* Prepare `HashSink` implementation for limiting integers to 64 bits in Dart
88+
language.
89+
90+
## 2.0.1
91+
92+
* Support `convert` 2.0.0.
93+
94+
## 2.0.0
95+
96+
**Note**: There are no APIs in 2.0.0 that weren't also in 0.9.2. Packages that
97+
would use 2.0.0 as a lower bound should use 0.9.2 instead—for example, `crypto:
98+
">=0.9.2 <3.0.0"`.
99+
100+
* `Hash` and `Hmac` no longer extend `ChunkedConverter`.
101+
102+
## 1.1.1
103+
104+
* Properly close sinks passed to `Hash.startChunkedConversion()` when
105+
`ByteConversionSink.close()` is called.
106+
107+
## 1.1.0
108+
109+
* `Hmac` and `Hash` now extend the new `ChunkedConverter` class from
110+
`dart:convert`.
111+
112+
* Fix all strong mode warnings.
113+
114+
## 1.0.0
115+
116+
* All APIs that were deprecated in 0.9.2 have been removed. No new APIs have
117+
been added. Packages that would use 1.0.0 as a lower bound should use 0.9.2
118+
instead—for example, `crypto: ">=0.9.2 <2.0.0"`.
119+
120+
## 0.9.2+1
121+
122+
* Avoid core library methods that don't work on dart2js.
123+
124+
## 0.9.2
125+
126+
* `Hash`, `MD5`, `SHA1`, and `SHA256` now implement `Converter`. They convert
127+
between `List<int>`s and the new `Digest` class, which represents a hash
128+
digest. The `Converter` APIs—`Hash.convert()` and
129+
`Hash.startChunkedConversion`—should be used in preference to the old APIs,
130+
which are now deprecated.
131+
132+
* `SHA1`, `SHA256`, and `HMAC` have been renamed to `Sha1`, `Sha256`, and
133+
`Hmac`, respectively. The old names still work, but are deprecated.
134+
135+
* Top-level `sha1`, `sha256`, and `md5` fields have been added to make it easier
136+
to use those hash algorithms without having to instantiate new instances.
137+
138+
* Hashing now works correctly for input sizes up to 2^64 bytes.
139+
140+
### Deprecations
141+
142+
* `Hash.add`, `Hash.close`, and `Hash.newInstance` are deprecated.
143+
`Hash.convert` should be used for hashing single values, and
144+
`Hash.startChunkedConversion` should be used for hashing streamed values.
145+
146+
* `SHA1` and `SHA256` are deprecated. Use the top-level `sha1` and `sha256`
147+
fields instead.
148+
149+
* While the `MD5` class is not deprecated, the `new MD5()` constructor is. Use
150+
the top-level `md5` field instead.
151+
152+
* `HMAC` is deprecated. Use `Hmac` instead.
153+
154+
* `Base64Codec`, `Base64Encoder`, `Base64Decoder`, `Base64EncoderSink`,
155+
`Base64DecoderSink`, and `BASE64` are deprecated. Use the Base64 APIs in
156+
`dart:convert` instead.
157+
158+
* `CryptoUtils` is deprecated. Use the Base64 APIs in `dart:convert` and the hex
159+
APIs in the `convert` package instead.
160+
161+
## 0.9.1
162+
163+
* Base64 convert returns an Uint8List
164+
* Base64 codec and encoder can now take an encodePaddingCharacter
165+
* Implement a Base64 codec similar to codecs in 'dart:convert'
166+
167+
## 0.9.0
168+
169+
* ChangeLog starts here.

pkgs/crypto/LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright 2015, the Dart project authors.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following
11+
disclaimer in the documentation and/or other materials provided
12+
with the distribution.
13+
* Neither the name of Google LLC nor the names of its
14+
contributors may be used to endorse or promote products derived
15+
from this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)