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
0 parents
commit 8074477
Showing
13 changed files
with
203 additions
and
0 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,21 @@ | ||
name: Build Package Listing | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_run: | ||
workflows: [Build Release] | ||
types: | ||
- completed | ||
release: | ||
types: [published, created, edited, unpublished, deleted, released] | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
jobs: | ||
|
||
build-listing: | ||
uses: Narazaka/vpm-repos/.github/workflows/build-package-listing.yml@main |
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,18 @@ | ||
name: Call Build Repo Listing | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_run: | ||
workflows: [Build Package Listing] | ||
types: | ||
- completed | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
|
||
build-listing: | ||
uses: Narazaka/vpm-repos/.github/workflows/call-build-listing.yml@main | ||
secrets: | ||
DISPATCH_TOKEN: ${{ secrets.DISPATCH_TOKEN }} |
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,14 @@ | ||
name: Build Release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
uses: Narazaka/vpm-repos/.github/workflows/release.yml@main |
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,26 @@ | ||
namespace Narazaka.SimpleHash | ||
{ | ||
public static class FNV1a32 | ||
{ | ||
// cvf. https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function | ||
const uint FNV_OFFSET_BASIS = 2166136261; | ||
const uint FNV_PRIME = 16777619; | ||
public static uint ComputeHash(byte[] bytes) | ||
{ | ||
uint hash = FNV_OFFSET_BASIS; | ||
var len = bytes.Length; | ||
for (var i = 0; i < len; i++) | ||
{ | ||
hash = (hash ^ bytes[i]) * FNV_PRIME; | ||
} | ||
return hash; | ||
} | ||
|
||
#if HAS_UDON_ENCODING | ||
public static uint ComputeHash(string str) | ||
{ | ||
return ComputeHash(Koyashiro.UdonEncoding.UdonUTF8.GetBytes(str)); | ||
} | ||
#endif | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,20 @@ | ||
Copyright (c) 2023 Narazaka | ||
|
||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
arising from the use of this software. | ||
|
||
Permission is granted to anyone to use this software for any purpose, | ||
including commercial applications, and to alter it and redistribute it | ||
freely, subject to the following restrictions: | ||
|
||
1. The origin of this software must not be misrepresented; you must not | ||
claim that you wrote the original software. If you use this software | ||
in a product, an acknowledgment in the product documentation would be | ||
appreciated but is not required. | ||
|
||
2. Altered source versions must be plainly marked as such, and must not be | ||
misrepresented as being the original software. | ||
|
||
3. This notice may not be removed or altered from any source | ||
distribution. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,22 @@ | ||
{ | ||
"name": "Narazaka.SimpleHash", | ||
"rootNamespace": "", | ||
"references": [ | ||
"Koyashiro.UdonEncoding" | ||
], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [ | ||
{ | ||
"name": "net.koyashiro.udonencoding", | ||
"expression": "0.4.4", | ||
"define": "HAS_UDON_ENCODING" | ||
} | ||
], | ||
"noEngineReferences": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,27 @@ | ||
# Simple Hash | ||
|
||
Udon compatible 32bit hash lib | ||
|
||
- FNV1a32 | ||
|
||
## Install | ||
|
||
1. https://vpm.narazaka.net/ から「Add to VCC」ボタンを押してリポジトリをVCCにインストールします。 | ||
2. VCCでSettings→Packages→Installed Repositoriesの一覧中で「Narazaka VPM Listing」にチェックが付いていることを確認します。 | ||
3. ワールドプロジェクトの「Manage Project」から「Simple Hash」をインストールします。 | ||
|
||
## Usage | ||
|
||
```csharp | ||
using Narazaka.SimpleHash; | ||
var playerHash = FNV1a32.ComputeHash(Networking.LocalPlayer.displayName); | ||
``` | ||
|
||
## 更新履歴 | ||
|
||
- 1.0.0 | ||
- リリース | ||
|
||
## License | ||
|
||
[Zlib License](LICENSE.txt) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,16 @@ | ||
{ | ||
"name": "net.narazaka.simple-hash", | ||
"version": "1.0.0", | ||
"displayName": "Simple Hash", | ||
"description": "Udon compatible 32bit hash lib (FNV1a32)", | ||
"author": { | ||
"name": "Narazaka", | ||
"url": "https://github.com/Narazaka" | ||
}, | ||
"license": "Zlib", | ||
"type": "tool", | ||
"url" : "https://github.com/Narazaka/SimpleHash.git", | ||
"vpmDependencies": { | ||
"com.vrchat.worlds": ">=3.0.9" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.