mirror of
https://github.com/swift-server/RediStack.git
synced 2026-05-03 07:32:28 +00:00
bf887a9d19
Motivation: The `CNIOSHA1` module from SwiftNIO is an implementation detail. The fact that we were able to import and build the project with it is a bug/feature of Swift Package Manager. Should the Swift ecosystem standardize on an implementation, that will replace the one we have chosen later. Modifications: Use the SHA1 native Swift implementation from CryptoSwift by reproducing the necessary code in our project. Updates to the appropriate files to provide attribution to CryptoSwift have been included. Result: A reliable and pure Swift implementation of the SHA1 digest algorithm in the project for the sake of Lua script cache hashing.
28 lines
800 B
Swift
28 lines
800 B
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the RediStack open source project
|
|
//
|
|
// Copyright (c) 2019 RediStack project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of RediStack project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
@testable import RediStack
|
|
import XCTest
|
|
|
|
final class ExtensionTests: XCTestCase {
|
|
func testString_sha1() {
|
|
let str = "Hello String Test"
|
|
guard let hash = str.sha1 else {
|
|
XCTFail()
|
|
return
|
|
}
|
|
XCTAssertEqual(hash, "9c0015411ab9150a115d4730dc2c940d94913402")
|
|
}
|
|
}
|