Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2 from vapor/beta
Browse files Browse the repository at this point in the history
beta dependencies
  • Loading branch information
loganwright authored Mar 27, 2017
2 parents 411cfd0 + ec439e3 commit 33dad12
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ let package = Package(
name: "BCrypt",
dependencies: [
// Module for generating random bytes and numbers.
.Package(url: "https://github.com/vapor/random.git", majorVersion: 0)
.Package(url: "https://github.com/vapor/random.git", Version(1,0,0, prereleaseIdentifiers: ["beta"]))
]
)
35 changes: 17 additions & 18 deletions Tests/BCryptTests/BCryptTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@ import XCTest
import BCrypt

class BCryptTests: XCTestCase {
let tests = [
"$2a$04$TI13sbmh3IHnmRepeEFoJOkVZWsn5S1O8QOwm8ZU5gNIpJog9pXZm": "vapor",
"$2a$06$DCq7YPn5Rq63x1Lad4cll.TV4S6ytwfsfvkgY8jIucDrjc8deX1s.": "",
"$2a$06$m0CrhHm10qJ3lXRY.5zDGO3rS2KdeeWLuGmsfGlMfOxih58VYVfxe": "a",
"$2a$06$If6bvum7DFjUnE9p2uDeDu0YHzrHM6tf.iqN8.yx.jNN1ILEf7h0i": "abc",
"$2a$06$.rCVZVOThsIa97pEDOxvGuRRgzG64bvtJ0938xuqzv18d3ZpQhstC": "abcdefghijklmnopqrstuvwxyz",
"$2a$06$fPIsBO8qRqkjj273rfaOI.HtSV9jLDpTbZn782DC6/t7qT67P6FfO": "~!@#$%^&*() ~!@#$%^&*()PNBFRD"
static let allTests = [
("testVersion", testVersion),
("testFail", testFail),
("testSanity", testSanity),
("testInvalidSalt", testInvalidSalt),
("testVerify", testVerify)
]

func testVersion() throws {
let digest = try Hash.make(message: "foo")
XCTAssert(digest.string.hasPrefix("$2y$06$"))
XCTAssert(digest.makeString().hasPrefix("$2y$06$"))
}

func testFail() throws {
Expand All @@ -32,10 +31,9 @@ class BCryptTests: XCTestCase {
let parser = try Parser(res)
let parsedSalt = try parser.parseSalt()

XCTAssertEqual(secret, parsedSalt.bytes.string)
XCTAssertEqual(secret, parsedSalt.bytes.makeString())
}


func testInvalidSalt() throws {
do {
_ = try Parser("foo".makeBytes())
Expand All @@ -51,12 +49,13 @@ class BCryptTests: XCTestCase {
XCTAssert(result, "Message '\(message)' did not create \(desired)")
}
}

static var allTests = [
("testVersion", testVersion),
("testFail", testFail),
("testSanity", testSanity),
("testInvalidSalt", testInvalidSalt),
("testVerify", testVerify)
]
}

let tests = [
"$2a$04$TI13sbmh3IHnmRepeEFoJOkVZWsn5S1O8QOwm8ZU5gNIpJog9pXZm": "vapor",
"$2a$06$DCq7YPn5Rq63x1Lad4cll.TV4S6ytwfsfvkgY8jIucDrjc8deX1s.": "",
"$2a$06$m0CrhHm10qJ3lXRY.5zDGO3rS2KdeeWLuGmsfGlMfOxih58VYVfxe": "a",
"$2a$06$If6bvum7DFjUnE9p2uDeDu0YHzrHM6tf.iqN8.yx.jNN1ILEf7h0i": "abc",
"$2a$06$.rCVZVOThsIa97pEDOxvGuRRgzG64bvtJ0938xuqzv18d3ZpQhstC": "abcdefghijklmnopqrstuvwxyz",
"$2a$06$fPIsBO8qRqkjj273rfaOI.HtSV9jLDpTbZn782DC6/t7qT67P6FfO": "~!@#$%^&*() ~!@#$%^&*()PNBFRD"
]

0 comments on commit 33dad12

Please sign in to comment.