SourceFormatX

CodeMorph

Overview

Features

CodeMorph C++

CodeMorph Delphi

Code Obfuscation

Screenshots

Documentation

FAQs & Tips

Update History

License Policy

CodeToHtml

CodeMorph Delphi Code Obfuscator


Delphi / Pascal Junk Code Obfuscator of CodeMorph randomly generate junk code and insert into your pascal and delphi source code with predefined customization options.

  //////////////////////////////////////////////////////////////////////////////////////////
  //                                                                                      //
  //      Before Junk Code Obfuscating - Object Pascal (Delphi) Example Source Code       //
  //                                                                                      //
  //////////////////////////////////////////////////////////////////////////////////////////

  function QuickPos(const Substr, S: WideString; MatchesIndex: Integer = 1): Integer;
  var
    LenOfS, LenOfSubstr: Integer;
  begin
    Result := Pos(Substr, S);

    if (MatchesIndex = 1) or (Result = 0) then
      Exit;

    LenOfS := Length(S);
    LenOfSubstr := Length(Substr);

    while (MatchesIndex > 1) and (Result > 0) do
    begin
      Result := _PosForward(Substr, S, Result + 1, LenOfSubstr, LenOfS);

      if Result = 0 then
        Exit;

      Dec(MatchesIndex);
    end;
  end;
  

  //////////////////////////////////////////////////////////////////////////////////////////
  //                                                                                      //
  //      After Junk Code Obfuscating - Object Pascal (Delphi) Example Source Code        //
  //                                                                                      //
  //////////////////////////////////////////////////////////////////////////////////////////

  function QuickPos(const Substr, S: WideString; MatchesIndex: Integer = 1): Integer;
  var
    LenOfS, LenOfSubstr: Integer;
  begin
    // junk instruction begin
    asm
      jz   @1
      jnz  @1
      db   $e9
      @1:
    end;
    // junk instruction end

    Result := Pos(Substr, S);

    // junk instruction begin
    asm
          pushf
          push  $0A
      @1: jnb   @3
          jmp   @2
      @2: call  @4
      @3: jnb   @2
      @4: add   esp,4
          jmp   @5
      @5: dec   dword ptr [esp]
          jno   @6
      @6: jns   @1
          jp    @7
      @7: add   esp,4
          popf
          jmp   @8
      @8:
    end;
    // junk instruction end

    if (MatchesIndex = 1) or (Result = 0) then
    begin
      // junk instruction begin
      asm
            pushf
            jb    @3
        @1: jmp   @2
        @2: call  @4
        @3: jb    @1
        @4: add   esp,4
            popf
            jmp   @5
        @5:
      end;
      // junk instruction end

      Exit;
    end;

    LenOfS := Length(S);
  
    // junk instruction begin
    asm
          jz   @1
          jnz  @1
          db   $e8
      @1:
    end;
    // junk instruction end

    LenOfSubstr := Length(Substr);

    // junk instruction begin
    asm
      db 0E9h,0A2h,001h,000h,000h,049h,00Fh,0F6h,03Ch,0CFh,075h,0EEh,0C0h,00Fh,031h,08Bh
      db 0C8h,00Fh,031h,02Bh,0C8h,0F7h,0D1h,081h,0F9h,000h,050h,000h,000h,07Fh,0FEh,00Fh
      db 031h,08Bh,0C8h,00Fh,031h,02Bh,0C8h,0F7h,0D1h,081h,0F9h,000h,050h,000h,000h,07Fh
      db 0FEh,0D6h,00Fh,088h,0DDh,001h,000h,000h,00Fh,089h,0D7h,001h,000h,000h,03Eh,0C1h
      db 0C3h,005h,0C1h,0CBh,005h,036h,00Fh,08Ah,001h,002h,000h,000h,00Fh,08Bh,0FBh,001h
      db 000h,000h,05Bh,0E8h,00Bh,000h,000h,000h,072h,065h,067h,069h,073h,074h,065h,072h
      db 065h,064h,000h,058h,0EBh,002h,012h,028h,0E8h,03Eh,000h,000h,000h,099h,04Fh,0F6h
      db 03Ch,0FFh,090h,05Fh,050h,00Fh,031h,08Bh,0C8h,00Fh,031h,02Bh,0C8h,0F7h,0D1h,081h
      db 0F9h,000h,050h,000h,000h,07Ch,005h,0E9h,0D7h,06Ch,030h,0F0h,0E8h,00Bh,000h,000h
      db 000h,072h,065h,067h,069h,073h,074h,065h,072h,065h,064h,000h,058h,0F8h,00Fh,084h
      db 0A1h,000h,000h,000h,00Fh,085h,09Bh,000h,000h,000h,03Bh,068h,01Dh,024h,000h,000h
      db 083h,0C4h,004h,083h,0C4h,004h,00Fh,084h,007h,000h,000h,000h,00Fh,085h,001h,000h
      db 000h,000h,048h,0E8h,00Bh,000h,000h,000h,072h,065h,067h,069h,073h,074h,065h,072h
      db 065h,064h,000h,058h,0EBh,00Bh,072h,065h,067h,069h,073h,074h,065h,072h,065h,064h
      db 000h,065h,0F8h,00Fh,083h,056h,0FFh,0FFh,0FFh,000h,0A4h,0BCh,0E6h,0D6h,0B7h,0E8h
      db 00Bh,000h,000h,000h,072h,065h,067h,069h,073h,074h,065h,072h,065h,064h,000h,058h
      db 0F9h,00Fh,031h,08Bh,0C8h,00Fh,031h,02Bh,0C8h,0F7h,0D1h,081h,0F9h,000h,050h,000h
      db 000h,07Fh,0FEh,068h,019h,054h,000h,000h,083h,0C4h,004h,0D6h,00Fh,08Ah,0CFh,000h
      db 000h,000h,00Fh,08Bh,0C9h,000h,000h,000h,058h,0EBh,00Dh,077h,072h,06Fh,06Eh,067h
      db 020h,073h,065h,072h,069h,061h,06Ch,000h,0E9h,038h,0FFh,0FFh,0FFh,043h,03Eh,0F6h
      db 03Ch,0C5h,094h,053h,011h,0E8h,001h,000h,000h,000h,086h,0E8h,001h,000h,000h,000h
      db 0B8h,083h,044h,024h,004h,012h,083h,004h,024h,00Ah,0C3h,0F8h,050h,052h,00Fh,031h
      db 033h,0C8h,05Ah,033h,0C8h,058h,051h,059h,0F9h,00Fh,082h,006h,000h,000h,000h,000h
      db 06Bh,05Dh,082h,06Bh,0EBh,00Fh,0CFh,00Fh,0CFh,036h,00Fh,080h,0D3h,0FEh,0FFh,0FFh
      db 00Fh,081h,0CDh,0FEh,0FFh,0FFh,0DCh,050h,052h,00Fh,031h,033h,0C8h,05Ah,033h,0C8h
      db 058h,068h,0EFh,04Ch,000h,000h,083h,0C4h,004h,036h,00Fh,084h,06Dh,0FEh,0FFh,0FFh
      db 00Fh,085h,067h,0FEh,0FFh,0FFh,00Ah,00Fh,031h,08Bh,0C8h,00Fh,031h,02Bh,0C8h,0F7h
      db 0D1h,081h,0F9h,000h,050h,000h,000h,07Fh,0FEh,0EBh,00Bh,072h,065h,067h,069h,073h
      db 074h,065h,072h,065h,064h,000h,068h,027h,0ACh,000h,000h,083h,0C4h,004h,00Fh,08Ch
      db 0B3h,0FFh,0FFh,0FFh,00Fh,08Dh,0ADh,0FFh,0FFh,0FFh,094h,068h,075h,004h,000h,000h
      db 083h,0C4h,004h,0F3h,0F8h,00Fh,083h,004h,0FFh,0FFh,0FFh,000h,0BBh,08Dh,090h,07Ch
      db 097h,0E8h,001h,000h,000h,000h,0EAh,0E8h,001h,000h,000h,000h,008h,083h,044h,024h
      db 004h,012h,083h,004h,024h,00Ah,0C3h,010h,0F9h,00Fh,082h,01Ah,0FFh,0FFh,0FFh,000h
      db 02Bh,09Dh,0CDh,020h,0DBh,00Fh,031h,08Bh,0C8h,00Fh,031h,02Bh,0C8h,0F7h,0D1h,081h
      db 0F9h,000h,050h,000h,000h,07Fh,0FEh,0E8h,00Bh,000h,000h,000h,072h,065h,067h,069h
      db 073h,074h,065h,072h,065h,064h,000h,058h,068h,09Fh,00Ch,000h,000h,083h,0C4h,004h
      db 00Fh,088h,095h,0FFh,0FFh,0FFh,00Fh,089h,08Fh,0FFh,0FFh,0FFh,073h,0EBh,00Bh,072h
      db 065h,067h,069h,073h,074h,065h,072h,065h,064h,000h,00Fh,088h,007h,000h,000h,000h
      db 00Fh,089h,001h,000h,000h,000h,0A1h
    end;
    // junk instruction end

    while (MatchesIndex > 1) and (Result > 0) do
    begin
      Result := _PosForward(Substr, S, Result + 1, LenOfSubstr, LenOfS);

      // junk instruction begin
      asm
            jz   @1
            jnz  @1
            db   $9a
            db   $e8
        @1:
      end;
      // junk instruction end

      if Result = 0 then
        Exit;

      // junk instruction begin
      asm
        db   0EBh, 1,    0Fh,  31h
        db   0F0h, 0EBh, 0Ch,  33h
        db   0C8h, 0EBh, 3,    0EBh
        db   9,    0Fh,  59h,  74h
        db   5,    75h,  0F8h, 51h
        db   0EBh, 0F1h
      end;
      // junk instruction end

      Dec(MatchesIndex);

      // junk instruction begin
      asm
            jz   @1
            jnz  @1
            db   $e8
        @1:
      end;
      // junk instruction end
    end;
  end;

  Know more about CodeMorph Source Code Obfuscator

  Know more about SourceFormatX Delphi Code Obfuscator