It's not "decyphering" anything. It's calculating a sum and then complaining if it's not 0x31.
With some assumptions, I think the code is better expressed like this (I've given variables somewhat arbitrary names, particularly "table").
Code:
#include <stdio.h>
typedef unsigned char byte;
typedef unsigned int uint;
typedef unsigned long ulong;
int array[64] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
byte table[] = {0, 1, 2, 3, 4, 5};
void cypher_5(byte *tab) {
//if (string_length() != 6) printf("error\n");
int sum = 0;
for (int i = 0; i < 6; ++i)
sum += array[ (uint)tab[i] & 0xf ];
// sum += *(int*)(array + // this is assuming array is a byte array
// (ulong)( (uint)*(byte*)(tab + i) & 0xf ) * 4
// );
printf("%d\n", (int)sum);
if (sum != 0x31) printf("error\n");
}
int main() {
cypher_5(table);
}