Search Results

Search found 5192 results on 208 pages for 'random forests'.

Page 94/208 | < Previous Page | 90 91 92 93 94 95 96 97 98 99 100 101  | Next Page >

  • is this aes encryption wrapper safe ? - yet another take...

    - by user393087
    After taking into accound answers for my questions here and here I created (well may-be) improved version of my wrapper. The key issue was what if an attacker is knowing what is encoded - he might then find the key and encode another messages. So I added XOR before encryption. I also in this version prepend IV to the data as was suggested. sha256 on key is only for making sure the key is as long as needed for the aes alg, but I know that key should not be plain text but calculated with many iterations to prevent dictionary attack function aes192ctr_en($data,$key) { $iv = mcrypt_create_iv(24,MCRYPT_DEV_URANDOM); $xor = mcrypt_create_iv(24,MCRYPT_DEV_URANDOM); $key = hash_hmac('sha256',$key,$iv,true); $data = $xor.((string)$data ^ (string)str_repeat($xor,(strlen($data)/24)+1)); $data = hash('md5',$data,true).$data; return $iv.mcrypt_encrypt('rijndael-192',$key,$data,'ctr',$iv); } function aes192ctr_de($data,$key) { $iv = substr($data,0,24); $data = substr($data,24); $key = hash_hmac('sha256',$key,$iv,true); $data = mcrypt_decrypt('rijndael-192',$key,$data,'ctr',$iv); $md5 = substr($data,0,16); $data = substr($data,16); if (hash('md5',$data,true)!==$md5) return false; $xor = substr($data,0,24); $data = substr($data,24); $data = ((string)$data ^ (string)str_repeat($xor,(strlen($data)/24)+1)); return $data; } $encrypted = aes192ctr_en('secret text','password'); echo $encrypted; echo aes192ctr_de($encrypted,'password'); another question is if ctr mode is ok in this context, would it be better if I use cbc mode ? Again, by safe I mean if an attacter could guess password if he knows exact text that was encrypted and knows above method. I assume random and long password here. Maybe instead of XOR will be safer to random initial data with another run of aes or other simpler alg like TEA or trivium ?

    Read the article

  • AJAX Div Retrieval every 60 seconds

    - by Sam
    Hello everyone! What I would like to do is retrieve the contents of a PHP file and insert it into a div every 60 seconds, basically refreshing the dynamic div. I've come up with the following code so far, however it doesn't seem to be working. The code is just like this, nothing extra, apart from the MYSQL login. PHP to grab: <?php $time = date("m/d/Y h:i:s a", time()); mysql_query("UPDATE djs SET requesttime='{$time}' WHERE username='{$djs['username']}'") or die(mysql_error()); $request_db = mysql_query("SELECT * FROM requests WHERE haveplayed='0'") or die(mysql_error()); echo "<table style=\"border:1px solid;width:99%;margin-left:auto;margin-right:auto;\" border=\"1\">"; echo "<tr><th>Title</th><th>Artist</th><th>Dedicated To...</th></tr>"; while($request = mysql_fetch_array( $request_db )) { echo "<tr><td style=\"width:33%;padding:1px;\">"; echo $request['SongName']; echo "</td><td style=\"width:33%;\">"; echo $request['Artist']; echo "</td><td style=\"width:33%;\">"; echo $request['DedicatedTo']; echo "</td></tr>"; } echo "</table>"; ?> The original PHP code is just the same, enclosed in a div with an id attribute of 'ajax_table'. The JavaScript is: // JavaScript Document var xmlHttp_moniter function moniter() { xmlHttp_moniter = GetXmlHttpObject_parcel() if(xmlHttp_moniter == null) { alert("browser does not support HTTP Request") return } var url="ajax_table.php?random=" + Math.random() xmlHttp_moniter.onreadystatechange = stateChanged xmlHttp_moniter.open("GET",url,true) xmlHttp_moniter.send(null) } function stateChanged() { if(xmlHttp_moniter.readyState==4 || xmlHttp_moniter.readyState == "complete") { document.getElementById("ajax_table").innerHTML = xmlHttp_moniter.responseText setTimeout('ajax_table()',60000); } } function GetXmlHttpObject_parcel() { var xmlHttp_moniter=null; try { xmlHttp_moniter=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp_moniter=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp_moniter=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp_moniter; } and that is on the page that is requesting the other php page.

    Read the article

  • C++ STL list vs set

    - by mokaschitta
    Hi, what of those two is faster for random insertions and deletions? I guess list, having the values as the keys as it is with sets seems to be attractive too though. Is performance similar for iterating over the whole container? Thanks!

    Read the article

  • perl + want to put uniq char as @ without backslash "\"

    - by yael
    I need to know if there is some way to replace any string as @ or * or ? or & without to put the "\" before it Example perl -pe 'next if /^#/; s/\@d\&/new_value/ if /param5/' test in this example need to replace the @d& with new_value but I need to put the "\" before @ or & can be other way without to put the "\" because I have random char that can be in the old value.

    Read the article

  • Layout of popup components changes while moving

    - by Le_Coeur
    I have designed some popup moving menu with JQuery, it looks perfekt in webkit browsers, but i have one problem in mozilla, when i move my popup window, layout of some components in this window changes! For example button add changes from: to: or to: , and it's absolutly random. What can it be?

    Read the article

  • C++: Unitialized variables garbage

    - by Hardware Problem
    int myInt; cout << myInt; // Garbage like 429948, etc If I output and/or work with unitialized variables in C++, what are their assumed values? Actual values in the memory from the "last user"? e.g.: Program A is closed, it had an int with the value 1234 at 0x1234 - I run my program, myInt gets the address 0x1234, I output it like above - 1234 Is it just random garbage?

    Read the article

  • How can i optimize this python code

    - by RandomVector
    def maxVote(nLabels): count = {} maxList = [] maxCount = 0 for nLabel in nLabels: if nLabel in count: count[nLabel] += 1 else: count[nLabel] = 1 #Check if the count is max if count[nLabel] > maxCount: maxCount = count[nLabel] maxList = [nLabel,] elif count[nLabel]==maxCount: maxList.append(nLabel) return random.choice(maxList) nLabels contains a list of integers. The above function returns the integer with highest frequency, if more than one have same frequency then a randomly selected integer from them is returned. E.g. maxVote([1,3,4,5,5,5,3,12,11]) is 5

    Read the article

  • Using two threads and controlling one from the other in java?

    - by sidra
    Can someone please help me out. I need to use two threads in a way that one thread will run permanently while(true) and will keep track of a positioning pointer (some random value coming in form a method). This thread has a logic, if the value equals something, it should start the new thread. And if the value does not equal it should stop the other thread. Can someone give me some code snippet (block level) about how to realize this?

    Read the article

  • jquery .live() click multiple times

    - by user355227
    Hi, I am trying to make a script that updates the captcha image, that is loaded through live() function... It works, but it only updates the image 1 time on firefox, 2 times on safari... How can I make this to work multiple times? jquery 1.4.2 relevant part of code: /* captcha image change */ var rand = Math.random(); $('a.captcha_refresh').live('click', function() { $('img.captcha').attr("src", 'captchashow.php?sid=' + rand); }); thanks, brm

    Read the article

  • correct function parameters designation

    - by david
    Every time i pass some parameters to a JavasScript or jQuery functon, i use some random letters. What are the correct letters for the corresponding variable types? function(o){} for example is for a object. But what are the other letters? Do someone have a list of those?

    Read the article

  • PHP Redirect after execution of code

    - by UmYeah
    I have a php page that takes in a bunch of url parameters and sends out an email. I am trying to have this page call another web page using the same url parameters, after the mail is sent. If I do the following, will my email be sent reliably? Is a redirect what I really want to do? Random code to send email... header('Location: http://www.othersite.com/' + $_SERVER["REQUEST_URI"]);

    Read the article

  • Hashing (hidding) strings in Python

    - by Lucas
    What I need is to hash a string. It doesn't really have to be secure because its just going to be a hidden pharse in the text file (simply it doesn't have to be recognizable for a human-eye). It should not be just a random string because when user will be typing the string I would like to hash it and compare it with already hashed one (in the text file). What would be the best for this purpose? Can it be done with the own class?

    Read the article

  • New help with SQL Server select statement

    - by gio_333m
    I need help with select statement in SQL Server / T-SQL My table looks like this: Id (int) QuestionId (int) GenreId (int) I want to select random N rows from this table so that maximum number of same GenreId in the result set is less than X for all GenreId-s except one. For that one GenreId, I need row count with that GenreId to be equal to Y.

    Read the article

  • [Android] Is disabling landscape mode unforgivable?

    - by Nicolas Raoul
    Our application could support landscape mode without any problem, but it is such a pain that we are thinking about forcing portrait mode. Question: Is it BAD? The main problem is that changing orientation generates random crashes on many screens. Avoiding those crashes would potentially allow us to spend more time on the core aspects of the app. Will the same crashes happen when users switch apps anyway? Also, are there landscape-oriented devices where our app will become useless?

    Read the article

  • write a MIDI file in C++

    - by mrbuxley
    Hi I Have some problems finding the right information about this and would be glad if someone could point me in the right direction. How do you code a midifile? e.g. how can I write a snippet that plays a random tone for 1 second. Basically what I would need to get done is representing differnet midi melodys as vectors of some sort? How can I do this..

    Read the article

  • Implementing a 30 day time trial

    - by svintus
    Question for indie Mac developers out there: How do I implement a 30-day time trial in a non-evil fashion? Putting a counter in the prefs is not an option, since wiping prefs once a month is not a problem for an average user. Putting the counter in a hidden file somewhere sounds a bit dodgy - as a user I hate when apps sprinkle my hard drive with random files. Any ideas?

    Read the article

  • Lotto program doesn't stop

    - by Naseyb Yaramis
    So I'm making a lotto game. You have to enter 6 lucky numbers and if they're the same as the lotto numbers then you win. Here is my code: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace OefeningExaam { class Program { static void Main(string[] args) { Random getal = new Random(); int[] lottotrekking = new int[6]; Console.WriteLine("Geef je geluksgetallen in <tussen 1 en 42>"); Console.WriteLine("Geef je eerste getal in"); int getal1 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Geef je tweede getal in"); int getal2 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Geef je derde getal in"); int getal3 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Geef je vierde getal in"); int getal4 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Geef je vijfde getal in"); int getal5 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Geef je zesde getal in"); int getal6 = Convert.ToInt32(Console.ReadLine()); while (getal1 != lottotrekking[0] || getal2 != lottotrekking[1] || getal3 != lottotrekking[2] || getal4 != lottotrekking[3] || getal5 != lottotrekking[4] || getal5 != lottotrekking[4] || getal6 != lottotrekking[5]) { for (int i = 0; i < lottotrekking.Length; i++) { int cijfer = getal.Next(1, 43); lottotrekking[i] = cijfer; Console.WriteLine(lottotrekking[0] + "\t " + lottotrekking[1] + "\t " + lottotrekking[2] + "\t " + lottotrekking[3] + "\t " + lottotrekking[4] + "\t " + lottotrekking[5]); } } if (getal1 == lottotrekking[0] && getal2 == lottotrekking[1] && getal3 == lottotrekking[2] && getal4 == lottotrekking[3] && getal5 == lottotrekking[4] && getal5 == lottotrekking[4] && getal6 == lottotrekking[5]) { Console.WriteLine(lottotrekking[0] + " " + lottotrekking[1] + " " + lottotrekking[2] + " " + lottotrekking[3] + " " + lottotrekking[4] + " " + lottotrekking[5]); } Console.ReadLine(); } } } The problem is that the program just keeps going and doesn't stop. It's supposed to stop when the lucky numbers are the same as the lotto numbers.

    Read the article

  • Array help in C++

    - by user267237
    I am writing a program that is declaring an array of 100 integer numbers and filling the array with random numbers using rand(). All I have so far is: #include <iostream> using namespace std; int main() { int random_integer = rand();

    Read the article

  • neww help with MSSQL select statement

    - by gio_333m
    Hello, I need help with select statement in MSSQL. My table looks like this: Id (int) QuestionId (int) GenreId (int) I want to select random N rows from this table so that maximum number of same GenreId in the result set is less than X for all GenreId-s except one. For that one GenreId, I need row count with that GenreId to be equal to Y. Thanks in advance

    Read the article

< Previous Page | 90 91 92 93 94 95 96 97 98 99 100 101  | Next Page >