Visitante
Ingresar
Registrarse
Underc0de - Hacking y seguridad informática
Menu
Inicio
Website
Blog
Buscar
Calendario
Ingresar
Registrarse
Underc0de - Hacking y seguridad informática
»
Programación General
»
C# - VB.NET
[VB.NET] Morse Encode/Decode
Imprimir
Páginas: [
1
]
Ir Abajo
« anterior
próximo »
[VB.NET] Morse Encode/Decode
0 Respuestas
2286 Vistas
0 Usuarios y 1 Visitante están viendo este tema.
fudmario
Underc0der
Mensajes: 198
Actividad:
0%
Reputación 13
Skype: fudmario
[VB.NET] Morse Encode/Decode
en: Diciembre 04, 2016, 05:33:10 pm
Ejemplo de Uso:
Código: vb.net
Dim
textEnc
As
String
=
MorseEncDec
.
Morse
(
word:
=
"EXAMPLE MORSE ENCODE DECODE FUNCTION"
,
mode:
=
Morse
.
Mode
.
Encode
)
Dim
textDec
As
String
=
MorseEncDec
.
Morse
(
word:
=
". -..- .- -- .--. .-.. . -- --- .-. ... . . -. -.-. --- -.. . -.. . -.-. --- -.. . ..-. ..- -. -.-. - .. --- -."
,
mode:
=
Morse
.
Mode
.
Decode
)
Código: vb.net
Public
NotInheritable
Class
MorseEncDec
Public
Enum
Mode
As
Integer
[
Encode
]
=
0I
[
Decode
]
=
1I
End
Enum
Public
Shared
Function
Morse
(
ByVal
word
As
String
, mode
As
Mode
)
As
String
Dim
res
As
String
=
String
.
Empty
Dim
dic
As
Dictionary
(
Of
String
,
String
)
dic
=
New
Dictionary
(
Of
String
,
String
)
From
{
{
"A"
,
".-"
}
,
{
"B"
,
"-..."
}
,
{
"C"
,
"-.-."
}
,
{
"D"
,
"-.."
}
,
{
"E"
,
"."
}
,
{
"F"
,
"..-."
}
,
{
"G"
,
"--."
}
,
{
"H"
,
"...."
}
,
{
"I"
,
".."
}
,
{
"J"
,
".---"
}
,
{
"K"
,
"-.-"
}
,
{
"L"
,
".-.."
}
,
{
"M"
,
"--"
}
,
{
"N"
,
"-."
}
,
{
"Ñ"
,
"--.--"
}
,
{
"O"
,
"---"
}
,
{
"P"
,
".--."
}
,
{
"Q"
,
"--.-"
}
,
{
"R"
,
".-."
}
,
{
"S"
,
"..."
}
,
{
"T"
,
"-"
}
,
{
"U"
,
"..-"
}
,
{
"V"
,
"...-"
}
,
{
"W"
,
".--"
}
,
{
"X"
,
"-..-"
}
,
{
"Y"
,
"-.--"
}
,
{
"Z"
,
"--.."
}
,
{
"Ä"
,
".-.-"
}
,
{
"Ö"
,
"---."
}
,
{
"Ü"
,
"..--"
}
,
{
" "
,
""
}
,
{
"0"
,
"-----"
}
,
{
"1"
,
".----"
}
,
{
"2"
,
"..---"
}
,
{
"3"
,
"...--"
}
,
{
"4"
,
"....-"
}
,
{
"5"
,
"....."
}
,
{
"6"
,
"-...."
}
,
{
"7"
,
"--..."
}
,
{
"8"
,
"---.."
}
,
{
"9"
,
"----."
}
,
{
"."
,
".-.-.-"
}
,
{
","
,
"--..--"
}
,
{
"?"
,
"..--.."
}
,
{
"!"
,
"..--."
}
,
{
":"
,
"---..."
}
,
{
""
""
,
".-..-."
}
,
{
"'"
,
".----."
}
,
{
"-"
,
"-....-"
}
,
{
"="
,
"-...-"
}
}
Select
Case
mode
Case
Mode
.
Encode
Dim
arrWord
As
IEnumerable
(
Of
Char
)
=
word
.
ToUpper
(
)
.
ToCharArray
(
)
Return
(
(
From
mStr
In
arrWord
Where
dic
.
ContainsKey
(
mStr
)
)
.
Aggregate
(
res,
Function
(
x, mStr
)
String
.
Format
(
"{0} {1}"
, x, dic
.
Item
(
mStr
)
)
)
)
.
Trim
(
)
Case
Mode
.
Decode
Return
(
(
From
letter
In
word
.
Split
(
" "
c
)
Select
dic
.
Where
(
Function
(
pair
)
pair
.
Value
=
letter
)
.
Select
(
Function
(
pair
)
pair
.
Key
)
.
FirstOrDefault
(
)
)
.
Aggregate
(
res,
Function
(
x, key
)
String
.
Format
(
"{0}{1}"
, x, key
)
)
)
.
Trim
(
)
End
Select
Return
String
.
Empty
End
Function
End
Class
En línea
Imprimir
Páginas: [
1
]
Ir Arriba
« anterior
próximo »
Similar topics (1)
[Function] Adf.ly Decode by fudmario[vb.net]
Iniciado por
fudmario
Respuestas: 5
Vistas: 5058
Junio 22, 2016, 05:07:37 pm
por
Kr3L
Sponsors
Zerpens
Kali-Linux
Club Hacker
ANTRAX-LABS
Ingresar
×
Bienvenido(a),
Visitante
. Por favor,
ingresa
o
regístrate
. ¿Perdiste tu
email de activación
?
1 Hora
1 Día
1 Semana
1 Mes
Siempre
Ingresar con nombre de usuario, contraseña y duración de la sesión