Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21

require (
github.com/bits-and-blooms/bitset v1.2.0
github.com/blevesearch/mmap-go v1.0.4
github.com/edsrzf/mmap-go v1.2.1-0.20241212181136-fad1cd13edbd
github.com/spf13/cobra v1.4.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
github.com/bits-and-blooms/bitset v1.2.0 h1:Kn4yilvwNtMACtf1eYDlG8H77R07mZSPbMjLyS07ChA=
github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
github.com/blevesearch/mmap-go v1.0.4 h1:OVhDhT5B/M1HNPpYPBKIEJaD0F3Si+CrEKULGCDPWmc=
github.com/blevesearch/mmap-go v1.0.4/go.mod h1:EWmEAOmdAS9z/pi/+Toxu99DnsbhG1TIxUoRmJw/pSs=
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/edsrzf/mmap-go v1.2.1-0.20241212181136-fad1cd13edbd h1:I4PrRZuNMeDP3VbFrak4QsqwO5tWkQf0tqrrr1L2DsU=
github.com/edsrzf/mmap-go v1.2.1-0.20241212181136-fad1cd13edbd/go.mod h1:19H/e8pUPLicwkyNgOykDXkJ9F0MHE+Z52B8EIth78Q=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
Expand Down
16 changes: 8 additions & 8 deletions levenshtein/parametric_dfa.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package levenshtein

import (
"crypto/md5"
"crypto/sha256"
"encoding/json"
"fmt"
"math"
Expand Down Expand Up @@ -311,13 +311,13 @@ func fromNfa(nfa *LevenshteinNFA) (*ParametricDFA, error) {
}

type hash struct {
index map[[16]byte]int
index map[[32]byte]int
items []MultiState
}

func newHash() *hash {
return &hash{
index: make(map[[16]byte]int, 100),
index: make(map[[32]byte]int, 100),
items: make([]MultiState, 0, 100),
}
}
Expand All @@ -326,9 +326,9 @@ func (h *hash) getOrAllocate(m MultiState) int {
size := len(h.items)
var exists bool
var pos int
md5 := getHash(&m)
if pos, exists = h.index[md5]; !exists {
h.index[md5] = size
sha256Hash := getHash(&m)
if pos, exists = h.index[sha256Hash]; !exists {
h.index[sha256Hash] = size
pos = size
h.items = append(h.items, m)
}
Expand All @@ -339,11 +339,11 @@ func (h *hash) getFromID(id int) *MultiState {
return &h.items[id]
}

func getHash(ms *MultiState) [16]byte {
func getHash(ms *MultiState) [32]byte {
msBytes := []byte{}
for _, state := range ms.states {
jsonBytes, _ := json.Marshal(&state)
msBytes = append(msBytes, jsonBytes...)
}
return md5.Sum(msBytes)
return sha256.Sum256(msBytes)
}
3 changes: 2 additions & 1 deletion vellum_mmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !nommap
// +build !nommap

package vellum

import (
"os"

mmap "github.com/blevesearch/mmap-go"
mmap "github.com/edsrzf/mmap-go"
)

type mmapWrapper struct {
Expand Down
26 changes: 0 additions & 26 deletions vendor/github.com/bits-and-blooms/bitset/.gitignore

This file was deleted.

37 changes: 0 additions & 37 deletions vendor/github.com/bits-and-blooms/bitset/.travis.yml

This file was deleted.

27 changes: 0 additions & 27 deletions vendor/github.com/bits-and-blooms/bitset/LICENSE

This file was deleted.

93 changes: 0 additions & 93 deletions vendor/github.com/bits-and-blooms/bitset/README.md

This file was deleted.

39 changes: 0 additions & 39 deletions vendor/github.com/bits-and-blooms/bitset/azure-pipelines.yml

This file was deleted.

Loading