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

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

29 Mar 2024 08:58AM UTC coverage: 31.807% (+0.4%) from 31.453%
8479182462

Pull #952

web-flow
Update docs/decisions/20240116-use-zio-failures-and-defects-effectively.md

Co-authored-by: Pete Vielhaber <peter.vielhaber@iohk.io>
Signed-off-by: bvoiturier <benjamin.voiturier@iohk.io>
Pull Request #952: docs(adr): ATL-6599 update ADR based on first implementation experience

4515 of 14195 relevant lines covered (31.81%)

0.32 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