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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions astrobwt/astrobwt.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package astrobwt

import "fmt"
import "unsafe"
import "crypto/rand"
import "encoding/binary"
import "golang.org/x/crypto/sha3"
import "golang.org/x/crypto/salsa20/salsa"
import (
"crypto/rand"
"encoding/binary"
"fmt"
"unsafe"

"golang.org/x/crypto/salsa20/salsa"
"golang.org/x/crypto/sha3"
)

// see here to improve the algorithms more https://github.com/y-256/libdivsufsort/blob/wiki/SACA_Benchmarks.md

Expand Down
17 changes: 10 additions & 7 deletions astrobwt/astrobwt_fast/astrobwt_optimized.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package astrobwt_fast

import "unsafe"
import "hash"
import "sync"
import "crypto/rand"
import "encoding/binary"
import "golang.org/x/crypto/sha3"
import "golang.org/x/crypto/salsa20/salsa"
import (
"crypto/rand"
"encoding/binary"
"hash"
"sync"
"unsafe"

"golang.org/x/crypto/salsa20/salsa"
"golang.org/x/crypto/sha3"
)

const stage1_length uint32 = 9973 // it is a prime

Expand Down
10 changes: 5 additions & 5 deletions astrobwt/astrobwt_fast/astrobwt_optimized_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package astrobwt_fast

import "crypto/rand"
import (
"crypto/rand"
"testing"

//import "strings"
import "testing"
"github.com/deroproject/derohe/astrobwt"
) //import "strings"

//import "encoding/hex"

import "github.com/deroproject/derohe/astrobwt"

func TestPOW_optimized_v1(t *testing.T) {
scratch := Pool.Get().(*ScratchData)

Expand Down
8 changes: 5 additions & 3 deletions astrobwt/astrobwt_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package astrobwt

import "time"
import "math/rand"
import "testing"
import (
"math/rand"
"testing"
"time"
)

// see https://www.geeksforgeeks.org/burrows-wheeler-data-transform-algorithm/
// see https://www.geeksforgeeks.org/suffix-tree-application-4-build-linear-time-suffix-array/
Expand Down
2 changes: 2 additions & 0 deletions astrobwt/astrobwtv3/endian_big.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

package astrobwtv3

import "unsafe"

const LittleEndian = false
const BigEndian = true

Expand Down
6 changes: 4 additions & 2 deletions astrobwt/astrobwtv3/endian_little.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

package astrobwtv3

import "unsafe"
import "math/bits"
import (
"math/bits"
"unsafe"
)

const LittleEndian = true
const BigEndian = false
Expand Down
6 changes: 4 additions & 2 deletions astrobwt/astrobwtv3/optimized_sort.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package astrobwtv3
//import "os"
//import "fmt"

import "sync"
import _ "encoding/binary"
import (
_ "encoding/binary"
"sync"
)

// see here to improve the algorithms more https://github.com/y-256/libdivsufsort/blob/wiki/SACA_Benchmarks.md

Expand Down
22 changes: 11 additions & 11 deletions astrobwt/astrobwtv3/pow.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package astrobwtv3

import "fmt"
import (
"crypto/rand"
"encoding/binary"
"fmt"
"math/bits"

//import "os"
import "math/bits"
import "encoding/binary"
import "crypto/rand"

import "github.com/dchest/siphash"
import "github.com/cespare/xxhash"
"github.com/cespare/xxhash"
"github.com/dchest/siphash"
"github.com/minio/sha256-simd"
"github.com/segmentio/fasthash/fnv1a"
"golang.org/x/crypto/salsa20/salsa"
) //import "os"

//import "github.com/minio/highwayhash"
import "github.com/minio/sha256-simd"
import "github.com/segmentio/fasthash/fnv1a"
import "golang.org/x/crypto/salsa20/salsa"

var _ = fmt.Sprintf
var __ = rand.Read
Expand Down
12 changes: 7 additions & 5 deletions astrobwt/astrobwtv3/pow_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package astrobwtv3

import "os"
import "fmt"
import "math/rand"
import "testing"
import "encoding/hex"
import (
"encoding/hex"
"fmt"
"math/rand"
"os"
"testing"
)

var cases [][]byte

Expand Down
10 changes: 6 additions & 4 deletions astrobwt/astrobwtv3/random_code_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

package main

import "fmt"
import "math/rand"
import "os"
import "regexp"
import (
"fmt"
"math/rand"
"os"
"regexp"
)

var random_lines = []string{
"step_3[i] += step_3[i] // +",
Expand Down
13 changes: 8 additions & 5 deletions astrobwt/astrobwtv3/sa_fast.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package astrobwtv3

import "unsafe"
import "hash"
import "sync"
import (
"encoding/binary"
"hash"
"sync"
"unsafe"

"github.com/minio/sha256-simd"
)

//import "fmt"
import "encoding/binary"
import "github.com/minio/sha256-simd"

const MAX_LENGTH uint32 = (256 * 384) - 1 // this is the maximum

Expand Down
26 changes: 13 additions & 13 deletions block/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@

package block

import "fmt"

import "time"
import "bytes"
import "strings"
import "runtime/debug"
import "encoding/hex"
import "encoding/binary"

import "golang.org/x/crypto/sha3"

import "github.com/deroproject/derohe/cryptography/crypto"
import (
"bytes"
"encoding/binary"
"encoding/hex"
"fmt"
"runtime/debug"
"strings"
"time"

"github.com/deroproject/derohe/cryptography/crypto"
"github.com/deroproject/derohe/transaction"
"golang.org/x/crypto/sha3"
)

//import "github.com/deroproject/derosuite/config"
import "github.com/deroproject/derohe/transaction"

type Block struct {
Major_Version uint64 `json:"major_version"`
Expand Down
8 changes: 5 additions & 3 deletions block/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
package block

//import "bytes"
import "testing"
import "encoding/hex"
import (
"encoding/hex"
"testing"

import "github.com/deroproject/derohe/config"
"github.com/deroproject/derohe/config"
)

//import "github.com/deroproject/derohe/crypto"

Expand Down
27 changes: 14 additions & 13 deletions block/miniblock.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@

package block

import "fmt"
import "hash"
import "sync"
import "bytes"
import "strings"
import "encoding/binary"

import "golang.org/x/crypto/sha3"

import "github.com/deroproject/derohe/cryptography/crypto"
import "github.com/deroproject/derohe/astrobwt"
import "github.com/deroproject/derohe/astrobwt/astrobwtv3"
import "github.com/deroproject/derohe/globals"
import (
"bytes"
"encoding/binary"
"fmt"
"hash"
"strings"
"sync"

"github.com/deroproject/derohe/astrobwt"
"github.com/deroproject/derohe/astrobwt/astrobwtv3"
"github.com/deroproject/derohe/cryptography/crypto"
"github.com/deroproject/derohe/globals"
"golang.org/x/crypto/sha3"
)

const MINIBLOCK_SIZE = 48

Expand Down
8 changes: 5 additions & 3 deletions block/miniblock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@

package block

import "bytes"
import "testing"
import "crypto/rand"
import (
"bytes"
"crypto/rand"
"testing"
)

func Test_blockmini_serde(t *testing.T) {

Expand Down
10 changes: 6 additions & 4 deletions block/miniblockdag.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@

package block

import "fmt"
import "sort"
import "sync"
import (
"fmt"
"sort"
"sync"
)

type MiniBlocksCollection struct {
Collection map[MiniBlockKey][]MiniBlock
Expand All @@ -38,7 +40,7 @@ func (c *MiniBlocksCollection) PurgeHeight(height int64) (purge_count int) {
c.Lock()
defer c.Unlock()

for k, _ := range c.Collection {
for k := range c.Collection {
if k.Height <= uint64(height) {
purge_count++
delete(c.Collection, k)
Expand Down
8 changes: 5 additions & 3 deletions blockchain/block_verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@

package blockchain

import "fmt"
import (
"fmt"

import "github.com/deroproject/derohe/cryptography/crypto"
import "github.com/deroproject/derohe/transaction"
"github.com/deroproject/derohe/cryptography/crypto"
"github.com/deroproject/derohe/transaction"
)

// used to verify complete block which contains expanded transaction
type cbl_verify struct {
Expand Down
Loading