Main > Free Download Search >

Free wep key software for linux

wep key

Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 39
WEP Key Changer 0.2

WEP Key Changer 0.2


WEP Key Changer project, in short WepKC is a client/server application that allows you to protect your wireless network. more>>
WEP Key Changer project, in short WepKC is a client/server application that allows you to protect your ad-hoc (point to point) wireless network when you are unable to use (due to software or hardware limitations) sophisticated protocols like WPA.

The program consists out of two parts:

the wepkcd daemon, which randomly changes the WEP key after a specified amount of time and sends the chosen key, encrypted with AES, to the wepkcc client
the wepkcc client, which receives the key through the encrypted channel and changes the WEP key in the client machine

The server also waits for packets ("pings") from the client, resetting the WEP key to a defined value when the client goes down and stops pinging the server.

If someone tries to use the wireless network without contacting the server, the connection will be dropped repeatedly in order to prevent further annoyance from strangers (please note that this feature, at the moment, works only in *nix systems).

And its very easy to setup and use.

<<less
Download (4.2MB)
Added: 2006-08-14 License: GPL (GNU General Public License) Price:
1197 downloads
Wepdecrypt 0.8

Wepdecrypt 0.8


Wepdecrypt is a wireless LAN tool based on wepattack that guesses WEP keys using an active dictionary attack. more>>
Wepdecrypt is a Wireless LAN Tool written in c which guesses WEP Keys based on a active dictionary attack, key generator, distributed network attack and some other methods, Wepdecrypt based on wepattack and GPL licensed.
Main features:
- Implemented packet filters.
- Only one crypted packet is enough to start cracking
- Has its own key generator.
- Can crack a dumpfile over a network.
- Can act as a server and client.
- Has an fltk gui.
Enhancements:
- Applied destdir patch thanks to VMiklos from frugalware (first patch applied Thanks! :).
- Modified configure and Makefile to support destdir and wkeygen features.
- Now wordfile can contain hex keys just add HEXKEY_FILE to the first line. Feature sugested by Scott Taylor thanks!.
- Added wkeygen, wkeygen is a modified version of an add-on from linux-wlan-ng to generate wep hex keys.
- Added a man page for wkeygen tool.
- Documentation updated to show usage of new features.
- Some source code clean ups.
- Applied a patch from gentoo to fix a little compiling problem.
- Added support to save bssid in server log when a key is found by a client.
- Added new code to generate keys, it has been widely improved, updated wepdecrypt to use this new code (old code is still there it will be removed soon).
- Added an option to set the mode for the new key generator (all, alpha, alphanumeric, numeric, printable, random).
- Now -n option works as it was supposed to.
- Version and Help options added to the guis help menu.
- Gui look and functionalities changed (added an option to set -d flag and another option to set the numbers of blocks to get and decrypt from the server).
- Reconstructed the way in which gwepdecrypt handles the output data. This fixes two bugs one that caused use of 100% of the CPU and another related with gwepdecrypt output (no more cutted lines, also fixed in windows).
- Added code to check if wepdecrypt is installed before executing it in gwepdecrypt (fixes a crash in gwepdecrypt).
- Little speed up enhacement.
- Some Gui, wepdecrypt and wkeygen minor bugs fixed.
- Windows support (Done. Binaries will be released with the next version).
- Modified wepdecrypt scripts to look for john in the path.
- Added a todo file.
- Added a file called Examples.txt with scripts that use tools from wepdecrypt.
<<less
Download (0.090MB)
Added: 2006-07-09 License: GPL (GNU General Public License) Price:
1213 downloads
aeswepd 0.4

aeswepd 0.4


aeswepd is UNIX daemon for changing WEP keys of WLAN devices in constant intervals. more>>
aeswepd is UNIX daemon for changing WEP keys of WLAN devices in constant intervals. The WEP keys are calculated by encrypting the current UNIX time using the AES cypher with a given constant key. aeswepd strengthens the security of the weak hardware based, standards compliant WEP technology.

