it works but instead of producing 0, it produces Z

a quick summary, I bought a laptop on ebay from china (lesson learned lol), and found it was EFI locked. henceforth, I took my Arduino Uno R3, and made the following sketch that works
but I had to flash HID keyboard for it to work after, hex files attached
so,
I uploaded the sketch to Arduino Uno ,
then placed it on DFU mode,
on terminal:
sudo dfu-programmer atmega16u2 erase
** sudo dfu-programmer atmega16u2 flash --debug 1 Arduinokeyboard-0.3.hex.txt**
** sudo dfu-programmer atmega16u2 reset**

when i test it, it produced the four digits needed, except number letter Z instead of number zero such as zzzz, zzz1 , zzz2 .........999z

//EFI Pin bruteforce
const int ledPin = 13;
int counter = 0;
//waits for iCould
int loops = 0;
int value0 = 0;
int value1 = 0;
int value2 = 0;
int value4 = 0;
int fakecounter = counter;
char pin[]="xxxx";
uint8_t buf[8] = {
0 }; /* Keyboard report buffer */
void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
  randomSeed(analogRead(0));
  delay(200);
}
void loop(){
  if (counter <= 9999){
    delay(8000);
    digitalWrite(ledPin, LOW);
    delay(5500);
    digitalWrite(ledPin, HIGH);
    sprintf(pin, "%04d", fakecounter);
    //First Digit  
    int value0 = pin[0] - '0';
    buf[3] = value0 + 29;
    if (buf[3] = 30){
      buf[3] = value0 + 29;
      Serial.write(buf, 8);
      delay(450);
      releaseKey();
      delay(420);
    }
    //Second Digit
    int value1 = pin[1] - '0'; 
    buf[3] = value1 + 29;
    if (buf[3] = 30){
      buf[3] = value1 + 29;
      Serial.write(buf, 8);
      delay(398);
      releaseKey();
      delay(510);
    }
    //Third Digit
    int value2 = pin[2] - '0'; 
    buf[3] = value2 + 29;
    if (buf[3] = 30){
      buf[3] = value2 + 29;
      Serial.write(buf, 8);
      delay(421);
      releaseKey();
      delay(423);
    }
    //Forth Digit
    int value3 = pin[3] - '0'; 
    buf[3] = value3 + 29;
    if (buf[3] = 30){
      buf[3] = value3 + 29;
      Serial.write(buf, 8);
      delay(430);
      releaseKey();
      delay(525);
    }
    //Enter Key
    buf[3] = 40;
    Serial.write(buf, 8);
    delay(305);
    releaseKey();
  }
  //reached 4 digit PIN max value
  if (counter > 9999){
    for (int blinkies = 0; blinkies < 8; blinkies++) {
      digitalWrite(ledPin, HIGH);
      delay(20);
      digitalWrite(ledPin, LOW);
      delay(200);
  }
    delay(6000);
    }
  ++counter;
  fakecounter = counter;
}


void releaseKey() {
  buf[0] = 0;
  buf[2] = 0;
  buf[3] = 0;
  Serial.write(buf, 8);  // Release key
}

Arduino-keyboard-0.3.hex.txt (11.1 KB)

Arduino-usbserial-uno.hex.txt (11.2 KB)

I do not know what the real problem is, but I do know:

(1) All of those delay(...) statements are wasting the power of the Arduino and are going to get you into trouble in the long run, and

(2) This code:

if (buf[3] = 30){

which appears in more than one place is probably wrong (one equal sign is assignment, TWO equal signs is for comparison).

(3) The "magic" numbers 29 and 30 are used all over the place, probably incorrectly and certainly without explanation.

the problem is, I want the Arduino HID keyboard to type four digits numbers,
it does type the numbers from 1 to 9, however number zero appears as a letter Z
for example, instead of 0000, it is zzzz, instead of 1110 it is 111z etc.

the delay is due to the time limit in the EFI of the laptop, that only allows you to pin at certain speed.

the code works, except number zero,

If you're operating directly with USB keyboard scan codes, you'll notice that they don't line up nicely like ASCII.
In fact, the keycode for 'Z' is one less that '1', and '0' is one more than '9', at least according to this diagram: