# Reading length of Keys - Read a key challenge

**URL:** <https://forum.codecrafters.io/t/reading-length-of-keys-read-a-key-challenge/6188>\
**Category:** Challenges\
**Tags:** challenge:redis\
**Created:** [March 7, 2025, 8:27am UTC](https://forum.codecrafters.io/t/reading-length-of-keys-read-a-key-challenge/6188 "2025-03-07T08:27:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![akhil-lakka](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/akhil-lakka/32/5643_2.png) [@akhil-lakka](https://forum.codecrafters.io/u/akhil-lakka)\
**Post date:** [March 7, 2025, 8:27am UTC](https://forum.codecrafters.io/t/reading-length-of-keys-read-a-key-challenge/6188/1 "2025-03-07T08:27:58Z")

</div>

Hi,  
Im not getting correct length of keys string to read, can someone please help with this.

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [March 7, 2025, 2:36pm UTC](https://forum.codecrafters.io/t/reading-length-of-keys-read-a-key-challenge/6188/3 "2025-03-07T14:36:21Z")

</div>

Hey @akhil-lakka, you can set `debug: true` in codecrafters.yml to reveal a hexdump of the RDB file.

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/9/932c10d875596452a160258dc66464685fc11afd.jpeg)

I’m not sure why byteValue+1 is used here:

```auto
String finalByteVal = Integer.toHexString(byteValue+1);

```

In the screenshot above, 250 is `fa` in hex, which indicates an [auxiliary field](https://rdb.fnordig.de/file_format.html) containing two strings: a key and a value.

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/6/696a6fe80d4bc149cb493274ecfef80d704cdf67.png)

Let me know if you’d like further clarification!

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [March 17, 2025, 8:40am UTC](https://forum.codecrafters.io/t/reading-length-of-keys-read-a-key-challenge/6188/5 "2025-03-17T08:40:53Z")

</div>

Closing this thread due to inactivity. If you still need assistance, feel free to reopen or start a new discussion!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [March 22, 2025, 8:40am UTC](https://forum.codecrafters.io/t/reading-length-of-keys-read-a-key-challenge/6188/6 "2025-03-22T08:40:57Z")

</div>

Closed on March 22, 2025, 8:40am UTC

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
