Categories

ep.base64Encode()

Categories: Utilities

ep.base64Encode( object, [ noJSON ] )

Plugin: ep.base64

Description: Encrypt a text or object as base64 string.

  • ep.base64Encode( object, [ noJSON ] )

    version added: 6.11.0

    object   A object to encrypt

    noJSON   A boolean indicating whether to disable convert to json before encrypt.

The ep.base64Encode() method encrypts objects to base64 string, is support not only strings, because it converts the object to an json string before encrypt base64.

  • Encrypt objects as base64.

    Code:
    ep.base64Encode({
        foo: 'bar'
    });
    
    ep.base64Encode(['foo', 'bar']);
    
    ep.base64Encode(12345);
    
    ep.base64Encode('Lorem ipsum');
    
    
  • Encrypt string as base64 with json convert.

    Code:
    ep.base64Encode( 'Lorem ipsum' );
    
    Results:
    IkxvcmVtIGlwc3VtIg==
    
    
  • Encrypt string as base64 without json convert.

    Code:
    ep.base64Encode( 'Lorem ipsum', true );
    
    Results:
    TG9yZW0gaXBzdW0=