aeswepd may use up to three hardware WEP keys: the first is set to the current, the second to the previous and the third to the next key. This is useful when working with not completely synchronized RTCs. If only a single hardware WEP key is used, you have to synchronize your RTCs so that no connectivity interrupts may occur.

aeswepd has several advantages over other solutions to improve WEP: it is easy to use, doesnt involve computing intensive algorithms, doesnt increase traffic latency. On the other hand it has several disadvantages as well: it requires an installation of aeswepd on all network members, it is not standardized, currently only APs which run a flavour of Linux may be used with it.

<<less
Download (0.10MB)
Added: 2006-05-17 License: GPL (GNU General Public License) Price:
1257 downloads
Weplab 0.1.5

Weplab 0.1.5


Weplab is a tool to review the security of WEP encryption in wireless networks from an educational point of view. more>>
Weplab is a tool to review the security of WEP encryption in wireless networks from an educational point of view.
Several attacks are available so it can be measured the efectiveness and minimun requirements of each one.
Weplab helps you to understand and analyze the security weaknesses present on WEP encryption for wireless networks. Different attacks using several vulnerabilities can be launched.
The user can play with lots of cracking parameters so it is easier to understand what the algoritm is doing and how easy or difficult is to crack the WEP key.
Enhancements:
- Stupid bug with small packets (like arp) fixed. Minimun size decreased to 20 bytes. Now weplab works like a charm with a arp replay attack (aireplay).
- Prints the right ascii password when a key is cracked using the dictionary mode.
<<less
Download (0.12MB)
Added: 2005-09-19 License: GPL (GNU General Public License) Price:
1544 downloads
Eureka Public Key 1.0.0

Eureka Public Key 1.0.0


Eureka Public Key was created due to numerous requests for a public key application using our strong encryption techniques. more>>
Eureka Public Key was created due to numerous requests for a public key application using our strong encryption techniques. The basic principle for its use is one creates their own public key and distributes the key to whomever they will be transferring encrypted files with.

When one receives a key, they import it into their key database. You can create and import as many keys as you wish. Both public keys are used in the cryption process. You select your particular public key to use and the public key of the person who will receive it.

When a file has been received you put in your public key that matches the one they used and select their public key that was used in the encryption. See the Encryption, Decryption and Import/Export sections for more information on these topics. To create a public key, click on Keys then Create Public Key or click on the gold key icon under the menu items.

All you have to do is define a name for the public key and click on Create. All encrypted files will be written to the Encryptions folder. Likewise, all decrypted files will go to the Decryptions folder. If a file already exists with the same name, it will be overwritten.

Encryption:

To Encrypt a file, click on File then Encrypt.

All you have to do is select Your public key, their public key and click on Encrypt or press enter then select the file you want to process.

The file selected will be encrypted and then placed in your Encryptions folder. Now you can send this file in the manner you prefer.

Note that this application encrypts in a binary format. In other words, it uses the full 256 character set and is not a text file. You will need to send it as an attachment if you are using email to transmit it.

Decryption:

To Decrypt a file, click on File then Decrypt.

All you have to do is select Your public key, their public key then click on Decrypt and select the file you want to process.

The file selected will be decrypted and then placed in your Decryptions folder.
<<less
Download (2.6MB)
Added: 2007-05-10 License: Freeware Price:
959 downloads
seppl 0.4

seppl 0.4


seppl is both a protocol definition and a software implementation of a new encryption layer for IPv4. more>>
seppl is both a protocol definition and a software implementation of a new encryption layer for IPv4. seppl project makes use of symmetric cryptography for encrypting the whole traffic on a network. Its implementation is designed around Linux netfilter/iptables.
seppl introduces two new netfilter targets: CRYPT and DECRYPT. A firewall rule may thus be used for encrypting/decrypting the incoming and outgoing network traffic. This makes seppl extraordinarily easy to use, since no daemons need to run for secure communication.
seppl uses the encryption engine of the Linux Cryptographic API which is available in kernel 2.4.22 and newer.
seppl is primarily intended for encrypting wireless LANs (as secure replacement of the broken WEP encryption) and local ethernet networks but may be used for large scale VPN solutions as well.
The protocol seppl relies on is not compatible with any other software. The protocol is open and well defined but there is no implementation other than this reference software.
Why SEPPL, there are already IPSEC, CIPE,...?
CIPE may be used for point-to-point connections only. It has tunnel structure and thus introduces new IP addresses. This is not always desirable. It requires a user space daemon.
IPSEC/FreeSwan is extremely complicated to use. Due to its strange routing scheme it is nearly impossible to use together with routing daemons. IPSEC is heavyweight.
seppl is truely peer-to-peer. It encrypts seamlessly all outgoing traffic and it thus compatible with routing daemons. It is extremely easy to use as well, as it makes no change to the normal routing behaviour. seppl is extremely lightweight.
The Implementation
The implementation consists of three Linux kernel modules: seppl.o, ipt_CRYPT.o and ipt_DECRYPT.o. The former is the in-kernel key manager, the latter are the two new netfilter targets. Both depend on seppl.o.
seppl.o must be inserted into kernel in first place. The key manager may be accessed with the file /proc/net/seppl_keyring. It contains binary key data, and is initially empty. You may add a new key by writing it to that file.
The two Python scripts seppl-ls and seppl-gen-key me be used for key management. seppl-ls may be used for converting seppl keys between the binary format used by /proc/net/seppl_keyring and a human readable XML based format. Simply call seppl-ls for a list of all currently active keys. seppl-gen-key generates a new key from /dev/urandom. By default it will use the XML format. The parameter -x forces binary mode. You may generate and activate two keys "linus" and "alan" by issuing the following command lines:
seppl-gen-key -n linus -x > /proc/net/seppl_keyring
seppl-gen-key -n alan -x > /proc/net/seppl_keyring
seppl-ls without argument lists the new keys saved in the kernel keyring. You may remove all (currently unused) keys by issuing:
echo clear > /proc/net/seppl_keyring
Since seppl is based on symmetric cryptography using shared keys you have to copy newly generated keys to every host you want to connect to your seppl infrastructure. (preferably via SSH or any other secure file transfer) You get a binary copy of your current keyring by issuing:
cat /proc/net/seppl_keyring > keyring.save
Now copy that file keyring.save to all other hosts and issue the following command there:
cat keyring.save > /proc/net/seppl_keyring
That is simple, isnt it?
After doing so you may configure your firewall settings on each host:
iptables -t mangle -A POSTROUTING -o eth0 -j CRYPT --key linus
iptables -t mangle -A PREROUTING -i eth0 -j DECRYPT
This will encrypt all outgoing traffic on eth0 with the key "linus". All incoming traffic is decrypted with either "linus" or "alan", depending on the key name specified in the specific network packet. Unencrypted incoming packets are silently dropped. Use
iptables -t mangle -A PREROUTING -p 177 -i eth0 -j DECRYPT
for allowing both crypted and unencrypted incoming traffic.
Thats it. Youre done. All your traffic on the local subnet is now crypted with seppl.
The default cipher is AES-128. If you dont specify the name of the used key it defaults to "def".
An SysV init script /etc/init.d/seppl is provided. It will load seppls kernel modules and write all keys from the directory /etc/seppl to the kernel keyring. It will not add any firewall rules, however.
Performance issues
The network packets are increased in size when they are crypted, since two new headers and the IV are added. (36 bytes in average) This conflicts on some way with the MTU management of the Linux kernel and results in having all large packets (that is: package size near MTU) fragmented in one large and another very small package. This will hurt network performance. A work-around of this limitation is using the TCPMSS target of netfilter to adjust the MSS value in the TCP header to smaller values. This will increase TCP perfomance, since TCP packets of the size of the MTU are no longer generated. Thus no fragmentation is needed. However, TCPMSS is TCP specific, it wont help on UDP or other IP protocols.
Add the following line before encryption to your firewall setup:
iptables -t mangle -A POSTROUTING -p tcp --tcp-flags SYN,RST SYN -o eth0 -j TCPMSS --set-mss $((1500-40-8-16-6-15))
The Protocol
For encryption every single unencrypted packet is taken and converted to a crypted one. Not a single further packet is ever sent.
Original SEPPL counterpart
+------------+ +-----------------------+
| IP-Header | | Modified IP-Header | |
+------------+ +-----------------------+ |
| Payload | | SEPPL-Header | > Unencrypted
+------------+ +-----------------------+ |
| Initialization Vector | |
+-----------------------+ /
| SEPPL-Header |
+-----------------------+ | Crypted
| Payload | |
+-----------------------+ /
The original IP header is kept as far as possible. Only three fields are replaced with new values. The protocol number is set to 177, the fragment offset is set to 0 and the total length is corrected to the new length. All other fields are kept as is, including IP options.
The unencrypted seppl header consists of a one-byte cipher number and a key name. Currently only 0 and 1 are defined as cipher numbers for AES with 128bit key, resp. AES with 192bit key. The key name (7 bytes) may be used to select a specific key in a larger keyring.
The IV is used for CBC coding of the cipher used. It differs from packet to packet, but is not randomly generated. Due to perfomance reasons, only the initial IV on system startup is randomized, all following IVs are generated by incrementing the previous ones.
The crypted seppl header consists of three saved fields of the original IP header (protocol number, fragment offset, total length) and a byte which is always 0 for detecting unmatching keys.
The payload is the original IP-playload, from the TCP/UDP/other header to the end.
Version restrictions:
- seppl interferes with netfilters connection tracking in some way. Thus you will not be able to use NAT in conjunction with seppl. If you use connection tracking in some other way together with seppl your mileage may vary.
- seppl is tested with Linux 2.6.1. Use version 0.3 for Linux 2.4.
<<less
Download (0.32MB)
Added: 2006-05-17 License: GPL (GNU General Public License) Price:
1255 downloads
ESE Key Daemon 1.2.3

ESE Key Daemon 1.2.3


ESE Key Daemon is a multimedia keyboard driver for Linux. more>>
ESE Key Daemon is a multimedia keyboard driver for Linux. No kernel patch is needed.
ESE Key Daemon is a userspace program which pools /dev/input/event interfaces for incoming keyboard key presses.
Enhancements:
- A bug in the configuration file handling routines was fixed.
<<less
Download (0.10MB)
Added: 2006-06-02 License: GPL (GNU General Public License) Price:
1240 downloads
Raw Fake AP 0.2

Raw Fake AP 0.2


Raw Fake AP is a program that emulates valid IEEE 802.11 access points using wireless raw injection. more>>
Raw Fake AP is a program that emulates valid IEEE 802.11 access points using wireless raw injection.
Raw Fake AP application aims to create both beacon and probe response frames and could be used to "hide" real networks from novice wardrivers or for testing wireless intrusion detection systems.
Main features:
Overall features:
- Raw injection of beacon and probe response frames in monitor mode
- Try to forge coherent sequence numbers and BSS timestamps (depending on driver injection capabilities)
- Try to have a coherent time interval between beacons (which is hard to achieve without a real time kernel)
Command line interface will help you to choose between:
- Randomize Open/WEP/WPA/RSN crypto
- Randomize b/g cards
- Channel hopping
- TXpower hopping
- Randomize ESSIDs (alnum or not)
- Randomize BSSIDs
- Choose beacon interval
- Choose number of fake access points
- Choose a file with valid OUIs
- Choose a file with ESSIDs
- Choose between beacon or probe response frames
- Select a destination MAC address
<<less
Download (0.013MB)
Added: 2006-02-08 License: GPL (GNU General Public License) Price:
1380 downloads
The Hacker Key Guide 4

The Hacker Key Guide 4


The Hacker Key Guide allows hackers, both current and aspiring, to encode vital information about their traits. more>>
The Hacker Key Guide allows hackers, both current and aspiring, to encode vital information about their traits into a single line of text, generally useful for sig files.
The Hacker Key Guide is based in principle on the wonderful Geek Code by Robert Hayden, but is skewed further to the geek programming niche.
Enhancements:
- Category additions include "Cygwin" for Windows, "MMO" and "RTS" to games, and several new additions to the books section.
- Answers 2 and 3 in math were changed for those hackers still in secondary school.
- The Linux section was completely revamped and updated, and the user-specified (O)ther option was added to Linux and IDE/text editors.
- The politics section now uses the Political Compass website ratings.
<<less
Download (MB)
Added: 2007-01-03 License: (FDL) GNU Free Documentation License Price:
1042 downloads
SSH with Keys HOWTO 0.08

SSH with Keys HOWTO 0.08


SSH with Keys HOWTO is a document which shows how to use SSH with keys, passphrases, and ssh-agent. more>>
SSH with Keys HOWTO is a document which shows how to use SSH with keys, passphrases, and ssh-agent.

For those of you who have been using SSH for a while, you will probably understand its advantages over the previous telnet style applications such as telnet and remote shell.

Although SSH with keys has always been there, not many people know what it is about, and how you can utilize its strenghts to make your life as a system administrator a bit more easy.
<<less
Download (MB)
Added: 2006-10-04 License: (FDL) GNU Free Documentation License Price:
1117 downloads
waproamd 0.6

waproamd 0.6


waproamd is a Linux WLAN roaming daemon for IEEE 802.11b cards supported by a driver with the wireless extension API. more>>
waproamd is a Linux WLAN roaming daemon for IEEE 802.11b cards supported by a driver with the wireless extension API.
It is intended to configure the WEP keys according to the networks found.
Due to driver and stability issues, starting from version 0.5 ifplugd is no longer recommended for joint use with waproamd.
The default action scripts of waproamd are modified accordingly: they run ifup/ifdown on their own behalf when a new network became available or and old one is lost.
If you like you may still use waproamd and ifplugd on the same interface together, but you have to modify the default configuration to reflect that.
An alternative implementation of a tool like this is [17]wlandetect.
Mode of Operation:
As long as the local NIC is not associated to any wireless network waproamd scans iteratively for them. If one is detected, a script in /etc/waproamd/scripts/ named after the MAC address of the access point is called (First lowercase, than uppercase is checked).
If a script like this is not found a script named essid: in the same directory is used. Special characters are escaped in an HTTP URL like fashion. If this script is not existent, /etc/waproamd/scripts/default is called instead.
The first argument to this script is "start". If the association is lost, the same script is run with the argument "stop". While the NIC is associated no scans are issued.
If multiple WLANs are detected at the same time, the network which is detected by the hardware first is selected. However, networks where a matching script exists take precedence.
waproamd requires a network driver supporting the Linux wireless extensions v15 or newer. The driver needs to support scanning for wireless networks, which may be tested by running "iwlist scan".
If the driver supports the wireless event subsystem, waproamd may use it to improve latency behaviour. It is not required, however.
waproamd supports the host_roaming private ioctl() as defined by the [21]hostap driver.
Dont forget to install a firewall on your computer, since waproamd will try to log into any network it finds with default settings, if not configured otherwise. Yes, you a right, waproamd is war-driving on steroids.
Enhancements:
- added spec file
- disable host roaming by default
- the default configuration doesnt rely on ifplugd anymore
<<less
Download (0.12MB)
Added: 2005-09-21 License: GPL (GNU General Public License) Price:
1493 downloads
Gnome Multimedia Keys 0.2

Gnome Multimedia Keys 0.2


Gnome Multimedia Keys is an Amarok script that will allow the use of keyboard multimedia keys in Gnome 2.18 and above. more>>
Gnome Multimedia Keys is an Amarok script that will allow the use of keyboard multimedia keys in Gnome 2.18 and above (eg. ubuntu feisty) to control playback. This includes most multimedia buttons found on many laptops. Support for this was broken due to changes in the handling of keyboard shortcuts by gnome 2.18.
Currently supported operations are:
- Play/Pause
- Pause
- Stop
- Next Track
- Previous Track
Simply run the script, no configuration of the script itself is required. The desired keyboard shortcuts can be configured by selecting "System-->Prefrences-->Keyboard Shortcuts" from the Gnome panel.
<<less
Download (0.002MB)
Added: 2007-06-29 License: GPL (GNU General Public License) Price:
852 downloads
Lock Keys Applet 1.0

Lock Keys Applet 1.0


Lock Keys Applet (formerly Led_applet) is a GNOME 2 applet that shows the status of the Caps-, Num-, and Scroll Lock keys. more>>
Lock keys Applet is a GNOME-applet, that shows the status of the caps-, num- and scroll-lock keys of your keyboard.
This isnt especially usefull for normal keyboards, as they got leds for that. But some keyboards (especially wireless keyboards) dont have. One more feature of the applet is that it saves the status of the lock-keys and restores it, when starting GNOME.
Installation:
The `configure shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile in each directory of the package.
It may also create one or more `.h files containing system-dependent definitions.
Finally, it creates a shell script `config.status that you can run in the future to recreate the current configuration, a file `config.cache that saves the results of its tests to speed up reconfiguring, and a file `config.log containing compiler output (useful mainly for debugging `configure).
If you need to do unusual things to compile the package, please try to figure out how `configure could check whether to do them, and mail diffs or instructions to the address given in the `README so they can be considered for the next release.
If at some point `config.cache contains results you dont want to keep, you may remove or edit it.
The file `configure.in is used to create `configure by a program called `autoconf. You only need `configure.in if you want to change it or regenerate `configure using a newer version of `autoconf.
The simplest way to compile this package is:
1. `cd to the directory containing the packages source code and type `./configure to configure the package for your system.
If youre using `csh on an old version of System V, you might need to type `sh ./configure instead to prevent `csh from trying to execute `configure itself.
Running `configure takes awhile. While running, it prints some messages telling which features it is checking for.
2. Type `make to compile the package.
3. Optionally, type `make check to run any self-tests that come with the package.
4. Type `make install to install the programs and any data files and documentation.
5. You can remove the program binaries and object files from the source code directory by typing `make clean. To also remove the files that `configure created (so you can compile the package for a different kind of computer), type `make distclean.
There is also a `make maintainer-clean target, but that is intended mainly for the packages developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution.
Enhancements:
- (almost) completly renamed everything to lock-keys-applet
<<less
Download (0.27MB)
Added: 2005-09-29 License: GPL (GNU General Public License) Price:
1485 downloads
DVB Remote Key Editor 0.2.1

DVB Remote Key Editor 0.2.1


DVB Remote Key Editor project was made in order to have an easy way of modifying the keymaps of DVB-T remotes. more>>
DVB Remote Key Editor project was made in order to have an easy way of modifying the keymaps of DVB-T remotes which are usually hardcoded in the corresponding kernel-modules.

Currently this works for the following models:

Haupauge Win-TV Nova-T USB2 dvb-usb-nova-t-usb2.ko 45
Cinergy T2 cinergyT2.ko 37
AVerMedia AverTV DVB-T dvb-usb-a800.ko 34
Generic dib-usb Driver dvb-usb-dibusb-common.ko 63
WideView/Yakumo/Hama/Typhoon/Yuan DVB-T USB2 dvb-usb-dtt200u.ko 18
TwinhanDTV Alpha/MagicBoxII USB2 dvb-usb-vp7045.ko 32

This will not work if your kernel is enabled to use ksign, which secures kernel-modules against binary modifications.

Usage:

Run as root by executing: gksudo python dvb-remote-key-editor.py

Warning: This application binary patches a kernel module. Therefore be sure to make a backup of the module. THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY!

<<less
Download (0.014MB)
Added: 2007-01-22 License: GPL (GNU General Public License) Price:
619 downloads
Sort::Key 1.28

Sort::Key 1.28


Sort::Key is the fastest way to sort anything in Perl. more>>
Sort::Key is the fastest way to sort anything in Perl.

SYNOPSIS

use Sort::Key qw(keysort nkeysort ikeysort);

@by_name = keysort { "$_->{surname} $_->{name}" } @people;

# sorting by a numeric key:
@by_age = nkeysort { $_->{age} } @people;

# sorting by a numeric integer key:
@by_sons = ikeysort { $_->{sons} } @people;

Sort::Key provides a set of functions to sort lists of values by some calculated key value.

It is faster (usually much faster) and uses less memory than other alternatives implemented around perl sort function (ST, GRT, etc.).

Multikey sorting functionality is also provided via the companion modules Sort::Key::Multi, Sort::Key::Maker and Sort::Key::Register.

FUNCTIONS

This module provides a large number of sorting subroutines but they are all variations off the keysort one:

@sorted = keysort { CALC_KEY($_) } @data

that is conceptually equivalent to

@sorted = sort { CALC_KEY($a) cmp CALC_KEY($b) } @data

and where CALC_KEY($_) can be any expresion to extract the key value from $_ (not only a subroutine call).

For instance, some variations are nkeysort that performs a numeric comparison, rkeysort that orders the data in descending order, ikeysort and ukeysort that are optimized versions of nkeysort that can be used when the keys are integers or unsigned integers respectively, etc.

Also, inplace versions of the sorters are provided. For instance

keysort_inplace { CALC_KEY($_) } @data

that is equivalent to

@data = keysort { CALC_KEY($_) } @data

but being (a bit) faster and using less memory.

The full list of subroutines that can be imported from this module follows:

keysort { CALC_KEY } @array

returns the elements on @array sorted by the key calculated applying { CALC_KEY } to them.

Inside { CALC_KEY }, the object is available as $_.

For example:

@a=({name=>john, surname=>smith}, {name=>paul, surname=>belvedere});
@by_name=keysort {$_->{name}} @a;

This function honours the use locale pragma.

nkeysort { CALC_KEY } @array

similar to keysort but compares the keys numerically instead of as strings.

This function honours the use integer pragma, i.e.:

use integer;
my @s=(2.4, 2.0, 1.6, 1.2, 0.8);
my @ns = nkeysort { $_ } @s;
print "@nsn"
prints
0.8 1.6 1.2 2.4 2

rnkeysort { CALC_KEY } @array
works as nkeysort, comparing keys in reverse (or descending) numerical order.
ikeysort { CALC_KEY } @array
works as keysort but compares the keys as integers (32 bits or more, no checking is performed for overflows).
rikeysort { CALC_KEY } @array
works as ikeysort, but in reverse (or descending) order.
ukeysort { CALC_KEY } @array
works as keysort but compares the keys as unsigned integers (32 bits or more).

For instance, it can be used to efficiently sort IP4 addresses:

my @data = qw(1.2.3.4 4.3.2.1 11.1.111.1 222.12.1.34
0.0.0.0 255.255.255.0) 127.0.0.1);

my @sorted = ukeysort {
my @a = split /./;
(((($a[0] name,
$_->middlename },
qw(str str str);

Sort::Key::register_type Color =>
sub { $_->R, $_->G, $_->B },
qw(int int int);

Once a datatype has been registered it can be used in the same way as types supported natively, even for defining new types, i.e.:

Sort::Key::register_type Family =>
sub { $_->man, $_->woman },
qw(Person Person);

<<less
Download (0.055MB)
Added: 2007-05-22 License: Perl Artistic License Price:
888 downloads
Secleted [ 0 ] software to compare
  • Page: 1 of 3
  • 1
  • 2
  • 3