Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5970539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:23:23+00:00 2026-05-22T20:23:23+00:00

Does Node.js have built-in Base64 encoding yet? The reason why I ask this is

  • 0

Does Node.js have built-in Base64 encoding yet?

The reason why I ask this is that final() from crypto can only output hexadecimal, binary or ASCII data. For example:

var cipher = crypto.createCipheriv('des-ede3-cbc', encryption_key, iv);
var ciph = cipher.update(plaintext, 'utf8', 'hex');
ciph += cipher.final('hex');

var decipher = crypto.createDecipheriv('des-ede3-cbc', encryption_key, iv);
var txt = decipher.update(ciph, 'hex', 'utf8');
txt += decipher.final('utf8');

According to the documentation, update() can output Base64-encoded data. However, final() doesn’t support Base64. I tried and it will break.

If I do this:

var ciph = cipher.update(plaintext, 'utf8', 'base64');
    ciph += cipher.final('hex');

Then what should I use for decryption? Hexadecimal or Base64?

Therefore, I’m looking for a function to Base64-encode my encrypted hexadecimal output.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:23:24+00:00Added an answer on May 22, 2026 at 8:23 pm

    Buffers can be used for taking a string or piece of data and doing Base64 encoding of the result. For example:

    > console.log(Buffer.from("Hello World").toString('base64'));
    SGVsbG8gV29ybGQ=
    > console.log(Buffer.from("SGVsbG8gV29ybGQ=", 'base64').toString('ascii'))
    Hello World
    

    The Buffer constructor is a global object, so no require is needed. Buffers created with strings can take an optional encoding parameter to specify what encoding the string is in. The available toString and Buffer constructor encodings are as follows:

    ‘ascii’ – for 7 bit ASCII data only. This encoding method is very
    fast, and will strip the high bit if set.

    ‘utf8’ – Multi byte encoded
    Unicode characters. Many web pages and other document formats use
    UTF-8.

    ‘ucs2’ – 2-bytes, little endian encoded Unicode characters. It
    can encode only BMP(Basic Multilingual Plane, U+0000 – U+FFFF).

    ‘base64’ – Base64 string encoding.

    ‘binary’ – A way of encoding raw
    binary data into strings by using only the first 8 bits of each
    character. This encoding method is deprecated and should be avoided in
    favor of Buffer objects where possible. This encoding will be removed
    in future versions of Node.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have any recommendations of tools that can be of assistance with moving
Does the CCK api allow me to create a node type, from a custom
Does Google force employees who have offers from Facebook to leave immediately?
Does anyone use have a good regex library that they like to use? Most
I adapted this tutorial (http://www.screaming-penguin.com/node/7749) to an Android app I've built to allow for
Does Node.JS support sending binary data? or does it require a Base64 layer? Also,
Does anyone have any information on this? I'm currently running Visual Studio Team System
I have some code below that is accessing the registry. The application is built
i have a class implemented from QGraphicsItem, called Node. i have a rectangle shaped
Anybody out there using BGL for large production servers? How many node does your

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.