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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:33:05+00:00 2026-05-19T10:33:05+00:00

I have to convert the following code into Qt c++ So I need to

  • 0

I have to convert the following code into Qt c++
So I need to understand what these lines to.

@key in this code is a pem key file contents by openssl

key = KEY+@key.public_key.to_der
  1. so i think this is converting that key to der format and then combining it with KEY.
    is it right?

  2. whats does this do? to_sizet(key.size)
    As you can see the function returns [num].pack(‘V’). But i dont know wht does it do? I mean [num].pavck(‘V’). what is it?

  3. And whats does this mean. key.size is it the strlen of key?

def write_crx
   print "write crx..." if @verbose
   key = KEY+@key.public_key.to_der
   File.open(@crx, 'wb') do |file|
     file << MAGIC
     file << EXT_VERSION
     file << to_sizet(key.size)
     file << to_sizet(@sig.size)
     file << key
     file << @sig
     File.open(@zip, 'rb') do |zip|
       file << zip.read
     end
   end
   puts "done at \"#{@crx}\"" if @verbose
 end
 def to_sizet num
   return [num].pack('V')
 end

Well I have one more Question. Forgot to add last time.
what does this line do?

KEY = %w(30 81 9F 30 0D 06 09 2A 86 48 86 F7 0D 01 01 01 05 00 03 81 8D 00).map{|s| s.hex}.pack('C*')
  • 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-19T10:33:06+00:00Added an answer on May 19, 2026 at 10:33 am

    so i think this is converting that key to der format and then combining it with KEY. is it right?

    Yes.

    whats does this do? to_sizet(key.size) As you can see the function returns [num].pack(‘V’). But i dont know wht does it do? I mean [num].pavck(‘V’). what is it?

    Well, just have a look at what the documentation on Array#pack says. With the V modifier, it just converts the array to a binary representation of a 32 bit unsigned integer type.

    And whats does this mean. key.size is it the strlen of key?

    Again, the Ruby documentation helps. String#size is indeed the string length.

    what does this line do?

    KEY = %w(30 81 9F 30 0D 06 09 2A 86 48 86 F7 0D 01 01 01 05 00 03 81 8D 00)
            .map{|s| s.hex}.pack('C*')
    

    %(…) defines an array where each of its entries, separated by whitespace is treated as a separate string. %w(one two) is essentially a shorthand for ["one", "two"].

    After that, we have to look up (again in the documentation) the meanings of Array#map and String#hex.

    map simply applies an operation to each element of an array and creates a new array with the result. The operation is s.hex – that is, parse each of the strings as a hexadecimal number.

    The result is once again packed, this time using the C* operation which, the documentation tells us, converts the numbers into their corresponding (unsigned) 8-bit character codes.

    In summary: that line converts the hexadecimal values into a string of their respective characters.

    Afterthought: you should really install Ruby and play a bit with the interactive Ruby console, irb. Keying in the above line already helps a lot:

    $ irb
    >> %w(30 81 9F 30 0D 06 09 2A 86 48 86 F7 0D 01 01 01 05 00 03 81 8D 00).map{|s| s.hex}
    => [48, 129, 159, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 129, 141, 0]
    >> %w(30 81 9F 30 0D 06 09 2A 86 48 86 F7 0D 01 01 01 05 00 03 81 8D 00).map{|s| s.hex}.pack('C*')
    => "0\201\2370\r\006\t*\206H\206\367\r\001\001\001\005\000\003\201\215\000"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code to convert a distinguishedName to a sAMAccountName: Dim de
I'm using php and I have the following code to convert an absolute path
Imagine I have the folling XML file: <a>before<b>middle</b>after</a> I want to convert it into
I have 28,000 images I need to convert into a movie. I tried mencoder
I have the following Transact-Sql that I am trying to convert to LINQ ...
I have a need to convert Pixels to Points in C#. I've seen some
I have an XML datatype and want to convert an element into a sql
I have the following code. When I check the value of variable i it
I have created a graphical image with the following sample code. BufferedImage bi =
I want to convert local html file on iPhone to PDF document. I have

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.