diff --git a/.travis.yml b/.travis.yml index d600172..55b760a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode11.2 +osx_image: xcode11.4 env: - ACTION=test PLATFORM=Mac DESTINATION='platform=OS X' diff --git a/Sources/SourceParsingFramework/Utilities/Extensions.swift b/Sources/SourceParsingFramework/Utilities/Extensions.swift index cf7349b..1190c27 100644 --- a/Sources/SourceParsingFramework/Utilities/Extensions.swift +++ b/Sources/SourceParsingFramework/Utilities/Extensions.swift @@ -22,7 +22,7 @@ extension String { /// The SHA256 value of this String. public var shortSHA256Value: String { - return SHA256(self).digestString().substring(with: NSRange(location: 0, length: 20))! + return SHA256().hash(self).hexadecimalRepresentation.substring(with: NSRange(location: 0, length: 20))! } /// Return the same String with the first character lowercased. diff --git a/Tests/SourceParsingFrameworkTests/Utilities/ExtensionsTests.swift b/Tests/SourceParsingFrameworkTests/Utilities/ExtensionsTests.swift index 2798ee6..fc10224 100644 --- a/Tests/SourceParsingFrameworkTests/Utilities/ExtensionsTests.swift +++ b/Tests/SourceParsingFrameworkTests/Utilities/ExtensionsTests.swift @@ -30,6 +30,12 @@ class ExtensionsTests: AbstractSourceParsingTests { dirPath = String(filePath.prefix(upTo: index)) } + func test_sha256_verifyResults() { + let input = "Some random string" + let sha256 = input.shortSHA256Value + XCTAssertEqual(sha256, "7e2ab276842ae9fb52ae") + } + func test_isDirectory_verifyResults() { XCTAssertFalse(filePath.isDirectory) XCTAssertTrue(dirPath.isDirectory)