• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

input-output-hk / atala-prism-building-blocks / 7972371817

20 Feb 2024 10:56AM UTC coverage: 31.112% (-0.2%) from 31.337%
7972371817

Pull #900

FabioPinheiro
build: make docker image only for the server
Pull Request #900: build: make docker image only for the server

4015 of 12905 relevant lines covered (31.11%)

0.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/shared/src/main/scala/io/iohk/atala/shared/utils/BytesOps.scala
1
package io.iohk.atala.shared.utils
2

3
import java.nio.charset.StandardCharsets
4

5
object BytesOps {
1✔
6
  private val HexArray = "0123456789abcdef".getBytes(StandardCharsets.US_ASCII);
7

8
  // Converts hex string to bytes representation
1✔
9
  def hexToBytes(hexEncoded: String): Array[Byte] = {
1✔
10
    require(hexEncoded.length % 2 == 0, "Hex length needs to be even")
×
11
    hexEncoded.grouped(2).toVector.map(hexToByte).toArray
12
  }
13

14
  // Converts bytes to hex string representation
1✔
15
  def bytesToHex(bytes: Iterable[Byte]): String = {
1✔
16
    val hexChars = new Array[Byte](bytes.size * 2)
×
17
    for ((byte, i) <- bytes.zipWithIndex) {
18
      val v = byte & 0xff
1✔
19
      hexChars(i * 2) = HexArray(v >>> 4)
1✔
20
      hexChars(i * 2 + 1) = HexArray(v & 0x0f)
21
    }
1✔
22
    new String(hexChars, StandardCharsets.UTF_8)
23
  }
24

1✔
25
  private def hexToByte(h: String): Byte = {
1✔
26
    Integer.parseInt(h, 16).toByte
27
  }
28
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc