mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
Starting to implement streaming cipher
This commit is contained in:
parent
1727a156db
commit
a6927a3143
2 changed files with 9 additions and 3 deletions
11
connect.go
11
connect.go
|
@ -1,7 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -370,7 +369,15 @@ func (c *Connection) sendFile(id int, connection net.Conn) {
|
||||||
connection.Write([]byte(fillString(strconv.FormatInt(int64(chunkSize), 10), 10)))
|
connection.Write([]byte(fillString(strconv.FormatInt(int64(chunkSize), 10), 10)))
|
||||||
|
|
||||||
sendBuffer := make([]byte, BUFFERSIZE)
|
sendBuffer := make([]byte, BUFFERSIZE)
|
||||||
file := bytes.NewBuffer(c.File.bytes)
|
|
||||||
|
// open encrypted file
|
||||||
|
file, err := os.Open(c.File.Name + ".enc")
|
||||||
|
if err != nil {
|
||||||
|
log.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
chunkI := 0
|
chunkI := 0
|
||||||
if !c.Debug {
|
if !c.Debug {
|
||||||
c.bars[id] = uiprogress.AddBar(chunksPerWorker).AppendCompleted().PrependElapsed()
|
c.bars[id] = uiprogress.AddBar(chunksPerWorker).AppendCompleted().PrependElapsed()
|
||||||
|
|
|
@ -45,5 +45,4 @@ func TestEncryptFiles(t *testing.T) {
|
||||||
}
|
}
|
||||||
os.Remove("temp.dec")
|
os.Remove("temp.dec")
|
||||||
os.Remove("temp.enc")
|
os.Remove("temp.enc")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue