refactoring test finction enc_dec