Faster hex SIMD Encode/Decode

This commit is contained in:
DataHoarder 2023-07-24 13:26:18 +02:00
parent 649640c381
commit 07d09286e9
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
38 changed files with 80 additions and 26 deletions

View file

@ -33,6 +33,7 @@ require (
github.com/holiman/uint256 v1.2.3 // indirect
github.com/jxskiss/base62 v1.1.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/sys v0.10.0 // indirect
lukechampine.com/uint128 v1.3.0 // indirect

View file

@ -38,6 +38,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777 h1:5u+6YWU2faS+Sr/x8j9yalMpSDUkatNOZWXV3wMUCGQ=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777/go.mod h1:4af3KxEsswy6aTzsTcwa8QZUSh4V+80oHdp1QX9uJHA=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=

View file

@ -25,6 +25,7 @@ require (
github.com/goccy/go-json v0.10.2 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/jxskiss/base62 v1.1.0 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
go.etcd.io/bbolt v1.3.7 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/sys v0.10.0 // indirect

View file

@ -34,6 +34,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777 h1:5u+6YWU2faS+Sr/x8j9yalMpSDUkatNOZWXV3wMUCGQ=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777/go.mod h1:4af3KxEsswy6aTzsTcwa8QZUSh4V+80oHdp1QX9uJHA=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=

View file

@ -32,6 +32,7 @@ require (
github.com/holiman/uint256 v1.2.3 // indirect
github.com/jxskiss/base62 v1.1.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
go.etcd.io/bbolt v1.3.7 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/sys v0.10.0 // indirect

View file

@ -36,6 +36,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777 h1:5u+6YWU2faS+Sr/x8j9yalMpSDUkatNOZWXV3wMUCGQ=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777/go.mod h1:4af3KxEsswy6aTzsTcwa8QZUSh4V+80oHdp1QX9uJHA=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=

View file

@ -25,6 +25,7 @@ require (
github.com/goccy/go-json v0.10.2 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/jxskiss/base62 v1.1.0 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
go.etcd.io/bbolt v1.3.7 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/sys v0.10.0 // indirect

View file

@ -34,6 +34,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777 h1:5u+6YWU2faS+Sr/x8j9yalMpSDUkatNOZWXV3wMUCGQ=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777/go.mod h1:4af3KxEsswy6aTzsTcwa8QZUSh4V+80oHdp1QX9uJHA=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=

View file

@ -31,6 +31,7 @@ require (
github.com/jxskiss/base62 v1.1.0 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect

View file

@ -79,6 +79,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777 h1:5u+6YWU2faS+Sr/x8j9yalMpSDUkatNOZWXV3wMUCGQ=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777/go.mod h1:4af3KxEsswy6aTzsTcwa8QZUSh4V+80oHdp1QX9uJHA=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=

View file

@ -11,5 +11,6 @@ require (
github.com/floatdrop/lru v1.3.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/jxskiss/base62 v1.1.0 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
golang.org/x/sys v0.10.0 // indirect
)

View file

@ -6,5 +6,7 @@ github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/jxskiss/base62 v1.1.0 h1:A5zbF8v8WXx2xixnAKD2w+abC+sIzYJX+nxmhA6HWFw=
github.com/jxskiss/base62 v1.1.0/go.mod h1:HhWAlUXvxKThfOlZbcuFzsqwtF5TcqS9ru3y5GfjWAc=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

View file

@ -23,6 +23,7 @@ require (
github.com/goccy/go-json v0.10.2 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/jxskiss/base62 v1.1.0 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/sys v0.10.0 // indirect
lukechampine.com/uint128 v1.3.0 // indirect

View file

@ -36,6 +36,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777 h1:5u+6YWU2faS+Sr/x8j9yalMpSDUkatNOZWXV3wMUCGQ=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777/go.mod h1:4af3KxEsswy6aTzsTcwa8QZUSh4V+80oHdp1QX9uJHA=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=

View file

@ -25,6 +25,7 @@ require (
github.com/goccy/go-json v0.10.2 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/jxskiss/base62 v1.1.0 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
go.etcd.io/bbolt v1.3.7 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/sys v0.10.0 // indirect

View file

@ -34,6 +34,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777 h1:5u+6YWU2faS+Sr/x8j9yalMpSDUkatNOZWXV3wMUCGQ=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777/go.mod h1:4af3KxEsswy6aTzsTcwa8QZUSh4V+80oHdp1QX9uJHA=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=

View file

@ -31,6 +31,7 @@ require (
github.com/goccy/go-json v0.10.2 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/jxskiss/base62 v1.1.0 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
go.etcd.io/bbolt v1.3.7 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/sync v0.3.0 // indirect

View file

@ -40,6 +40,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777 h1:5u+6YWU2faS+Sr/x8j9yalMpSDUkatNOZWXV3wMUCGQ=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777/go.mod h1:4af3KxEsswy6aTzsTcwa8QZUSh4V+80oHdp1QX9uJHA=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=

View file

@ -25,6 +25,7 @@ require (
github.com/goccy/go-json v0.10.2 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/jxskiss/base62 v1.1.0 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/sys v0.10.0 // indirect
lukechampine.com/uint128 v1.3.0 // indirect

View file

@ -34,6 +34,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777 h1:5u+6YWU2faS+Sr/x8j9yalMpSDUkatNOZWXV3wMUCGQ=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777/go.mod h1:4af3KxEsswy6aTzsTcwa8QZUSh4V+80oHdp1QX9uJHA=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=

View file

@ -25,6 +25,7 @@ require (
github.com/goccy/go-json v0.10.2 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/jxskiss/base62 v1.1.0 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
go.etcd.io/bbolt v1.3.7 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/sys v0.10.0 // indirect

View file

@ -34,6 +34,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777 h1:5u+6YWU2faS+Sr/x8j9yalMpSDUkatNOZWXV3wMUCGQ=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777/go.mod h1:4af3KxEsswy6aTzsTcwa8QZUSh4V+80oHdp1QX9uJHA=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=

View file

@ -29,6 +29,7 @@ require (
github.com/holiman/uint256 v1.2.3 // indirect
github.com/jxskiss/base62 v1.1.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/sys v0.10.0 // indirect
lukechampine.com/uint128 v1.3.0 // indirect

View file

@ -36,6 +36,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777 h1:5u+6YWU2faS+Sr/x8j9yalMpSDUkatNOZWXV3wMUCGQ=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777/go.mod h1:4af3KxEsswy6aTzsTcwa8QZUSh4V+80oHdp1QX9uJHA=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=

View file

@ -26,6 +26,7 @@ require (
github.com/holiman/uint256 v1.2.3 // indirect
github.com/jxskiss/base62 v1.1.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/sys v0.10.0 // indirect
lukechampine.com/uint128 v1.3.0 // indirect

View file

@ -36,6 +36,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777 h1:5u+6YWU2faS+Sr/x8j9yalMpSDUkatNOZWXV3wMUCGQ=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777/go.mod h1:4af3KxEsswy6aTzsTcwa8QZUSh4V+80oHdp1QX9uJHA=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=

View file

@ -13,6 +13,7 @@ require (
git.gammaspectra.live/P2Pool/p2pool-observer/cmd/index v0.0.0
git.gammaspectra.live/P2Pool/p2pool-observer/cmd/utils v0.0.0
github.com/gorilla/mux v1.8.0
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc
github.com/valyala/quicktemplate v1.7.0
)

View file

@ -43,6 +43,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777 h1:5u+6YWU2faS+Sr/x8j9yalMpSDUkatNOZWXV3wMUCGQ=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777/go.mod h1:4af3KxEsswy6aTzsTcwa8QZUSh4V+80oHdp1QX9uJHA=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.30.0/go.mod h1:2rsYD01CKFrjjsvFxx75KlEUNpWNBY9JWD3K/7o2Cus=

View file

@ -9,6 +9,7 @@
{% import "fmt" %}
{% import "slices" %}
{% import hex2 "encoding/hex" %}
{% import fasthex "github.com/tmthrgd/go-hex" %}
{% stripspace %}
@ -20,32 +21,32 @@
{%s s %}
{% case types.Difficulty %}
{% code
hex2.Encode(ctx.HexBuffer[:types.DifficultySize*2], s.Bytes())
fasthex.Encode(ctx.HexBuffer[:types.DifficultySize*2], s.Bytes())
%}
{%z= ctx.HexBuffer[:types.DifficultySize*2] %}
{% case crypto.PrivateKeyBytes %}
{% code
hex2.Encode(ctx.HexBuffer[:], s[:])
fasthex.Encode(ctx.HexBuffer[:], s[:])
%}
{%z= ctx.HexBuffer[:] %}
{% case crypto.PublicKeyBytes %}
{% code
hex2.Encode(ctx.HexBuffer[:], s[:])
fasthex.Encode(ctx.HexBuffer[:], s[:])
%}
{%z= ctx.HexBuffer[:] %}
{% case crypto.PrivateKey %}
{% code
hex2.Encode(ctx.HexBuffer[:], s.AsSlice())
fasthex.Encode(ctx.HexBuffer[:], s.AsSlice())
%}
{%z= ctx.HexBuffer[:] %}
{% case crypto.PublicKey %}
{% code
hex2.Encode(ctx.HexBuffer[:], s.AsSlice())
fasthex.Encode(ctx.HexBuffer[:], s.AsSlice())
%}
{%z= ctx.HexBuffer[:] %}
{% case types.Hash %}
{% code
hex2.Encode(ctx.HexBuffer[:], s[:])
fasthex.Encode(ctx.HexBuffer[:], s[:])
%}
{%z= ctx.HexBuffer[:] %}
{% case []byte %}
@ -54,14 +55,14 @@
{% code
var buf [4]byte
binary.LittleEndian.PutUint32(buf[:], s)
hex2.Encode(ctx.HexBuffer[:4*2], buf[:])
fasthex.Encode(ctx.HexBuffer[:4*2], buf[:])
%}
{%z= ctx.HexBuffer[:4*2] %}
{% case uint64 %}
{% code
var buf [8]byte
binary.LittleEndian.PutUint64(buf[:], s)
hex2.Encode(ctx.HexBuffer[:8*2], buf[:])
fasthex.Encode(ctx.HexBuffer[:8*2], buf[:])
%}
{%z= ctx.HexBuffer[:8*2] %}
{% default %}
@ -77,27 +78,27 @@
{%z= utils.ShortenSlice(slices.Clone(s), n) %}
{% case crypto.PrivateKeyBytes %}
{% code
hex2.Encode(ctx.HexBuffer[:], s[:])
fasthex.Encode(ctx.HexBuffer[:], s[:])
%}
{%z= utils.ShortenSlice(ctx.HexBuffer[:], n) %}
{% case crypto.PublicKeyBytes %}
{% code
hex2.Encode(ctx.HexBuffer[:], s[:])
fasthex.Encode(ctx.HexBuffer[:], s[:])
%}
{%z= utils.ShortenSlice(ctx.HexBuffer[:], n) %}
{% case crypto.PrivateKey %}
{% code
hex2.Encode(ctx.HexBuffer[:], s.AsSlice())
fasthex.Encode(ctx.HexBuffer[:], s.AsSlice())
%}
{%z= utils.ShortenSlice(ctx.HexBuffer[:], n) %}
{% case crypto.PublicKey %}
{% code
hex2.Encode(ctx.HexBuffer[:], s.AsSlice())
fasthex.Encode(ctx.HexBuffer[:], s.AsSlice())
%}
{%z= utils.ShortenSlice(ctx.HexBuffer[:], n) %}
{% case types.Hash %}
{% code
hex2.Encode(ctx.HexBuffer[:], s[:])
fasthex.Encode(ctx.HexBuffer[:], s[:])
%}
{%z= utils.ShortenSlice(ctx.HexBuffer[:], n) %}
{% case fmt.Stringer %}

1
go.mod
View file

@ -16,6 +16,7 @@ require (
github.com/holiman/uint256 v1.2.3
github.com/jxskiss/base62 v1.1.0
github.com/stretchr/testify v1.8.1
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc
golang.org/x/sys v0.10.0
lukechampine.com/uint128 v1.3.0
)

2
go.sum
View file

@ -48,6 +48,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777 h1:5u+6YWU2faS+Sr/x8j9yalMpSDUkatNOZWXV3wMUCGQ=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777/go.mod h1:4af3KxEsswy6aTzsTcwa8QZUSh4V+80oHdp1QX9uJHA=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=

View file

@ -7,6 +7,7 @@ import (
"errors"
"git.gammaspectra.live/P2Pool/edwards25519"
"git.gammaspectra.live/P2Pool/p2pool-observer/utils"
fasthex "github.com/tmthrgd/go-hex"
)
type PrivateKey interface {
@ -160,7 +161,7 @@ func (k *PrivateKeyBytes) UnmarshalJSON(b []byte) error {
return errors.New("wrong key size")
}
if _, err := hex.Decode(k[:], b[1:len(b)-1]); err != nil {
if _, err := fasthex.Decode(k[:], b[1:len(b)-1]); err != nil {
return err
} else {
return nil
@ -171,7 +172,7 @@ func (k *PrivateKeyBytes) MarshalJSON() ([]byte, error) {
var buf [PrivateKeySize*2 + 2]byte
buf[0] = '"'
buf[PrivateKeySize*2+1] = '"'
hex.Encode(buf[1:], k[:])
fasthex.Encode(buf[1:], k[:])
return buf[:], nil
}
@ -254,7 +255,7 @@ func (k *PrivateKeySlice) MarshalJSON() ([]byte, error) {
var buf [PrivateKeySize*2 + 2]byte
buf[0] = '"'
buf[PrivateKeySize*2+1] = '"'
hex.Encode(buf[1:], (*k)[:])
fasthex.Encode(buf[1:], (*k)[:])
return buf[:], nil
}

View file

@ -7,6 +7,7 @@ import (
"errors"
"git.gammaspectra.live/P2Pool/edwards25519"
"git.gammaspectra.live/P2Pool/p2pool-observer/utils"
fasthex "github.com/tmthrgd/go-hex"
)
type PublicKey interface {
@ -143,7 +144,7 @@ func (k *PublicKeyBytes) UnmarshalJSON(b []byte) error {
return errors.New("wrong key size")
}
if _, err := hex.Decode(k[:], b[1:len(b)-1]); err != nil {
if _, err := fasthex.Decode(k[:], b[1:len(b)-1]); err != nil {
return err
} else {
return nil
@ -154,7 +155,7 @@ func (k *PublicKeyBytes) MarshalJSON() ([]byte, error) {
var buf [PublicKeySize*2 + 2]byte
buf[0] = '"'
buf[PublicKeySize*2+1] = '"'
hex.Encode(buf[1:], k[:])
fasthex.Encode(buf[1:], k[:])
return buf[:], nil
}
@ -224,6 +225,6 @@ func (k *PublicKeySlice) MarshalJSON() ([]byte, error) {
var buf [PublicKeySize*2 + 2]byte
buf[0] = '"'
buf[PublicKeySize*2+1] = '"'
hex.Encode(buf[1:], (*k)[:])
fasthex.Encode(buf[1:], (*k)[:])
return buf[:], nil
}

1
p2pool/cache/go.mod vendored
View file

@ -23,6 +23,7 @@ require (
github.com/goccy/go-json v0.10.2 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/jxskiss/base62 v1.1.0 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/sys v0.10.0 // indirect
lukechampine.com/uint128 v1.3.0 // indirect

2
p2pool/cache/go.sum vendored
View file

@ -34,6 +34,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777 h1:5u+6YWU2faS+Sr/x8j9yalMpSDUkatNOZWXV3wMUCGQ=
github.com/thepudds/swisstable v0.0.0-20221011152303-9c77dc657777/go.mod h1:4af3KxEsswy6aTzsTcwa8QZUSh4V+80oHdp1QX9uJHA=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=

View file

@ -7,6 +7,7 @@ import (
"errors"
"git.gammaspectra.live/P2Pool/p2pool-observer/utils"
"github.com/holiman/uint256"
fasthex "github.com/tmthrgd/go-hex"
"lukechampine.com/uint128"
"math"
"math/big"
@ -194,7 +195,7 @@ func (d Difficulty) MarshalJSON() ([]byte, error) {
var buf [DifficultySize*2 + 2]byte
buf[0] = '"'
buf[DifficultySize*2+1] = '"'
hex.Encode(buf[1:], encodeBuf[:])
fasthex.Encode(buf[1:], encodeBuf[:])
return buf[:], nil
}
@ -250,7 +251,7 @@ func (d *Difficulty) UnmarshalJSON(b []byte) error {
if len(b) == DifficultySize*2+2 {
// fast path
var buf [DifficultySize]byte
if _, err := hex.Decode(buf[:], b[1:len(b)-1]); err != nil {
if _, err := fasthex.Decode(buf[:], b[1:len(b)-1]); err != nil {
return err
} else {
*d = DifficultyFromBytes(buf[:])

View file

@ -5,6 +5,7 @@ import (
"encoding/binary"
"encoding/hex"
"errors"
fasthex "github.com/tmthrgd/go-hex"
"runtime"
"unsafe"
)
@ -19,7 +20,7 @@ func (h Hash) MarshalJSON() ([]byte, error) {
var buf [HashSize*2 + 2]byte
buf[0] = '"'
buf[HashSize*2+1] = '"'
hex.Encode(buf[1:], h[:])
fasthex.Encode(buf[1:], h[:])
return buf[:], nil
}
@ -132,7 +133,7 @@ func (h *Hash) UnmarshalJSON(b []byte) error {
return errors.New("wrong hash size")
}
if _, err := hex.Decode(h[:], b[1:len(b)-1]); err != nil {
if _, err := fasthex.Decode(h[:], b[1:len(b)-1]); err != nil {
return err
} else {
return nil
@ -145,7 +146,7 @@ func (b Bytes) MarshalJSON() ([]byte, error) {
buf := make([]byte, len(b)*2+2)
buf[0] = '"'
buf[len(buf)-1] = '"'
hex.Encode(buf[1:], b)
fasthex.Encode(buf[1:], b)
return buf, nil
}
@ -160,7 +161,7 @@ func (b *Bytes) UnmarshalJSON(buf []byte) error {
*b = make(Bytes, (len(buf)-2)/2)
if _, err := hex.Decode(*b, buf[1:len(buf)-1]); err != nil {
if _, err := fasthex.Decode(*b, buf[1:len(buf)-1]); err != nil {
return err
} else {
return nil

View file

@ -5,6 +5,7 @@ import (
"encoding/binary"
"encoding/hex"
"github.com/jxskiss/base62"
fasthex "github.com/tmthrgd/go-hex"
"math/bits"
"strconv"
"strings"
@ -64,7 +65,7 @@ func EncodeSliceBinaryNumber(dst, src []byte) []byte {
}
if len(v) >= (len(src) * 2) {
hex.Encode(dst, src)
fasthex.Encode(dst, src)
return dst[:len(src)*2]
}