move crypto functions to simple util module, reference arrayIndex directly