Skip to content

Commit

Permalink
fantomless: upgrade to latest version (4.7.997-prerelease)
Browse files Browse the repository at this point in the history
  • Loading branch information
knocte committed Apr 20, 2022
1 parent 99c5066 commit eb00475
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
# visual warning icon (instead of green tick) on GitHubActionsCI
- name: fantomless
run: |
dotnet tool install --global fantomless-tool --version 4.5.12.4
dotnet tool update --global fantomless-tool --version 4.7.997-prerelease
# path taken from https://stackoverflow.com/a/65367006/544947
$HOME/.dotnet/tools/fantomless --recurse .
Expand Down
2 changes: 1 addition & 1 deletion NOnion/Cells/Relay/RelayIntroduce.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type RelayIntroduceInnerData =
|> List.append state
|> readLinkSpecifier(n - 1uy)

let linkSpecifiers = readLinkSpecifier(reader.ReadByte()) List.empty
let linkSpecifiers = readLinkSpecifier (reader.ReadByte()) List.empty

{
RendezvousCookie = cookie
Expand Down
14 changes: 7 additions & 7 deletions NOnion/Crypto/Kdf/Kdf.fs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module Kdf =
else
let hashResult = sha1Engine.ComputeHash(Array.append k0 [| i |])

innerCompute(i + 1uy) (Array.append state hashResult)
innerCompute (i + 1uy) (Array.append state hashResult)

let kdfBytes = innerCompute 0uy Array.empty

Expand All @@ -35,17 +35,17 @@ module Kdf =

// Offset = 2 * HashLength, Length = HashLength
let backwardDigest =
Array.skip(2 * Constants.HashLength) kdfBytes
Array.skip (2 * Constants.HashLength) kdfBytes
|> Array.take Constants.HashLength

// Offset = 3 * HashLength, Length = KeyLength
let forwardKey =
Array.skip(3 * Constants.HashLength) kdfBytes
Array.skip (3 * Constants.HashLength) kdfBytes
|> Array.take Constants.KeyLength

// Offset = 3 * HashLength + KeyLength, Length = KeyLength
let backwardKey =
Array.skip(3 * Constants.HashLength + Constants.KeyLength) kdfBytes
Array.skip (3 * Constants.HashLength + Constants.KeyLength) kdfBytes
|> Array.take Constants.KeyLength

{
Expand Down Expand Up @@ -79,12 +79,12 @@ module Kdf =

// Offset = 2 * HashLength, Length = KeyLength
let forwardKey =
Array.skip(2 * Constants.HashLength) kdfBytes
Array.skip (2 * Constants.HashLength) kdfBytes
|> Array.take Constants.KeyLength

// Offset = 2 * HashLength + KeyLength, Length = KeyLength
let backwardKey =
Array.skip(2 * Constants.HashLength + Constants.KeyLength) kdfBytes
Array.skip (2 * Constants.HashLength + Constants.KeyLength) kdfBytes
|> Array.take Constants.KeyLength

// Offset = 2 * HashLength + 2 * KeyLength, Length = HashLength
Expand Down Expand Up @@ -124,7 +124,7 @@ module Kdf =

// Offset = 2 * HashLength, Length = KeyS256Length
let forwardKey =
Array.skip(2 * Constants.HashLength) kdfBytes
Array.skip (2 * Constants.HashLength) kdfBytes
|> Array.take Constants.KeyS256Length

// Offset = 2 * HashLength + KeyS256Length, Length = KeyS256Length
Expand Down
6 changes: 3 additions & 3 deletions NOnion/Crypto/TorStreamCipher.fs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ type TorStreamCipher(keyBytes: array<byte>, ivOpt: Option<array<byte>>) =
0

counter.[pos] <- byte incrementedByte
innerIncrement(pos - 1) carry
innerIncrement (pos - 1) carry

innerIncrement(counter.Length - 1) 1
innerIncrement (counter.Length - 1) 1

encryptCounter()
incrementCounter()
Expand All @@ -91,7 +91,7 @@ type TorStreamCipher(keyBytes: array<byte>, ivOpt: Option<array<byte>>) =
counterOut.[keyStreamPointer]

let nextByte = (data.[x] ^^^ nextKeyStreamByte())
innerEncrypt(x + 1) (Array.append state [| nextByte |])
innerEncrypt (x + 1) (Array.append state [| nextByte |])

innerEncrypt 0 Array.empty

Expand Down
2 changes: 1 addition & 1 deletion NOnion/Http/TorHttpClient.fs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type TorHttpClient(stream: TorStream, host: string) =
MemoryExtensions.IndexOf(httpResponse.AsSpan(), delimiter)

Encoding.UTF8.GetString(httpResponse, 0, headerEndIndex),
httpResponse.[headerEndIndex + delimiter.Length..]
httpResponse.[headerEndIndex + delimiter.Length ..]

let headerLines =
header.Split(Array.singleton "\r\n", StringSplitOptions.None)
Expand Down
2 changes: 1 addition & 1 deletion NOnion/Utility/Base64Util.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module Base64Util =

if missingPadding > 0 then
input
+ (String.replicate(modulus - missingPadding) paddingCharacter)
+ (String.replicate (modulus - missingPadding) paddingCharacter)
else
input

Expand Down
6 changes: 3 additions & 3 deletions NOnion/Utility/Hex.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ open System
[<RequireQualifiedAccess>]
module Hex =

let FromByteArray(bytes: byte []) : string =
let FromByteArray(bytes: array<byte>) : string =
bytes
|> Array.map(fun (x: byte) -> String.Format("{0:X2}", x))
|> String.concat String.Empty

let ToByteArray(hex: string) : byte [] =
let ToByteArray(hex: string) : array<byte> =

// validate hex length
if hex.Length % 2 <> 0 then
invalidArg "hex" "hex.Length is not even"

// blit bytes to array
let bytes = Array.create(hex.Length / 2) 0uy
let bytes = Array.create (hex.Length / 2) 0uy
let mutable bytePos = 0

while bytePos < bytes.Length do
Expand Down

0 comments on commit eb00475

Please sign in to comment.