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 8595523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:27:16+00:00 2026-06-12T00:27:16+00:00

The SJCL docs provide the following code as an example for sha256: var bitArray

  • 0

The SJCL docs provide the following code as an example for sha256:

var bitArray = sjcl.hash.sha256.hash("message");  
var digest_sha256 = sjcl.codec.hex.fromBits(bitArray);  

The digest in that example being equal to a 64-character hex string, when I was expecting a 16-character hex string (256 bits = 16 hex characters). What am I missing? How can I get a 16-character digest of the hash?

  • 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-06-12T00:27:17+00:00Added an answer on June 12, 2026 at 12:27 am

    You’re misunderstanding something. 256 bits does not equal 16 hex digits.

    Think of it this way: 256 bits is equal to 32 bytes (8 bits in a byte). A byte (8 bits) can encode 256 (2^8) different values. A single hexadecimal digit (base-16) can encode 16 different values. How many hex digits do you need if you want to encode the same number of values as a byte? Two; two hex digits can encode 256 different values (16^2). So, if we need two hex digits per byte, and 256 bits is equal to 32 bytes, then that means we need 64 hex digits to represent the information that can be stored in 256 bits.

    The hex digest is fine. It’s supposed to be 64 characters.

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

Sidebar

Related Questions

My code is like SJCL.js function encrypt(data, key){ ...... } abcd.java public String callJavascript(String
I need to encrypt & decrypt data with both Java (on Android) and SJCL
Encryption The encryption is done with Stanford Javascript Crypto Library (SJCL). Below is a
i use the jedi 's jcl TJclDecompressArchiveClass and TJclDecompressArchive // http://wiki.delphi-jedi.org/index.php?title=JEDI_Code_Library var archiveclass: TJclDecompressArchiveClass;
Using password password, salt 1234567812345678 100 repetitions, 128-bit result http://bitwiseshiftleft.github.com/sjcl/demo/ is a javascript implementation,
I'm using SJCL , and it works fine with small ASCII strings. But when
I've had success using SJCL for ECDH , but that's Javascript, and I need
I build a Firefox Extension and i'm using the graph api. At the moment
I am developing a client app for a RESTful web service. The web app

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.