fork download
  1. v'**************************************
  2. ' Name: ***Convert TXT file to Executable EXE***
  3. ' Description:This code convert a TXT file to EXE file.When you convert the file start the EXE and the old file will be typed(like TYPE command)
  4. This is really great code
  5. NOTE : RUN THE .EXE FROM MS-DOS MODE
  6. ' By: Atanas Matev
  7. '
  8. ' Assumes:Create a label, a command button and common dialog control
  9. Change the Caption of the button to "Select a file"
  10. And that's all
  11. '
  12. 'This code is copyrighted and has' limited warranties.Please see http://w...content-available-to-author-only...e.com/vb/scripts/ShowCode.asp?txtCodeId=2071&lngWId=1'for details.'**************************************
  13.  
  14. Dim a(14) As Byte
  15. Dim i As Integer
  16. Public Function HiByte(ByVal wParam As Integer)
  17. HiByte = wParam \ &H100 And &HFF&
  18. End Function
  19. Public Function LoByte(ByVal wParam As Integer)
  20. LoByte = wParam And &HFF&
  21. End Function
  22. Private Sub Command1_Click()
  23. On Error GoTo 10
  24.  
  25. a(0) = 190
  26. a(1) = 15
  27. a(2) = 1
  28. a(3) = 185
  29. a(4) = 0
  30. a(5) = 0
  31. a(6) = 252
  32. a(7) = 172
  33. a(8) = 205
  34. a(9) = 41
  35. a(10) = 73
  36. a(11) = 117
  37. a(12) = 250
  38. a(13) = 205
  39. a(14) = 32
  40. CommonDialog1.Filter = "Text Files|*.txt|"
  41. CommonDialog1.Action = 1
  42.  
  43. Open CommonDialog1.filename For Input As #1
  44. sourcelen = LOF(1)
  45. Close #1
  46.  
  47. a(4) = LoByte(sourcelen)
  48. a(5) = HiByte(sourcelen)
  49.  
  50. newfilename = Left(CommonDialog1.FileTitle, Len(CommonDialog1.FileTitle) - 4) & ".exe"
  51. If MsgBox("Are you sure you want to convert `" & CommonDialog1.FileTitle & "` to `" & newfilename & "`", vbYesNo, "Confirm") = vbNo Then Exit Sub
  52. Open CommonDialog1.filename For Input As #1
  53. Open newfilename For Output As #2
  54. t = Input(LOF(1), 1)
  55. For k = 0 To 14
  56. st = st & Chr(a(k))
  57. Next k
  58. st = st & t
  59. Print #2, st
  60. Close #1
  61. Close #2
  62. Label1.Caption = "Converted successful"
  63. Exit Sub
  64. 10
  65. Label1.Caption = "Error"
  66. End Sub
Success #stdin #stdout 0.03s 25612KB
stdin
/*  Berechnung des Hamming-Abstandes zwischen zwei 128-Bit Werten in 	*/
/*	einer Textdatei. 													*/
/*  Die Werte müssen auf einer separaten Zeile gespeichert sein			*/
/* 																		*/
/*	Erstellt: 17.5.2010													*/
/*  Autor: Thomas Scheffler												*/

#include <stdio.h>
#include <stdlib.h>

#define ARRAY_SIZE 32

unsigned Hamdist(unsigned x, unsigned y)
{
  unsigned dist = 0, val = x ^ y;
 
  // Count the number of set bits
  while(val)
  {
    ++dist; 
    val &= val - 1;
  }
 
  return dist;
}



int main (void)
{
	char hex;
	int i;
	int a[ARRAY_SIZE];
	int b[ARRAY_SIZE];
	int hamDist = 0;
	FILE* fp;
	
	//Arrays mit 0 initialisieren
	for (i = 0; i < ARRAY_SIZE; ++i)
	{
  		a[i] = 0;
  		b[i] = 0;
	}

	
	fp = fopen("hex.txt","r");
	if (fp == NULL) 
	{
		printf("Die Datei hex.txt wurde nicht gefunden!");
		exit(EXIT_FAILURE);
	}

	i=0;
	printf("1.Zeile einlesen.\n");

 	while((hex=fgetc(fp))!='\n' && hex != EOF)
    {
        a[i]=strtol(&hex,0,16);
		i++;
    }
	i=0;
	printf("2.Zeile einlesen.\n");

 	while((hex=fgetc(fp))!='\n' && hex != EOF)
    {
    	b[i]=strtol(&hex,0,16);
        i++;
    }
	fclose(fp);

	printf("Hamming-Abweichung pro Nibble:\n");
	for (i = 0; i < ARRAY_SIZE; ++i)
	{
		printf ("%i\t%i\t%i\n",a[i],b[i],Hamdist(a[i],b[i]));
		hamDist += Hamdist(a[i],b[i]);
	}
	printf ("\nHamming-Abweichung der Hash-Werte:%d\n",hamDist);
}

stdout
v'**************************************
' Name: ***Convert TXT file to Executable EXE***
' Description:This code convert a TXT file to EXE file.When you convert the file start the EXE and the old file will be typed(like TYPE command)
This is really great code
NOTE : RUN THE .EXE FROM MS-DOS MODE
' By: Atanas Matev
'
' Assumes:Create a label, a command button and common dialog control
Change the Caption of the button to "Select a file"
And that's all
'
'This code is copyrighted and has' limited warranties.Please see http://w...content-available-to-author-only...e.com/vb/scripts/ShowCode.asp?txtCodeId=2071&lngWId=1'for details.'**************************************

Dim a(14) As Byte
Dim i As Integer
Public Function HiByte(ByVal wParam As Integer)
 HiByte = wParam \ &H100 And &HFF&
End Function
Public Function LoByte(ByVal wParam As Integer)
 LoByte = wParam And &HFF&
End Function
Private Sub Command1_Click()
 On Error GoTo 10
 
 a(0) = 190
 a(1) = 15
 a(2) = 1
 a(3) = 185
 a(4) = 0
 a(5) = 0
 a(6) = 252
 a(7) = 172
 a(8) = 205
 a(9) = 41
 a(10) = 73
 a(11) = 117
 a(12) = 250
 a(13) = 205
 a(14) = 32
 CommonDialog1.Filter = "Text Files|*.txt|"
 CommonDialog1.Action = 1
 
 Open CommonDialog1.filename For Input As #1
 sourcelen = LOF(1)
 Close #1
 
 a(4) = LoByte(sourcelen)
 a(5) = HiByte(sourcelen)
 
 newfilename = Left(CommonDialog1.FileTitle, Len(CommonDialog1.FileTitle) - 4) & ".exe"
 If MsgBox("Are you sure you want to convert `" & CommonDialog1.FileTitle & "` to `" & newfilename & "`", vbYesNo, "Confirm") = vbNo Then Exit Sub
 Open CommonDialog1.filename For Input As #1
 Open newfilename For Output As #2
 t = Input(LOF(1), 1)
 For k = 0 To 14
 st = st & Chr(a(k))
 Next k
 st = st & t
 Print #2, st
 Close #1
 Close #2
 Label1.Caption = "Converted successful"
 Exit Sub
10
 Label1.Caption = "Error"
End Sub