Jump to content

How to divide hex to hex


kpuk
 Share

Recommended Posts

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

You asked for it, you got it!

Step by step:

Local $str = 'ftq'
Local $bin = StringToBinary($str, 1)        ;; 1 = assume ANSI string
ConsoleWrite('Your string:  ' & $str & @LF)
ConsoleWrite('Its binary representation:    ' & $bin & @LF)
;; we need to reverse the bytes since the PC processor is Little Endian (Google!)
ConsoleWrite('The equivalent decimal value: ' & Int(StringToBinary(_StringReverse($str), 1)) & @LF)
ConsoleWrite('Your result:  ' & Int(StringToBinary(_StringReverse($str), 1)) / 0x1A & @LF)

Edit: <wrong click!> It's still unclear how you want the result converted to hex. Most of the times, the result will be a floating-point number, whose representation is a IEEE format, certainly not what you want to see, hex or not.

What precisely do you want to achieve? Dividing ASCII characters representation (and under _which_ encoding?) by a hex value is like a train divided by your mouse.

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

sorry, have forgotten to write type of result ((

I need result in hex representaion.

If this

$pass = _StringToHex($text)

$pass = Dec($pass)

$pass = Hex($pass / 26) (26 = 1Ah)

result as floating, but i need in hex

thx!

Link to comment
Share on other sites

sorry, have forgotten to write type of result ((

I need result in hex representaion.

If this

$pass = _StringToHex($text)

$pass = Dec($pass)

$pass = Hex($pass / 26) (26 = 1Ah)

result as floating, but i need in hex

The only little problem that you don't seem to realize is that the result is not an integer, in most cases. Use Round or Ceiling or Floor if you want an approximate integral [meaningless] result.

Anyway, the very idea of dividing any representation of some encoding of a string by a fixed value smells terribly wrong.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...