added base64 encoding
original vigna code