-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f890986
commit dd74fbe
Showing
7 changed files
with
50 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// Common.swift | ||
// FNVDemo | ||
// | ||
// Created by Daisuke T on 2019/02/28. | ||
// Copyright © 2019 FNVDemo. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
import FNV | ||
|
||
class Common { | ||
|
||
static func test() { | ||
print(String(format: "fnv0_32(\"Hello World!\") -> 0x08%x", FNV.fnv0_32("Hello World!"))) | ||
print(String(format: "fnv0_64(\"Hello World!\") -> 0x016%lx", FNV.fnv0_64("Hello World!"))) | ||
print(String(format: "fnv1_32(\"Hello World!\") -> 0x08%x", FNV.fnv1_32("Hello World!"))) | ||
print(String(format: "fnv1_64(\"Hello World!\") -> 0x016%lx", FNV.fnv1_64("Hello World!"))) | ||
print(String(format: "fnv1a_32(\"Hello World!\") -> 0x08%x", FNV.fnv1a_32("Hello World!"))) | ||
print(String(format: "fnv1a_64(\"Hello World!\") -> 0x016%lx", FNV.fnv1a_64("Hello World!"))) | ||
|
||
|
||
let bundle = Bundle(for: Common.self) | ||
let path = bundle.path(forResource: "alice29", ofType: "txt")! | ||
let data = NSData(contentsOfFile: path)! as Data | ||
|
||
print(String(format: "fnv0_32(file) -> 0x08%x", FNV.fnv0_32(data))) | ||
print(String(format: "fnv0_64(file) -> 0x016%lx", FNV.fnv0_64(data))) | ||
print(String(format: "fnv1_32(file) -> 0x08%x", FNV.fnv1_32(data))) | ||
print(String(format: "fnv1_64(file) -> 0x016%lx", FNV.fnv1_64(data))) | ||
print(String(format: "fnv1a_32(file) -> 0x08%x", FNV.fnv1a_32(data))) | ||
print(String(format: "fnv1a_64(file) -> 0x016%lx", FNV.fnv1a_64(data))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters