Recover Skype image from HEX - data-recovery

This question was migrated from Super User because it can be answered on Stack Overflow.
Migrated last month.
I'd like to recover a lost image from my own Skype's main.db. The images are encoded as HEX. Do you know how to turn them back into the original format?
They go like that:
0x00FFD8FFE000...
What function might they use?

I've found the answer pretty quickly so here's the C# solution for referece:
void Main()
{
var data ="00FFD8FFE000...";
var original = Convert.FromHexString(data);
File.WriteAllBytes(#"C:\temp\image.jpg", original);
}
It's important to trim the 0x at the beginning.

Related

What do I pass to the Flutter Completer object?

A previous question on stack overflow discussed obtaining an image's size to which someone posted an answer
Future<ui.Image> _getImage() {
Completer<ui.Image> completer = new Completer<ui.Image>();
new NetworkImage('https://i.stack.imgur.com/lkd0a.png')
.resolve(new ImageConfiguration())
.addListener((ImageInfo info, bool _) => completer.complete(info.image));
return completer.future;
}
Unfortunately the above code will not compile due to complete.complete(info.image) having an error in Android Studio which says:
the argument type 'image' can't be assigned to the parameter type
'FutureOr'
Could someone suggest how to correct the code so that the Completer object will work properly?
I would ask the original poster of the accepted answer but I don't have enough reputation to comment yet. So I am asking the question here.
The link to the original post is here:
How do I determine the width and height of an image in Flutter?
It means that the types do not match up.
Looking at your code, it should work since ImageInfo.image should return ui.Image.
First of all, you can omit the type in the constructor, like this:
Completer<Image> completer = Completer();
If you are still having issues, it would be helpful to see more of the stack trace.

Is there some character I can insert to get a longer pause with SAPI5 TTS?

I know the TTS system will pause on a period (.) or comma (,). But how can I get it to pause for a longer period of time? For example, in a question and answer scenario I want the voice to read the question and pause for moment so the listener can mentally answer the question in his or her mind and then the voice reads the answer.
I've tried stringing together a series of periods but they seem to get consolidated into one in the TTS so that they effectively pause the same length as a single period (Festival on linux did not do this, but on Windows SAPI seems to).
Is there some character or sequence of characters I can use to get a longer pause? Or alternatively another means of achieving this goal?
Characters won't do. Use XML markup to control this better, pass the SPF_IS_XML flag:
HRESULT hr = pVoice->Speak(L"Hello <silence msec=\"1000\"/> world",
SPF_IS_XML, NULL );
Or you can use an SSML document with the SPF_PARSE_SSML flag, use the <break> element:
<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US">
Hello<break time="1000ms" />world
</speak>
If you can use C# then the PromptBuilder class is very handy to build the SSML:
private SpeechSynthesizer synth = new SpeechSynthesizer();
private void sayHello() {
var builder = new PromptBuilder();
builder.AppendText("Hello");
builder.AppendBreak(TimeSpan.FromMilliseconds(1000));
builder.AppendText("world");
synth.SpeakAsync(new Prompt(builder));
}

How do format a date/time/number/currency in another locale?

How do i format something for another locale in Windows?
For example, in managed C# code, i would try to render a DateTime using en-US locale with:
String s = DateTime.Now.ToString(CultureInfo.CreateSpecificCulture("en-US"));
TextRenderer.DrawText(
e.Graphics, s, SystemFonts.IconTitleFont,
new Point(16, 16), SystemColors.ControlText);
And that works fine when my computer's locale is en-US:
It even works fine when my computer's locale is de-DE:
But it completely falls apart when my computer's locale is ps-AF:
Note: My sample code is in .NET, but can also be native.
Update: Attempting to set System.Threading.Thread.CurrentThread.CurrentCulture to en-US before calling DrawText:
var oldCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
try
{
// String s = DateTime.Now.ToString(CultureInfo.CreateSpecificCulture("en-US"));
String s = DateTime.Now.ToString();
TextRenderer.DrawText(e.Graphics, s, SystemFonts.IconTitleFont, new Point(16, 16), SystemColors.ControlText);
}
finally
{
System.Threading.Thread.CurrentThread.CurrentCulture = oldCulture;
}
No help.
Nine, no help
Jack, no help
Eight, possible straight
King, possible flush
Ace, no help
Six, possible straight
Dave of love for the dealer
Ace bets.
Update Two:
From Michael Kaplan's blog entry:
Sometimes, GDI respects users (even if no one else does!)
GDI doesn't give a crap about formatting or really anything related to locales, with one single exception:
Digit Substitution
Any time you go to render text it will grab those digit substitution settings in the user locale (including the user override information) and use the info to decide how to display numbers.
And there is no way to override those settings at the level where GDI uses them.
i wonder how Chrome manages it. When i write digits here, in the stackoverflow question, Chrome renders them using latin digits:
0123456789
See:
What you are seeing is due to the digit substitution that occurs when your system's locale is ps-AF.
I believe that's OK -- Users of such a locale are used to seeing digits presented this way.
Normally the way this is done is slightly different, see here for example, but I don't actually think this should make any difference:
String s = DateTime.Now.ToString(new CultureInfo("en-US"));
An alternative is to set Thread.CurrentCulture to your desired locale.
I.e. do this:
Thread.CurrentCulture = new CultureInfo("en-US");
And you can then replace the first line of your code with this:
String s = DateTime.Now.ToString();
I am not quite sure, but I believe that this would solve the digit substitution issue as DrawText would now be based on the en-US culture, rather than ps-AF

text file protection for Game Maker's GML and RPG Maker XP RGSS [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
i've been working on 2 projects, a program made in Game Maker 8 and a RPG made in RPG Maker XP, one of the thing i am trying to do is get RPG Maker XP to read a "Score File" made from Game Maker, the score file itself is just a basic text file which both the Game Maker Program and the RPG Maker XP Game will read to gather data.
the problem i face is that if someone was to open this score file in a text editor like notepad, they could change the data and "cheat", so what i have been trying to do is encrypt the file so that at first glance, it's unreadable, have Game Maker and RPG Maker XP decrypt the file, pull all the data out of it and then encrypt it
however i have hitched a snag, the .dll i was working with in Game Maker seems to encrypt/decrypt the score file differently, i tested the .dll by creating 2 identical .txt file with the same text in them and have then encrypted in the 2 programs, the contents was completely different which means that if i try decrypting a file in RPG Maker XP which was encrypted in Game Maker, it will fail
i have tried other .dlls but they don't seem to work in RPG Maker XP, from what i understand, RGSS is a class of Ruby which means any code which would work in Ruby shoudl work in RPG Maker XP and between Ruby and Game Maker's GML, C is the common language the 2 can use .dlls for
so here is what i am asking, is there any .dll, script, code ect. which i can use to protect the data in my text file from being edited outside Game Maker and RPG Maker XP
Troy "Memor-X" Memor
PS: if there is a method that can also work in a .php program that would be great also, but i can work around that if it can't
XOR is a very simple, but quite effective, solution to this problem.
In GML:
/// script load_xor_file
// arguments: filename
// Prerequisite: Change the "key=" line to your chosen key
var key, kl, file, len, str, i;
key = "YOUR SECRET KEY HERE";
kl = string_length(key);
file = file_bin_open(argument0,0);
len = file_bin_size(file);
str = "";
for( i=0; i<l; i+=1) {
str += chr(file_bin_read_byte(file) ^ ord(string_char_at(key,i mod kl + 1)));
}
file_bin_close(file);
return str;
/// script save_xor_file
// arguments: filename, data
// Prerequisite: Change the "key=" line to the SAME KEY as in load_xor_file
var key, kl, file, len, i;
key = "YOUR SECRET KEY HERE";
file = file_bin_open(argument0,1);
file_bin_rewrite(file);
len = string_length(argument1);
for( i=0; i<len; i+=1) {
file_bin_write_byte(file, chr(string_char_at(argument1,i+1)) ^ chr(string_char_at(key,i mod kl + 1)));
}
file_bin_close(file);
I have never used RPG Maker myself, but I imagine it wouldn't be too hard to write similar code for it.
A couple of notes, it doesn't guarantee security. One could decompile the Game Maker EXE and reveal the key, or the key can just straight-up be broken if it is insecure.
A good, secure key is long, because breaking the encryption relies on the key repeating itself. If the key is the over half the length of the data being encrypted, it is virtually impossible to break the encryption, except by a known-plaintext attack if the file's contents are predictable (for example, I could assume the file contains the player's name and score, so those could be used in a known-plaintext attack).
Overall, this won't guarantee security of the file, but for your purposes should be more than suitable.
Also, since you were asking for a possible PHP solution:
<?php
function load_xor_file($filename) {
$key = "YOUR SECRET KEY HERE";
$in = file_get_contents($filename);
$keyrep = str_repeat($key,ceil(strlen($in)/strlen($key)));
return $in ^ $keyrep;
}
function save_xor_file($filename,$data) {
$key = "YOUR SECRET KEY HERE";
$keyrep = str_repeat($key,ceil(strlen($data)/strlen($key)));
file_put_contents($filename,$data ^ $keyrep);
}
?>
PS. I know this question is fairly old, but I was just randomly browsing Game Maker tags :p

LINQtoCRM and DynamicEntity

I found LINQtoCRM (http://linqtocrm.codeplex.com/) and I started playing with it. It's nice, but before I get carried away I found there appears to be a showstopper: I can't figure out how to query against DynamicEntities (so I can query against my custom entities). Can someone confirm if this is currently impossible? Or give an example of how one would go about it?
This works:
var res = from c in p.Linq<task&gt()
select c;
string msg = "";
foreach (task dyn in res.ToList<task>())
{
msg += dyn.ToString();
}
If you s/task/DynamicEntity/ it no longer works :) Just want to confirm it's currently undoable before I go write lots more boilerplate...
edit: angle brackets
(I implemented the original version of LinqtoCRM and I'm still a maintainer).
I do not believe dynamic entities are supported. There is some related discussion on the forum. Maybe give XrmLinq a try.

Resources