Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


need help

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Liger
Cheater
Reputation: 0

Joined: 26 Jan 2019
Posts: 36
Location: don't have

PostPosted: Wed Feb 26, 2020 9:53 am    Post subject: need help Reply with quote

I tried to reverse this function in order to convert the byte into strings , I could not do that
How can this be done

Code:
function string_tohex(str)
 return (str:gsub('.', function (c)
 return string.format ('%02X' ,string.byte(c)) end))
end

_________________
(^_^)
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
exohaxor
Expert Cheater
Reputation: 1

Joined: 02 Sep 2018
Posts: 101

PostPosted: Wed Feb 26, 2020 11:37 am    Post subject: Reply with quote

Code:

function fromhex(s)
  return s:gsub("%w%w",function(c)
  return string.char(tonumber(c,16))
end)
end

_________________
hi
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Wed Feb 26, 2020 12:49 pm    Post subject: Reply with quote

1st Test:

Code:
function string_tohex(str)
 return (str:gsub('..', function (c)
 return string.format ('%02X' ,string.byte(c)) end))
end


function fromhex(s)
  return s:gsub("%w%w",function(c)
  return string.char(tonumber(c,16))
end)
end

print(string_tohex("cheat engine"))
--- result : 636865617420656E67696E65

print(fromhex("636865617420656E67696E65"))
--- result : cheat engine 12



2nd Test:

Code:
function string_tohex(str)
    return (str:gsub('.', function (c)
        return string.format('%02X', string.byte(c))
    end))
end

function string_fromhex(str)
    return (str:gsub('..', function (cc)
        return string.char(tonumber(cc, 16))
    end))
end

print(string_tohex("cheat engine"))
-- result : 636865617420656E67696E65

print(string_fromhex("636865617420656E67696E65"))
-- result : cheat engine

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites