Skip to content

Commit

Permalink
Bump version number to 1.2.1, update CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Koray Koska committed May 27, 2018
1 parent 5c63b8a commit fb754d4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 25 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Version 1.2.1 (2018-05-27)

This release contains the following change:

* Fixed a bug which resulted in a compilation error for Swift 4.1 on Linux.

# Version 1.2.0 (2017-09-07)

This release contains the following changes:
Expand Down Expand Up @@ -26,7 +32,7 @@ This release contains the following changes:

* `SipHasher` now supports appending optional values directly.
* The deployment target for Carthage and standalone builds was set back to iOS 8.0 and macOS 10.9,
the earliest possible OS versions for Swift frameworks. This change does not affect CocoaPod builds, which
the earliest possible OS versions for Swift frameworks. This change does not affect CocoaPod builds, which
already had the same settings.

# Version 1.0.0 (2016-11-15)
Expand Down
41 changes: 20 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Carthage/Carthage)
[![CocoaPod Version](https://img.shields.io/cocoapods/v/SipHash.svg)](http://cocoapods.org/pods/SipHash)

`SipHash` is a pure Swift implementation of the [SipHash] hashing algorithm designed by
`SipHash` is a pure Swift implementation of the [SipHash] hashing algorithm designed by
Jean-Philippe Aumasson and Daniel J. Bernstein in 2012:

[SipHash]: https://131002.net/siphash

> SipHash is a family of pseudorandom functions (a.k.a. keyed hash functions) optimized for speed on short messages.
> SipHash is a family of pseudorandom functions (a.k.a. keyed hash functions) optimized for speed on short messages.
>
> Target applications include network traffic authentication and defense against hash-flooding DoS attacks.
> Target applications include network traffic authentication and defense against hash-flooding DoS attacks.
>
> SipHash is secure, fast, and simple (for real):
> - SipHash is simpler and faster than previous cryptographic algorithms (e.g. MACs based on universal hashing)
Expand All @@ -35,7 +35,7 @@ independent implementation that's available for use in third-party code.

The current release of SipHash requires Swift 4.

## Sample Code
## Sample Code

```swift
import SipHash
Expand All @@ -45,7 +45,7 @@ struct Book: SipHashable {
let title: String
let pageCount: Int

// You need to implement this method instead of `hashValue`.
// You need to implement this method instead of `hashValue`.
func appendHashes(to hasher: inout SipHasher) {
// Simply append the fields you want to include in the hash.
hasher.append(title)
Expand All @@ -67,39 +67,39 @@ var hasher = SipHasher()
hasher.add(book)
hasher.add(42)
// Finalizing the hasher extracts the hash value and invalidates it.
let hash = hasher.finalize()
let hash = hasher.finalize()
```

## Why Would I Use SipHash?

Writing a good implementation of `hashValue` is hard, even if we just need to combine the values of a couple of fields.
We need to come up with a deterministic function that blends the field values well, producing a fixed-width
result without too many collisions on typical inputs. But how many collisions are "too many"? Do we even know what
our "typical inputs" look like? For me, the answer to both of these questions is usually "I have absolutely no idea",
our "typical inputs" look like? For me, the answer to both of these questions is usually "I have absolutely no idea",
and I bet you have the same problem.

Thus, verifying that our `hashValue` implementations work well is an exercise in frustration.

We need to somehow check the properties of the hash function by looking at its behavior given various inputs.
It is easy enough to write tests for the requirement that equal values have equal `hashValues`.
But verifying that the hash has few collisions requires making some assumptions on the
It is easy enough to write tests for the requirement that equal values have equal `hashValues`.
But verifying that the hash has few collisions requires making some assumptions on the
statistical properties of "typical" inputs -- and even if we'd be somehow confident enough to do that, writing the code
to do it is way too complicated.

Instead of rolling your own ad-hoc hash function, why not just use an algorithm designed specifically to blend data
into a hash? Using a standardized algorithm means we don't need to worry about collision behavior any more: if the
Instead of rolling your own ad-hoc hash function, why not just use an algorithm designed specifically to blend data
into a hash? Using a standardized algorithm means we don't need to worry about collision behavior any more: if the
algorithm was designed well, we'll always have good results.

The SipHash algorithm is a particularly good choice for hashing. It implements a 64-bit cryptographic
message-authentication code (MAC) with a 256-bit internal state initialized from a 128-bit secret key that's (typically)
randomly generated for each execution of the binary.
The SipHash algorithm is a particularly good choice for hashing. It implements a 64-bit cryptographic
message-authentication code (MAC) with a 256-bit internal state initialized from a 128-bit secret key that's (typically)
randomly generated for each execution of the binary.
SipHash is designed to protect against hash collision attacks, while remaining simple to use and fast.
It is already used by Perl, Python, Ruby, Rust, and even Swift itself -- which is why the documentation of `Hashable`
It is already used by Perl, Python, Ruby, Rust, and even Swift itself -- which is why the documentation of `Hashable`
explicitly warns that the value returned by `hashValue` may be different across executions.

The standard library already implements SipHash, but the implementation is private. (It is technically available
The standard library already implements SipHash, but the implementation is private. (It is technically available
for use, but it is not formally part of the stdlib API, and it is subject to change/removal across even point releases.)
I expect a refactored version of stdlib's SipHash will become available as public API in a future Swift release.
I expect a refactored version of stdlib's SipHash will become available as public API in a future Swift release.
But while we're waiting for that, this package provides an alternative implementation that is available today.

## Is this code full of bugs?
Expand All @@ -108,8 +108,8 @@ Indubitably. Please report all bugs you find!

The package has 100% unit test coverage. Unfortunately this doesn't tell you much about its reliability in practice.

The test suite verifies that the package generates values that match the test vectors supplied by SipHash's original
authors, which makes me reasonably confident that this package implements SipHash correctly.
The test suite verifies that the package generates values that match the test vectors supplied by SipHash's original
authors, which makes me reasonably confident that this package implements SipHash correctly.
Obviously, your mileage may vary.

## Reference docs
Expand Down Expand Up @@ -147,7 +147,7 @@ import PackageDescription
let package = Package(
name: "MyPackage",
dependencies: [
.Package(url: "https://github.com/attaswift/SipHash.git", from: "1.2.0")
.Package(url: "https://github.com/attaswift/SipHash.git", from: "1.2.1")
]
)
```
Expand All @@ -159,4 +159,3 @@ If you don't use a dependency manager, you need to clone this repo somewhere nea
To link your application binary with SipHash, just add `SipHash.framework` from the SipHash project to the Embedded Binaries section of your app target's General page in Xcode. As long as the SipHash project file is referenced in your workspace, this framework will be listed in the "Choose items to add" sheet that opens when you click on the "+" button of your target's Embedded Binaries list.

There is no need to do any additional setup beyond adding the framework targets to Embedded Binaries.

2 changes: 1 addition & 1 deletion SipHash.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'SipHash'
spec.version = '1.2.0'
spec.version = '1.2.1'
spec.ios.deployment_target = "8.0"
spec.osx.deployment_target = "10.9"
spec.tvos.deployment_target = "9.0"
Expand Down
4 changes: 2 additions & 2 deletions version.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//

// Increment the build number whenever you modify the version string.
VERSION_STRING = 1.2.0
BUILD_NUMBER = 5
VERSION_STRING = 1.2.1
BUILD_NUMBER = 6

PROJECT_NAME = SipHash
BUNDLE_IDENTIFIER_BASE = org.attaswift.$(PROJECT_NAME)
Expand Down

0 comments on commit fb754d4

Please sign in to comment.