Skip to content

Commit

Permalink
Release 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leif-ibsen committed Apr 20, 2023
1 parent 2c4d168 commit 311da8e
Show file tree
Hide file tree
Showing 42 changed files with 4,334 additions and 266 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.3
// swift-tools-version: 5.7
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It is based on ChaCha20 encryption and Poly1305 authentication as defined in [RF
In your project Package.swift file add a dependency like<br/>

dependencies: [
.package(url: "https://github.com/leif-ibsen/SwiftChaChaPoly", from: "1.0.1"),
.package(url: "https://github.com/leif-ibsen/SwiftChaChaPoly", from: "1.1.0"),
]

<h2><b>Example</b></h2>
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftChaChaPoly/ChaCha20.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct ChaCha20 {
self.state11 = ChaCha20.wordFromBytes(key, 28)
self.state13 = ChaCha20.wordFromBytes(nonce, 0)
self.state14 = ChaCha20.wordFromBytes(nonce, 4)
self.state15 = ChaCha20.wordFromBytes(nonce, 08)
self.state15 = ChaCha20.wordFromBytes(nonce, 8)
}

// [RFC-7539] section 2.3
Expand Down
6 changes: 4 additions & 2 deletions Sources/SwiftChaChaPoly/Poly1305.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ class Poly1305 {
for i in (0 ..< min(8, remaining)).reversed() {
b0 = b0 << 8 | Limb(text[index + i])
}
for i in (8 ..< min(16, remaining)).reversed() {
b1 = b1 << 8 | Limb(text[index + i])
if remaining >= 8 {
for i in (8 ..< min(16, remaining)).reversed() {
b1 = b1 << 8 | Limb(text[index + i])
}
}
if remaining < 8 {
b0 |= 1 << (8 * remaining)
Expand Down
7 changes: 0 additions & 7 deletions Tests/LinuxMain.swift

This file was deleted.

14 changes: 14 additions & 0 deletions Tests/SwiftChaChaPolyTests/Test1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import XCTest
@testable import SwiftChaChaPoly

class Test1: XCTestCase {

Expand Down Expand Up @@ -173,4 +174,17 @@ class Test1: XCTestCase {
XCTAssertEqual(t4, plainText4)
}

func test5() {
let key = Bytes(repeating: 17, count: 32)
let nonce = Bytes(repeating: 5, count: 12)
for i in 0 ..< 70 {
let text = Bytes(repeating: 10, count: i)
var x = text
let chacha = ChaChaPoly(key, nonce)
let tag = chacha.encrypt(&x)
let ok = chacha.decrypt(&x, tag)
XCTAssertTrue(ok)
XCTAssertEqual(x, text)
}
}
}
9 changes: 0 additions & 9 deletions Tests/SwiftChaChaPolyTests/XCTestManifests.swift

This file was deleted.

15 changes: 7 additions & 8 deletions docs/Structs.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
<a title="Structures Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html"> Docs</a> (100% documented)</p>
<p class="header-right">
<p><a href="index.html">SwiftChaChaPoly Docs</a> (100% documented)</p>
<div class="header-right">
<form role="search" action="search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
</div>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" />
<a href="index.html">SwiftChaChaPoly Reference</a>
<img id="carat" src="img/carat.png" alt=""/>
Structures Reference
</p>
</div>
Expand Down Expand Up @@ -99,11 +99,10 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2020-10-08)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.5</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2023 <a class="link" href="" target="_blank" rel="external noopener"></a>. All rights reserved. (Last updated: 2023-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
21 changes: 10 additions & 11 deletions docs/Structs/ChaChaPoly.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
<a title="ChaChaPoly Structure Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
<p class="header-right">
<p><a href="../index.html">SwiftChaChaPoly Docs</a> (100% documented)</p>
<div class="header-right">
<form role="search" action="../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
</div>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
<a href="../index.html">SwiftChaChaPoly Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
ChaChaPoly Structure Reference
</p>
</div>
Expand Down Expand Up @@ -77,7 +77,7 @@ <h1>ChaChaPoly</h1>
<a name="//apple_ref/swift/Section/Stored Properties" class="dashAnchor"></a>
<div class="section-name-container">
<a class="section-name-link" href="#/Stored%20Properties"></a>
<h3 class="section-name"><p>Stored Properties</p>
<h3 class="section-name"><span>Stored Properties</span>
</h3>
</div>
</div>
Expand Down Expand Up @@ -144,7 +144,7 @@ <h4>Declaration</h4>
<a name="//apple_ref/swift/Section/Initializers" class="dashAnchor"></a>
<div class="section-name-container">
<a class="section-name-link" href="#/Initializers"></a>
<h3 class="section-name"><p>Initializers</p>
<h3 class="section-name"><span>Initializers</span>
</h3>
</div>
</div>
Expand Down Expand Up @@ -215,7 +215,7 @@ <h4>Parameters</h4>
<a name="//apple_ref/swift/Section/Instance Methods" class="dashAnchor"></a>
<div class="section-name-container">
<a class="section-name-link" href="#/Instance%20Methods"></a>
<h3 class="section-name"><p>Instance Methods</p>
<h3 class="section-name"><span>Instance Methods</span>
</h3>
</div>
</div>
Expand Down Expand Up @@ -361,11 +361,10 @@ <h4>Return Value</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2020-10-08)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.5</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2023 <a class="link" href="" target="_blank" rel="external noopener"></a>. All rights reserved. (Last updated: 2023-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
15 changes: 7 additions & 8 deletions docs/Typealiases.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
<a title="Type Aliases Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html"> Docs</a> (100% documented)</p>
<p class="header-right">
<p><a href="index.html">SwiftChaChaPoly Docs</a> (100% documented)</p>
<div class="header-right">
<form role="search" action="search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
</div>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" />
<a href="index.html">SwiftChaChaPoly Reference</a>
<img id="carat" src="img/carat.png" alt=""/>
Type Aliases Reference
</p>
</div>
Expand Down Expand Up @@ -125,11 +125,10 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2020-10-08)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.5</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2023 <a class="link" href="" target="_blank" rel="external noopener"></a>. All rights reserved. (Last updated: 2023-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
Loading

0 comments on commit 311da8e

Please sign in to comment.