rewrite vb routine in Arduino

I have this routine in Visual Basic 6 and i whant to convert for arduinio

stringa is the crypted string read from serial port
PADLEN is the lenght of KEYPAD
KEYPAD is a string of 15 characters
Valore is the valiue decrypted
Decodifica is the value yhat i need

k = 1

For i = 1 To (Len(stringa) - 1)
If (k >= PADLEN) Then k = 1
Valore = (Asc(Mid(stringa, i, 1)) Xor 128) Xor (Asc(Mid(KEYPAD, k, 1)))
Decodifica = Decodifica & Chr(Valore)
k = k + 1
Next i

Thank you for your help

This is my best guess at the translation.
WARNING: Since you didn't provide an initial value for 'Decodifica' and you AND it withe the other bytes you will always get ZERO out of this function.

Note: C++ arrays start at index 0, not 1 like in BASIC.

const byte PADLEN = 15;
const char KEYPAD[PADLEN + 1] = "gfjuwjiiUEHI2YI";

char Decodifica(const char *stringa) {
  byte decodeifica = 0;
  int k = 0;

  for (int i = 0; i < strlen(stringa); i++) {
    byte Valore = (stringa[i] ^ 128) ^ KEYPAD[k];
    decodeifica &= Valore;
    k = (k + 1) % PADLEN;
  }

  return decodeifica;
}